Skip to content

Codepipeline notify pipeline status back to bitbucket

0

Hello, i have a bitbucket integration, using codestarconnection between codepipeline and bitbucket, it is being triggered correctly as per pull requests, etc, but I'm unable to see the pipeline status on bitbucket interface. Is there any additional configuration I need to do to see such thing?

asked 2 years ago341 views

1 Answer
0

To see the AWS CodePipeline status directly in your Bitbucket interface when using a CodeStar connection, there isn't a built-in feature that automatically displays this information. However, you can set up a solution to notify Bitbucket about your pipeline status using Amazon EventBridge (formerly CloudWatch Events) in combination with AWS Lambda or another service that can interact with Bitbucket's API.

Here's a high-level approach you could consider:

  1. Use Amazon EventBridge to monitor CodePipeline events. CodePipeline reports events to EventBridge whenever the state of a resource changes, including pipeline executions, stage executions, and action executions.

  2. Create an EventBridge rule that triggers when specific CodePipeline events occur, such as when a pipeline execution starts, succeeds, or fails.

  3. Set up an AWS Lambda function as the target for this EventBridge rule. This Lambda function would be responsible for calling the Bitbucket API to update the status of your pull request or commit.

  4. In your Lambda function, you'll need to implement the logic to authenticate with Bitbucket and use its API to update the status. This might involve creating a build status in Bitbucket that corresponds to your pipeline's state.

  5. Ensure that your Lambda function has the necessary permissions to interact with both EventBridge and to make external API calls to Bitbucket.

This solution would require some custom development and configuration, as it's not a out-of-the-box feature of the CodeStar connection. You'd need to handle the mapping between CodePipeline states and Bitbucket build statuses, manage authentication with Bitbucket, and potentially deal with rate limiting and other API considerations.

Remember that while this approach can provide status updates in Bitbucket, it won't be as tightly integrated as native Bitbucket Pipelines. The status updates would appear as third-party integrations in the Bitbucket interface.

If you need a more seamless integration, you might want to explore other CI/CD tools that have native Bitbucket integration, or consider using Bitbucket Pipelines directly if that's an option for your use case.
Sources
Monitoring CodePipeline events - AWS CodePipeline

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.