Create
cancel
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

Use pipeline to only deploy changed files

Hi there!

I'm using the following .yml file to push the repo to WPengine. Problem with these commands is that it deploys all. Is it possible to only deploy the changed files in the commit? What should the commands be?

pipelines:
branches:
master:
- step:
name: Deploy to production
deployment: production
script:
- git filter-branch -- --all
- git push --force git@git.wpengine.com:production/XXX.git master
- echo "Pushed to Production"


dev:
- step:
name: Deploy to dev production
deployment: dev
script:
- git filter-branch -- --all
- git push --force git@git.wpengine.com:production/XXX.git dev
- echo "Pushed to Dev Production"

 

Thanks in advance!

1 answer

0 votes

Hi @finnruijter,

I suspect (although I'm not entirely sure) that this may have to do with the use of --force option to push, as this option will force the remote repo (in this case the WPengine repo) to take the version of the branch that exists in Pipelines.

Just to understand the issue a bit better before I proceed with suggestions, where exactly and how do you see that all files are being deployed, instead of only the files in the last commit?

Kind regards,
Theodora

Hi @Theodora Boudale !

 

Thank you for your answer. Removing --force sadly results into a failed deployment. I'm using this document from WPengine to configure the deployment: https://wpengine.com/support/deploying-code-with-bitbucket-pipelines-wp-engine/.

Screenshot at Jul 21 14-12-56.png

Hi @finnruijter ,

Thank you for the info.

The first question I would like to ask is whether you are pushing changes to master branch of this WPengine repo from elsewhere, e.g. if there is anyone from your team or another Pipelines step, or if you have a script or tool that pushes to master branch of this repo. This is one possible cause for this error.

If the above is not the case, i.e. if only this Pipelines step pushes to master, then I suspect the command

git filter-branch -- --all

may be the culprit. I have tried testing your scenario by pushing to another Bitbucket repo, as I don't have a WPengine repo to test. Bitbucket repo 2 where I was trying to push is a fork of the repo where I was running Pipelines. Push without --force would fail when the above command was included in the yaml file, but it would succeed without it.

Is that command necessary for WPengine? I don't see it in the guide you linked here. My suggestion would be to try removing the above command, and also do a full clone in your Pipelines step, as I believe it is needed for pushing to the WPengine repo, see here: https://community.atlassian.com/t5/Bitbucket-questions/Pipeline-issue-with-wp-engine/qaq-p/1667433

master:
- step:
name: Deploy to production
deployment: production
clone:
depth: full
script:
- git push git@git.wpengine.com:production/XXX.git master
- echo "Pushed to Production"

Is this something that works for you?

Please do let me know about the question I asked initially as well, whether there is another Pipelines step, a script, a tool, or anyone from your team pushing to master branch of the WPengine repo. If this is the case, the above won't work, and we'll need to look into different options.

Kind regards,
Theodora

Suggest an answer

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

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

123 views 2 4
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