Skip to content

Pass expanded WSR_ job variables to workers

🎫 Addresses issue: #174 (closed)

Fixes #174 (closed)

🛠️ Summary of changes

  • New Config step
    • Creates a config.sh script and registers it with env var in main.tf.
    • The config step runs before all others and is meant to perform setup and then output a set of variables that will be made available to later runner steps (not the pipeline itself).
    • Config overlaps in purpose with a lot of what was in base.sh so I relocated most of that into config.
  • Creates a temporary file to store interpolated environment variables and reload them across runner steps.
    • File created in config.sh along with global variable for reference
    • prepare.sh saves expanded variables to the file
    • run.sh loads the variables and replaces them in scripts before passing to worker
    • cleanup.sh deletes the file
  • Expands previous WSR_ parsing to include vars used in the braced ("I am ${WSR_xyz} bracing") style.

👀 Screenshots and Evidence

I worked with the GitLab CI POC app to make a small test case which can be see here: https://workshop.cloud.gov/devtools-staging/poc/gitlab-ci-poc/-/merge_requests/30. Its latest CI run, at time of writing, was passing and can be seen outputting correctly interpolated values at the end of the job.

Merge request reports

Loading