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

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

deploy in-pipeline-commits as well

hi there!

imagine there is a step within your pipeline that commits something back into the repository as described here:

The same pipeline contains a deployment step as well, so first we add a new commit in Step A and then deploy our code to production on step B. How do I tell the deployment step B to deploy not only the commit the current pipeline is running for but also the dynamically added commit that has been added in Step A?

My workaround for this would probably be disabling automatic cloning, adding a repository variable for git repo access and manually cloning the latest commit in the current branch... but I wonder if there is a cleaner way to reach that goal.


Here's a little example pipeline config, maybe it's easier to understand the issue like that:

- step:
- echo "Made a change in build ${BITBUCKET_BUILD_NUMBER}" >> changes.txt
- git add changes.txt
- git commit -m "[skip ci] Updating changes.txt with latest build number."
- git push
- step:
deployment: production
# this will not deploy the commit from step one, just the current pipeline commit.
- rsync -avh . root@production:/var/application/

1 answer

0 votes


In this example yml file you attached here, what you need to do is add

- git pull

before the command that deploys, in the second step.

For every step in a Pipelines build, a Docker container starts, the repo is cloned in that container and HEAD is set at the commit the Pipelines build is running for.

Let's say that a build runs on commit 9f28cbd. The first step creates another commit, e.g. f464f1f and pushes it to the repo.

Afterwards, for the second step, another Docker container starts, the repo is cloned again and HEAD is also set at 9f28cbd, as this is the commit the build is running for.

If you want the new commit you added to the previous step, you can do a git pull to fetch that commit in the clone of the second step.

Is this something that works for you?

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

137 views 1 12
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