screwdriver-cd / screwdriver

An open source build platform designed for continuous delivery.
http://screwdriver.cd
Other
1.01k stars 170 forks source link

Reference another environment variable in an environment variable #2411

Open samuel-phan opened 3 years ago

samuel-phan commented 3 years ago

What happened:

shared:
  environment:
    CF_BUCKET: "my-cloudformation-bucket"

jobs:
  upload-cloudformation-templates:
    requires: [~commit]
    steps:
      - upload-templates-to-s3:
          aws s3 sync --sse aws:kms cloudformation s3://${CF_BUCKET}

  deploy-us-east-1:
    requires: [upload-cloudformation-templates]
    environment:
      REGION: "us-east-1"
      CF_TEMPLATE: https://${CF_BUCKET}.s3.amazonaws.com/my-app/cloudformation-us-east-1.json
      PARAMETERS_FILE: "cloudformation/my-app/dev/parameters-us-east-1.json"
    template: cf/cf-deploy@latest

  deploy-us-west-2:
    requires: [upload-cloudformation-templates]
    environment:
      REGION: "us-west-2"
      CF_TEMPLATE: https://${CF_BUCKET}.s3.amazonaws.com/my-app/cloudformation-us-west-2.json
      PARAMETERS_FILE: "cloudformation/my-app/dev/parameters-us-west-2.json"
    template: cf/cf-deploy@latest

When I run this Screwdriver (SD) file:

CF_TEMPLATE=https://.s3.amazonaws.com/my-app/cloudformation-us-east-1.json

What you expected to happen:

CF_TEMPLATE=https://my-cloudformation-bucket.s3.amazonaws.com/my-app/cloudformation-us-east-1.json

How to reproduce it:

Use the SD file above, replace the template: cf/cf-deploy@latest by something like:

steps:
  - echo: echo $CF_TEMPLATE
jithine commented 3 years ago

@tkyi isn't this supposed to work ? Wasn't there some bug on order, is this related ?

tkyi commented 3 years ago

@jithine are you referring to this issue: https://github.com/screwdriver-cd/screwdriver/issues/1746