Skip to content

Use Environments::Job record for environment options lookup

What does this MR do and why?

Use Environments::Job record for environment name lookup

Environment CI options and the persisted value of expanded_environment_name are being moved from Ci::BuildMetadata to Environments::Job, which will allow deletion of old metadata records that are taking up too much space. This change fetches these values from the new job_environment record, keeping the fallback to the old storage location for backwards compatibility.

The new behaviour is controlled by the environment_attributes_from_job_environment feature flag.

References

#552372

How to set up and validate locally

Environment metadata:

  1. Enable environment_attributes_from_job_environment and persisted_job_environment_relationship feature flags.
  2. Run a CI job that references an environment, for example:
     deploy-static:
       environment:
         name: production
         deployment_tier: production
       script: echo $CI_ENVIRONMENT_ID
  3. Verify that the job output contains the correct environment ID (the environment is fetched via the expanded name, see #persisted_environment and #persisted_environment_variables)

Environments for merge request:

  1. Create an MR, using the same setup as the steps above.
  2. Verify the deployed environments in the merge request widget show as expected.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tiger Watson

Merge request reports

Loading