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

Is it possible to get previously deployed branch name in pipeline stage?

Alex Mashianov February 24, 2020

So, we're using a staging server to test different branches before going to production.

And upon pipeline success we provide QA engineer possibility to deploy this new branch on staging. Then he might deploy another branch to test it.

What we want to do is revert DB state to what it was at commit from which both branches grow before applying current branch db state.


We use django migrations so it's easy to revert things if we know previously deployed commit/branch name.

So... is it possible to get previous deployment branch/commit while doing new deployment in a pipeline?

1 answer

0 votes
Max Binnewies
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2020

To manually see the deployment history in Bitbucket, click the "Deployment"-Tab on the left and then for each deployment there is an info-button on the right side of the heading that contains the Deployment environment name. Clicking that gives you the full history for that environment.

As far as I know, there is no easy automated way to do this. The variable '$BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID' gives you the uuid of the environment. With that uuid you could use the Bitbucket API to get details about that environment: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/deployments/%7Bdeployment_uuid%7D

Generate an App Password in the BitBucket settings and store it as a secured variable for Auth.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events