Skip to content

Investigate issues with service variable expansion

While testing !190 (merged) I found that variables passed into services only don't have any variables expanded within them.

For example, a job or pipeline level variable:

variables:
  DATABASE_URL: "postgres://postgres:${POSTGRES_PASSWORD}@${WSR_SERVICE_HOST_pg_db}:5432/${POSTGRES_DB}"

will be put into the job response file as:

"postgres://postgres:not-actually-secret@${WSR_SERVICE_HOST_pg_db}:5432/db_name"

But, if that same value is added as:

services:
  - name: image
    alias: alias
    variables:
      DATABASE_URL: "postgres://postgres:${POSTGRES_PASSWORD}@${WSR_SERVICE_HOST_pg_db}:5432/${POSTGRES_DB}"

Then all three env vars are left in place in the job response file. Our expansion properly sets the WSR_SERVICE_ stuff, but ${POSTGTRES_PASSWORD} and ${POSTGRES_DB} are left unexpanded and are not evaluated within the service either

Edited by Ryan Ahearn