1
votes

Currently the way how AWS CodeStar setted up a default python project was to have a pipeline defined with initial source stage as follows; enter image description here

The branch name here is master, so the pipeline triggers whenever a new change is merged into master branch. I also did a success try of changing the branch name to SLS-2 and pipeline triggered upon pushing a commit on this SLS-2 branch... GREAT ! but what I want is to run the pipeline on every single commit from ANY branch. And ofcourse then after that, setting up manual and automatic stages based on weather the branch is master or not.

I know in GitLab, we can specify each stage by tag

  stage: dockerize
  script:
    - echo 'I will run this only on master branch'
  only:
    - master
    - tags

Or I can add except tag with - master to allow this stage trigger on all branches except master. How can I do this with AWS CodePipeline ? Please suggest.

1

1 Answers

0
votes

CodePipeline is best suited to release automation and when using CodePipeline it's recommended to have a single "release" branch which changes that are ready for release are merged into.

Having a single "master release" branch will ensure you don't run into problems like accidentally deploying an old change in one branch over the top of a new change in a different branch, and therefore reverting the newer change.

If you want to run validation steps before merging into your release branch then a good option is to use CodeBuild in combination with CodePipeline. For example, you can configure CodeBuild to automatically run on pull requests.

You can also re-use the same CodeBuild configuration in CodePipeline to run the same build and testing steps as part of your release process after the pull request is merged.