Add support for Google Cloud CDN config
What does this MR do?
In gitlab-org/gitlab!96336 (merged) and gitlab-org/gitlab!98010 (merged), we added support for Google CDN in front of CI artifacts to improve performance and reduce costs. This commit adds the necessary configuration support to enable it.
This is similar to the work for the container registry in !2328 (merged).
Related issues
Relates to #3711 (closed)
Testing
I verified this work by using the latest master
images.
- Configure a GCS bucket with Cloud CDN.
- With the settings:
global:
appConfig:
object_store:
enabled: true
proxy_download: false
connection:
secret: gitlab-rails-storage
artifacts:
bucket: stanhu-test
cdn:
secret: gitlab-rails-storage
Added the cdn
key in gitlab-rails-storage
secret:
provider: Google
url: "https://stanhu.example.com"
key_name: stanhu-key
key: REDACTED
- In
bin/rails console
, enable the feature flag:Feature.enable(:ci_job_artifacts_cdn)
- Run a CI job.
- Use the artifacts API (e.g.
https://stanhu.example.org/api/v4/projects/2/jobs/4/artifacts
) to download the file. Notice the URL has the CDN. - Check that
/var/log/gitlab/api_json.log
hasmeta.artifact_used_cdn
:
"meta.feature_category": "build_artifacts",
"meta.user": "root",
"meta.project": "root/simple-ci",
"meta.root_namespace": "root",
"meta.client_id": "user/1",
"meta.artifact_size": 209,
"meta.artifact_used_cdn": true,
- If you use a runner within Google Cloud (or localhost), you'll notice
meta.artifact_used_cdn
is omitted because a CDN is not needed.
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion.
Required
-
Merge Request Title and Description are up to date, accurate, and descriptive -
MR targeting the appropriate branch -
MR has a green pipeline on GitLab.com
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes -
Documentation created/updated -
Tests added -
Integration tests added to GitLab QA -
Equivalent MR/issue for omnibus-gitlab opened: gitlab-org/omnibus-gitlab#7206
Edited by Stan Hu