Dpl: Deploying from multiple branches to corresponding Elastic Beanstalk environment

Created on 23 Feb 2015  路  3Comments  路  Source: travis-ci/dpl

I have couple of environments on EBS (development, staging, production). There are corresponding branches that are allowed to deploy to these environments. Is there a way to map these branches to their corresponding environments? Currently, this is what my .travis.yml looks like:

deploy:
  provider: elasticbeanstalk
  access_key_id: <secret>
  secret_access_key:
    secure: <secret>
  region: us-east-1
  app: AppResolver
  env: AppResolver-dev
  bucket_name: app-resolver
  on:
    repo: blee-d2l/app-resolver
    branch: dev-env

I would like to know if there is a functionality that looks sort of like this:

deploy:
  provider: elasticbeanstalk
  access_key_id: <secret>
  secret_access_key:
    secure: <secret>
  region: us-east-1
  app: AppResolver
  bucket_name: app-resolver
  on:
    repo: blee-d2l/app-resolver
    env: AppResolver-dev
    branch: dev-env
  on:
    repo: blee-d2l/app-resolver
    env: AppResolver-staging
    branch: staging-env
  on:
    repo: blee-d2l/app-resolver
    env: AppResolver-production
    branch: prod-env

Most helpful comment

Solved it using:

deploy: 
- provider:
- provider:

All 3 comments

Solved it using:

deploy: 
- provider:
- provider:

This was useful, thanks for sharing your solution.

An alternative to that is using jobs, like so:

jobs:
  include:
    - # require the branch name to be dev (note for PRs this is the base branch name)
      if: branch = dev-env
      env: EB_APP_ENV= AppResolver-dev

    - # require the branch name to be master (note for PRs this is the base branch name)
      if: branch = staging-env
      env: EB_APP_ENV= AppResolver-staging

    - # require the branch name to be master (note for PRs this is the base branch name)
      if: branch = prod-env
      env: EB_APP_ENV= AppResolver-production

...

deploy:
  provider: elasticbeanstalk
  bucket_name: app-resolver
  access_key_id: <  access_key_id>
  secret_access_key:
    secure: <secret_access_key>
  region: us-east-1
  app: AppResolver
  env: $EB_APP_ENV
  on:
    repo: blee-d2l/app-resolver
...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rodmoreno picture rodmoreno  路  3Comments

yashmehrotra picture yashmehrotra  路  7Comments

bheemreddy181 picture bheemreddy181  路  8Comments

NeoLegends picture NeoLegends  路  8Comments

dloiko picture dloiko  路  8Comments