Skip to content

Extract UpdateReleasesService from the rake task

Vladimir Shushlin requested to merge move-update-releases-to-service into master

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

  1. checkout this branch locally

  2. create personal access token with the API permissions

  3. export GITLAB_BOT_TOKEN="YOUR TOKEN"

  4. fork https://gitlab.com/gitlab-org/gitlab to your personal namespace

  5. fork https://gitlab.com/gitlab-org/gitlab-foss to your personal namespace

  6. 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}") } }
  7. 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

  8. bundle exec rake release:ee:update_project_releases_page

  9. bundle exec rake release:foss:update_project_releases_page

  10. 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 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.

Edited by Vladimir Shushlin

Merge request reports