Parameters When Promoting Build

Hi,

I’m promoting a build to a different environment that triggers a new pipeline (inside the same .drone.yaml file). I’m specifying a key and value in the parameter but can’t access them during the deployment.

I was under the impression that parameters would be passed in as environment variables but when printing all env vars as one of the commands it doesn’t show. Is my understanding correct or is this not how parameters work?

Thanks

Can anybody help?

I click promote > enter environment > enter parameter i.e. key=env value=prod > click submit

Running env as part of the step prints out all environment variables but env=prod does not exist.

I ran a command - echo ${env} and it’s returned blank.

I’ve also tried adding:

Settings:
  env:
    from_secret: ${env}

and it’s still returned as blank.

Make sure you click the Add button to add the parameter to the list. If you do not click the add button, the parameter is not registered and will not be added.

This does not work because the syntax is invalid.

The easiest way to test that environment variables are being automatically injected into your pipeline is to run the env command which will demonstrate the parameter was properly added, as show in this example:

kind: pipeline
type: docker
name: default

steps:
- name: test
  image: alpine
  commands:
  - env

Wow…I can’t believe it was this all along! I assumed that was for adding a second parameter i.e. add another row underneath.

Thank you for your help