Hi folks,
Recently, I started a project to learn building a continuous integration and continuous deployment flow. I’m new to the topic. Therefore, your comments will be very helpful.
Hi there!
I took a quick look at your Travis CI configuration for this project and although it’s valid, found a section of it that’s a bit redundant and I thought I could add some details here
This is about lines: https://github.com/ilhan-mstf/tdd-sample-app/blob/94e61089bd55bfbde96a57a320bbbaaeedf7a1ff/.travis.yml#L31-L35
I can see that you’re creating a job matrix where each of the jobs is conditioned to a specific branch:
jobs:
include:
- if: branch = master
env: DEPLOY_STAGE=production
- if: branch =~ /^release\/v\d+\.\d+(\.\d+)?$/
env: DEPLOY_STAGE=beta
- if: branch = dev
env: DEPLOY_STAGE=dev
Therefore, the section:
branches:
only:
- master
- /^release\/v\d+\.\d+(\.\d+)?$/
- dev
Is not needed (it is redundant) with your current .travis.yml setup. The branches.only
option was one of the “conditional builds” features that Travis CI offered initially, but with the new Job conditions that were released this year (which you’re using as well - https://docs.travis-ci.com/user/conditional-builds-stages-jobs/), the branch safelist is not really needed.
Hope you find this interesting/useful, although as I said there’s not really an issue with your current config.
Cheers!
Hi,
Thank you for reviewing the app and your suggestion. I removed the branches section as you suggested and it still works as expected.