Skip to content

Create a security environment for release environment

What does this MR do and why?

Describe in detail what your merge request does and why.

Content

  • Create a security environment for release environment

As we need a release environment for the security project (gitlab-org/security/gitlab), together with the one for canonical, this commit creates two environments at once when we tag a new release version. This commit also add some changes to make creation works for both environments.

Ref: gitlab-com/gl-infra/delivery#20345 (closed)

Testing

The test below is done with the version 17.0 . There is a canonical environment for this version, but not a security environment.

# bundle exec rake "release:tag["17.0.1"]"
2024-07-04 14:46:04.269432 D ReleaseTools::GitlabClient -- [HTTParty] [2024-07-04 14:46:04 +0200] 200 "GET https://gitlab.com/api/v4/projects/gitlab-com%2Fgl-infra%2Frelease-environments/repository/tree" - 
2024-07-04 14:46:04.269853 I ReleaseTools::ReleaseEnvironment::Environment -- The environment 17-0-stable already exists. Skipping.
2024-07-04 14:46:04.664252 D ReleaseTools::GitlabClient -- [HTTParty] [2024-07-04 14:46:04 +0200] 200 "GET https://gitlab.com/api/v4/projects/gitlab-com%2Fgl-infra%2Frelease-environments/repository/tree" - 
2024-07-04 14:46:05.123970 D ReleaseTools::GitlabClient -- [HTTParty] [2024-07-04 14:46:05 +0200] 200 "GET https://gitlab.com/api/v4/projects/gitlab-com%2Fgl-infra%2Frelease-environments/repository/tree?id=gitlab-com%2Fgl-infra%2Frelease-environments&page=2&pagination=legacy&path=environments&per_page=20&recursive=false" 2 
2024-07-04 14:46:05.124082 I ReleaseTools::ReleaseEnvironment::Environment -- Creating new environment 17-0-stable-security
2024-07-04 14:46:05.124088 I ReleaseTools::ReleaseEnvironment::Environment -- Version: 17.0.1
2024-07-04 14:46:05.463755 D ReleaseTools::GitlabClient -- [HTTParty] [2024-07-04 14:46:05 +0200] 200 "GET https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab/repository/commits/17-0-stable-ee" - 
2024-07-04 14:46:05.855750 D ReleaseTools::GitlabClient -- [HTTParty] [2024-07-04 14:46:05 +0200] 200 "GET https://gitlab.com/api/v4/projects/gitlab-com%2Fgl-infra%2Frelease-environments/repository/tree?id=gitlab-com%2Fgl-infra%2Frelease-environments&page=2&pagination=legacy&path=environments&per_page=20&recursive=false" 2 
2024-07-04 14:46:06.293983 D ReleaseTools::GitlabClient -- [HTTParty] [2024-07-04 14:46:06 +0200] 200 "GET https://gitlab.com/api/v4/projects/gitlab-com%2Fgl-infra%2Frelease-environments/repository/files/environments%2F17-1-stable%2Fenvironment.yaml/raw" - 
2024-07-04 14:46:06.294055 D ReleaseTools::ReleaseEnvironment::Environment -- ---
install_type: helm
cluster: release-gitlab-gke
versions:
  chart: "~7.11.0-0"
  registry: registry.gitlab.com/gitlab-org/security/charts/components/images
  components:
    gitaly: 17-0-stable-8e06aedc
    registry: 17-0-stable-8e06aedc
    kas: 17-0-stable-8e06aedc
    mailroom: 17-0-stable-8e06aedc
    pages: 17-0-stable-8e06aedc
    gitlab: 17-0-stable-8e06aedc
    shell: 17-0-stable-8e06aedc
    praefect: 17-0-stable-8e06aedc

2024-07-04 14:46:06.529351 D ReleaseTools::GitlabClient -- [HTTParty] [2024-07-04 14:46:06 +0200] 403 "POST https://gitlab.com/api/v4/projects/gitlab-com%2Fgl-infra%2Frelease-environments/repository/files/environments%2F17-0-stable-security%2Fenvironment.yaml" -   

Some parts to note about this output:

2024-07-04 14:46:04.269853 I ReleaseTools::ReleaseEnvironment::Environment -- The environment 17-0-stable already exists. Skipping.
  • An attempt to create 17-0-stable env, since it does not exist yet.
2024-07-04 14:46:05.124082 I ReleaseTools::ReleaseEnvironment::Environment -- Creating new environment 17-0-stable-security
  • The configuration of the new environment is in correct format and use the latest commit on the stable branch.
2024-07-04 14:46:06.294055 D ReleaseTools::ReleaseEnvironment::Environment -- ---
install_type: helm
cluster: release-gitlab-gke
versions:
  chart: "~7.11.0-0"
  registry: registry.gitlab.com/gitlab-org/security/charts/components/images
  components:
    gitaly: 17-0-stable-8e06aedc
    registry: 17-0-stable-8e06aedc
    kas: 17-0-stable-8e06aedc
    mailroom: 17-0-stable-8e06aedc
    pages: 17-0-stable-8e06aedc
    gitlab: 17-0-stable-8e06aedc
    shell: 17-0-stable-8e06aedc
    praefect: 17-0-stable-8e06aedc

Screenshot 2024-07-04 at 14.46.58.png

Edited by Dat Tang

Merge request reports

Loading