Extract UpdateReleasesService from the rake task
Why is this change being made?
I was looking into POC: Add description from release post content ... (gitlab-org/gitlab#369032 - closed), and I wanted to refactor the existing rake task a bit. This MR just extracts most of the code to the service without changing it. So rake task just supplies API token and project IDs to the service.
You can see the result in:
There no tests yet, I wanted to do a smallest possible step If I'll have time, I'll add tests later on. I think this is still an incremental improvement.
How to test this
-
checkout this branch locally
-
create personal access token with the
API
permissions -
export GITLAB_BOT_TOKEN="YOUR TOKEN"
-
fork https://gitlab.com/gitlab-org/gitlab to your personal namespace
-
fork https://gitlab.com/gitlab-org/gitlab-foss to your personal namespace
-
bundle exec pry
require "gitlab" gitlab_client = Gitlab.client(endpoint: "https://gitlab.com/api/v4", private_token: ENV['GITLAB_BOT_TOKEN']) (13..15).each { |major| (0..13).each { |minor| gitlab_client.create_milestone(ID_OF_YOUR_GITLAB_FORK, "#{major}.#{minor}") } } (13..15).each { |major| (0..13).each { |minor| gitlab_client.create_milestone(ID_OF_YOUR_GITLAB_FOSS_FORK, "#{major}.#{minor}") } }
-
EDIT 2 ID's in https://gitlab.com/gitlab-com/www-gitlab-com/blob/f52e0b1c2330f27fed8e3057772b966ee6b882a4/lib/tasks/update_gitlab_project_releases_page.rake#L10-L10 to point to your forks
-
bundle exec rake release:ee:update_project_releases_page
-
bundle exec rake release:foss:update_project_releases_page
-
visit releases pages on your forks and see releases correctly populated there
Author Checklist
-
Provided a concise title for this Merge Request (MR) -
Added a description to this MR explaining the reasons for the proposed change, per say why, not just what - Copy/paste the Slack conversation to document it for later, or upload screenshots. Verify that no confidential data is added.
-
Assign reviewers for this MR to the correct Directly Responsible Individual/s (DRI) - If the DRI for the page/s being updated isn’t immediately clear, then assign it to one of the people listed in the
Maintained by
section on the page being edited - If your manager does not have merge rights, please ask someone to merge it AFTER it has been approved by your manager in #mr-buddies
- If the DRI for the page/s being updated isn’t immediately clear, then assign it to one of the people listed in the
-
If the changes affect team members, or warrant an announcement in another way, please consider posting an update in #whats-happening-at-gitlab linking to this MR - If this is a change that directly impacts the majority of global team members, it should be a candidate for #company-fyi. Please work with internal communications and check the handbook for examples.