Skip to content

ci: create release issue cop

Sofia Vistas requested to merge release-cop into master

Context

When a new release is created, Engineers usually manually open a Release Plan issue for that particular release (example). This implies going through a set of manual instructions which are now getting automated.

This MR creates a Release issue automatically when there is a new tag pushed to the Container Registry.

💻 Implementation

  1. Finds the latest release issue.
  2. Verifies if it has version bump MRs related to it.
  3. If it does not have it yet, goes and checks if there is a version bump MR opened for the project. This is done for all: cng, omnibus, charts, k8s-workloads. Relates these MRs to the release issue.
  4. If it has a version bump related MR (or all) it simply polls to know if these are merged/closed yet.
  5. Once all version bump MRs got merged/closed the release cop applies the `workflowverification label and pings on the issue to get human help to verify these manually.

Note: This requires the setup of a pipeline schedule

Shortcomings

The ~"workflow::verification" needs to be done by a human and consequently apply the ~"workflow::production" label, tick the checkboxes, and close the issue after a release is concluded.

🐎 Workflow

  • In a release pipeline, the release-issue job comes before all other jobs which trigger version bumps on several projects (cng, omnibus, charts, etc...). The cop finds this issue, daily, and updates it accordingly.

  • This cop runs as a scheduled job. If there is a new release without a release issue it will exit. If there is a release issue closed it will also exit.

🔍 Testing

This MR was tested separately on a sandbox project which imitates the workflow for a release in the Container Registry. The command used go run cmd/internal/releasecop/main.go --target-project-id <my-test-id> --gitlab-auth-token $ACCESS_TOKEN targeted a project that contained several tags/releases with commits and a release issue open. (tested in combination with the release issue creation automation).

To simulate relating merge requests, test repositories (i.e. fake-cng, fake-charts, etc) and test MRs were created with the cop monitoring several scenarios:

  • when there is no release issue
  • when a release issue is closed
  • when there are no version bump MRs
  • when all version bump MRs are merged/closed
  • when some version bump MRs are merged/closed
Edited by Sofia Vistas

Merge request reports