Skip to content

Fix the missing username to the promotion status not when triggered using the chatops run auto_deploy promote command

The monthly release task deployment update comment doesn't reflect the name of @akozin-ext: gitlab-org/release/tasks#21684 (comment 2865270185) when we use the new chatops command /chatops run auto_deploy promote.

This is happening since it is the bot user that plays the job, and the bot user does not have a username on gitlab.com (release_managers.yml#L27). As a sidenote, it would be nice if the bot user on ops could have the same username as the bot user on .com.

We need to make a few changes to release-tools.

  1. Set the RELEASE_MANAGER variable when playing the promote job.1
  2. In status_note.rb#L49, when release_manager_from_coordinated_pipeline is release-tools-ops (add this as a constant in bot.rb), the note in the monthly release issue should use the value of the RELEASE_MANAGER variable.

To pass the RELEASE_MANAGER variable

Let's pass the RELEASE_MANAGER variable when playing the promote job. We can set it to the value of the RELEASE_USER variable that ChatOps passes to release-tools.

The GitLab API supports passing variables when playing manual jobs, but the library job_play method doesn't support it. You will have to update the job_play method to something like the following:

path = client.url_encode(project_path(project))
client.post(
  "/projects/#{path}/jobs/#{job_id}/play", body: {
    job_variables_attributes: [
      key: '',
      value: ''
    ]
  }
)

This is a follow up of: gitlab-org/release-tools!4536 (comment 2865402668)


Workaround

Add a comment to the status note in the monthly release issue indicating who promoted, like this gitlab-org/release/tasks#21684 (comment 2865299822)