Travis is skipping our companies S3 deployment because branch is not permitted

I have a new issue with a Travis build. In brief, my .travis.yml file contains (I’ve removed all secrets and sensitive information):

deploy:
  provider: s3

    branch: staging

deploy:
  provider: s3
  local_dir: dist/
  acl: public_read
  on:
    branch: master

Until Feb 15th 2022 this setup worked as intended (staging branch was deployed to the my-bucket-staging bucket, master branch was deployed to the my-bucket bucket, and all other branches were ignored). My .travis.yml file hasn’t changed since Jan 13, but the staging branch stopped deploying with the message Skipping a deployment with the S3 provider because this branch is not permitted on Feb 16th. My last known successful deployment was on Feb 15th.

I’ve read thru the docs, still don’t get it? What am I missing here?

The above Travis config defines two identical keys deploy , so only the last one is effective; meaning, there is no deployment provider defined with on.branch: staging as far as your .travis.yml is concerned, as this was how Travis was designed, to reiterate your second deploy is not being parsed by Travis, and rightfully so.

Now if you want to define two deployment providers that work on different branches, you need a 2-element array under deploy, here’s an example:

deploy:
  - provider: s3
    access_key_id: mYacc3ssKeyID
    secret_access_key:
      secure: mYacc3ssKey
    bucket: my-bucket-staging
    skip_cleanup: true
    local_dir: dist/
    acl: public_read
    on:
      branch: staging
  - provider: s3
    access_key_id: mYOtheracc3ssKeyID
    secret_access_key:
      secure: mYOtheracc3ssKey
    bucket: my-bucket
    skip_cleanup: true
    local_dir: dist/
    acl: public_read
    on:
      branch: master

It is not clear to me how it could have been working before with your original configuration as indicated. I would be interested in seeing your build logs from January 2022.

1 Like

No reason to be a bit rude, your post did solve my issue though.