Variable replacement in put

Hello everyone,

I’m still new to concourse, have been trying to figure out the variables concept. For background I have Concourse & Credhub running. My idea is to store my DB credentials in Credhub, pass those through the pipeline to the job, and let variables inside my docker build & deploy job be replaced.
In jenkins I used to write a shell script that would grab the credentials from the vault and replace them in the files and build my docker image. Is this possible without writing custom shell script?

To give you a sample code of what I was thinking:


  • name: build-myapp
    serial: true
    • get: git-myapp-source
      trigger: true
    • put: registry-myapp-image
      build: git-myapp-source
      var: ((MY-CREDHUB-VARIABLE))

it would grab my source, build it with “MY-CREDHUB-VARIABLE” be replaced in my property files with a value from credhub and place it in my docker registry.

Any example you have would be very beneficial. Thank you in advance.

Hey @prozek, good news is that Concourse knows how to resolve variables natively and you don’t need custom shell scripts to do this anymore!

As long as your Concourse web node is configured with CredHub, the pipeline-setting logic will automatically try to resolve variables following the conventions described on this page:

Here’s one of our example pipelines where we use variable interpolation extensively in jobs: