Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to notify Microsoft Teams from Bitbucket Pipeline?

Hey there, I'm new to Bitbucket Pipelines, and am trying to see if I can duplicate my Jenkins pipelines' functionality with a pipeline on Bitbucket.

I've got a pipeline running, but I can't seem to get it to notify us when it's finished running.

Here's what I'm trying to do: update a Teams channel when a pipeline build has started or completed. When it's completed, I'd like to post its build status. That's it. Nothing fancy.

Here's as far as I've gotten:

  1. created an internal webhook in my Teams channel
  2. set up a webhook in my repo in my-repo> Settings > Webhooks using the URL generated in step 1. chose ""Build status created" and "Build Status updated" as the Triggers"
  3. Made a change on a branch of my-repo and pushed the change up
  4. Watched the build start and finish
  5. Watched no notifications come into the Teams channel.

Any ideas what steps I might be missing? I'm on Bitbucket Cloud, btw.

2 answers

1 accepted

0 votes
Answer accepted

I found the solution myself, albeit a very basic one: set this up as an item in the "script" portion of after-script:

- curl -H "Content-Type: application/json" -d "{'text':'Hello World'}" https://<WEBHOOK URL> 

 

Here's why I got snagged up: I was following the Microsoft docs  for formatting the -d argument, but was getting a linting error in 'text': 'Hello World' because VS Code's linter, the Redhat YAML extension, was seeing the space after the colon in that payload and was barking about me trying to submit YAML. I removed the space, the barking stopped, the notification happened. 

Now I get to go down the fun rabbit hole of string interpolation and passing variables inside single quotes, which bash hates.

Hello @inger_klekacz ,

 

You can use Microsoft Teams Bitbucket Connector. There is a short guide on how to set it up, but otherwise it is pretty simple.

 

If you have any questions please feel free to reach out.

 

Regards,

Leo

That was my first attempt, but it seemed like it supported everything except build status, which is basically the only thing I need right now. BTW when I was trying to figure it out, I clicked on the Support > Documentation link from the Marketplace link you posted, and the docs link was a 404. Thanks anyway, though.

@inger_klekacz thanks, actually that's also what we need. From what I can tell the connector simply handles notifications globally around repository operations whereas we needed custom notifications issued from within pipelines on a per step basis.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

161 views 3 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you