Skip to content

Automate milestone association for GitLab releases

Nathan Friend requested to merge nfriend-add-release-milestone-association into master

Why is this change being made?

GitLab releases (both EE and FOSS) are auto-created on the 22nd of every month (when the release post is published). However, this process currently does not create the release with a group milestone association.

In the past, I've been manually editing the newly created release on the 22nd of every month to add the correct group milestone association. However, a recent permissions change prevents me from directly editing the releases (which is a good thing!).

This MR updates the automated process to include the milestone association when creating new releases. In addition, old releases without the correct milestone association will be updated.

This change will only affect releases 13.0 and beyond, because the gitlab-org group does not contain group milestones for anything before 13.0.

Example projects

I have two projects I use for testing this behavior:

Testing locally

To test locally, I first update the project IDs at the top of the file to point to the example projects above:

diff --git a/lib/tasks/update_gitlab_project_releases_page.rake b/lib/tasks/update_gitlab_project_releases_page.rake
index 08d9c4d70be..4dfade35691 100755
--- a/lib/tasks/update_gitlab_project_releases_page.rake
+++ b/lib/tasks/update_gitlab_project_releases_page.rake
@@ -7,8 +7,13 @@ require "gitlab"
 require_relative "../../generators/releases"
 
 namespace :release do
-  GITLAB_FOSS_PROJECT_ID = 13083
-  GITLAB_EE_PROJECT_ID = 278964
+  # GITLAB_FOSS_PROJECT_ID = 13083
+  # GITLAB_EE_PROJECT_ID = 278964
+
+  # TEMP
+  GITLAB_FOSS_PROJECT_ID = 28654245
+  GITLAB_EE_PROJECT_ID = 28654237
+
 
   CORE = "core"
   STARTER = "starter"

Then, I execute the following commands:

# For FOSS
GITLAB_BOT_TOKEN=<token here> bundle exec rake release:foss:update_project_releases_page

# For EE
GITLAB_BOT_TOKEN=<token here> bundle exec rake release:ee:update_project_releases_page

This runs the process against the sample projects listed above. Note that the project must contain all the correct tags and milestone titles prior to running these commands, otherwise the API requests will fail.

The token can either be a personal access token (provided you have the appropriate access to both test projects) or a project token with API permissions.

Closes gitlab-org/gitlab#337583 (closed)

Edited by Nathan Friend

Merge request reports

Loading