Store environment CI configuration for new jobs

What does this MR do and why?

Link jobs to environment on creation

When a CI job references an environment (it uses the environment keyword in the CI template) a new Environments::Job record is created to persist a link to the environment.

Records are created for both Build and Bridge job types, for new jobs and retries of existing jobs.

The new behaviour is controlled by the persisted_job_environment_relationship feature flag.

References

#552372 (closed)

How to set up and validate locally

  1. Enable the persisted_job_environment_relationship feature flag.
  2. Execute any CI job that references an environment, for example:
    example-job:
      script: echo test
      environment: production
  3. From the Rails console, verify that the record was created: Ci::Build.find(<job ID>).job_environment
  4. Retry the job, and perform the same verification (with the new job ID)

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