Reputation: 10134
I my application I need to be able to make some changes on the existing pipeline, therefore I want to be able to test it locally without need to commit my code all over the time in order to check its functionality.
Do you know how I can do that? What I want to do is to check whether the pipeline with my changes will break my build process without actually doing remotely the build and the deployment.
Upvotes: 1
Views: 1465
Reputation: 27340
This may not be what you're after, but if it helps someone from Google, you can use this trick.
Make sure you're the only one working on the repo then commit once with your first lot of changes, then just keep amending that commit over and over again as you test things. You'll need to force push it of course, but this allows you to make repeated changes without polluting the commit history with heaps of experimental changes, and CodeBuild will dutifully build each amended commit as normal.
Just make your changes, add them as if you were going to do a new commit, but then run git commit --amend
instead. You won't be able to push now because the latest commit in the remote repo is different to your own, but you can force push to overwrite that remote commit that you have now changed.
Normally force pushing is bad as it can cause lots of problems, but this is one of the scenarios where it is the right tool for the job, so long as you're careful.
You can keep modifying your latest commit with --amend
, force push it over and over, and CodeBuild will rebuild it on each force push.
When you're done, you can either clean up the commit with a final --amend
or remove it entirely with something like git reset HEAD~1
, do one final force push to remove the commit from the remote repo as well, and then continue with normal development.
Just make sure nobody else is pushing code while you do this or your force push will overwrite all their commits - have everyone wait until you're finished with your testing, then have them do a git pull --rebase
, then they can finally do a normal push to share the commits they made while they were waiting for you.
Upvotes: 0
Reputation: 8890
There is an option to run your build locally using CodeBuild Local [1], however no such option exist for CodeDeploy or CodePipeline.
You may be able to attack the problem in a different way. Try to disable the transition from Build to Deploy or put a Manual approval action before Deploy action in Deploy stage to control when the deployment occurs.
Ref:
[1] https://docs.aws.amazon.com/codebuild/latest/userguide/use-codebuild-agent.html#use-codebuild-agent
Upvotes: 1