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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,304
Community Members
 
Community Events
176
Community Groups

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

Atlassian Community Events