Skip to content

Prepare removal of legacy predefined CI_BUILD_* variables

Leaminn Ma requested to merge remove-legacy-ci-build-variables into master

What does this MR do and why?

This MR prepares the removal of the legacy predefined variables listed in #352957 (closed). The changes are made behind a feature flag that will be defaulted to on in %16.0.

Feature Flag: ci_remove_legacy_predefined_variables

Roll out issue: #404533 (closed)

How to set up and validate locally

The following steps create a scenario where all the affected predefined variables are expected to have a non-null value prior to enabling the Feature Flag. This allows us to see the effect before and after the flag is turned on.

  1. First ensure the Feature Flag is off via the Rails console: Feature.disable(:ci_remove_legacy_predefined_variables)
  2. Update your project's .gitlab-ci.yml with the following content: gitlab-ci.yml
  3. Go to Repository > Tags, and create a new tag for the master branch named v1.0.
  4. Follow the steps to create a trigger token for your project.
  5. Run the following curl in your terminal to trigger a pipeline. Replace the values and update the host as necessary.
curl --request POST \
     --form token=<YOUR-TRIGGER-TOKEN> \
     --form ref=v1.0 \
     "http://gdk.test:3000/api/v4/projects/<YOUR-PROJECT-ID>/trigger/pipeline"
  1. Now view your newly created pipeline in GitLab and run the manual job.
  2. View the job's output log. Observe that each Current/Legacy variable pair has the same value. NOTE: We expect CI_BUILD_REPO to be null (it seems it was already removed at some point.)

Screenshot_2023-04-04_at_1.17.55_PM

  1. Now turn on the Feature Flag: Feature.enable(:ci_remove_legacy_predefined_variables).
  2. Go back to the pipeline you created from Step 5 and re-run the manual job.
  3. View the job's output log. Observe that the Legacy predefined variables now all have a null value.

Screenshot_2023-04-04_at_1.25.28_PM

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #352957 (closed)

Edited by Leaminn Ma

Merge request reports