gitlab-build-images/.gitlab/ci/custom.images.yml
Stan Hu 519554013c
Add custom www-gitlab-com image with patched gsutil rsync command
Currently the `gsutil rsync` command does not support the `-z` or `-Z`
options available in `gsutil cp` to compress files locally via gzip
before uploading
(https://github.com/GoogleCloudPlatform/gsutil/issues/579). As
https://cloud.google.com/storage/docs/gsutil/commands/cp states:

When you specify the -z option, the data from your files is
compressed before it is uploaded, but your actual files are left
uncompressed on the local disk. The uploaded objects retain the
Content-Type and name of the original files, but have their
Content-Encoding metadata set to gzip to indicate that the object data
stored are compressed on the Cloud Storage servers and have their
Cache-Control metadata set to no-transform.

about.gitlab.com is currently serving uncompressed HTML files because
`Cache-Control: max-age=0` is set (see
https://gitlab.com/gitlab-com/www-gitlab-com/-/merge_requests/87045),
and Fastly has a custom rule to skip HTML files and therefore won't
cache them.

This patches the `rsync.py` using
https://github.com/GoogleCloudPlatform/gsutil/pull/1430 to support these
command-line options so local gzip compression can be performed.

Relates to
https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/14852
2022-01-05 08:37:26 -08:00

110 lines
4.6 KiB
YAML

.test_build: &test_build
extends: .test
script:
# Hack to set an array in /bin/sh
# http://unix.stackexchange.com/a/137571
- set -- $CI_JOB_NAME
- docker pull --quiet "$CI_REGISTRY_IMAGE:$1" || true
- docker build --cache-from="$CI_REGISTRY_IMAGE:$1" -f "Dockerfile.$1" .
.build_and_deploy: &build_and_deploy
extends: .deploy
script:
# Hack to set an array in /bin/sh
# http://unix.stackexchange.com/a/137571
- set -- $CI_JOB_NAME
- docker pull --quiet "$CI_REGISTRY_IMAGE:$1" || true
- docker build --cache-from="$CI_REGISTRY_IMAGE:$1" --label "ci_pipeline_url=$CI_PIPELINE_URL" --label "ci_job_url=$CI_JOB_URL" -t "$CI_REGISTRY_IMAGE:$1" -f "Dockerfile.$1" .
- docker push "$CI_REGISTRY_IMAGE:$1"
# Used by https://gitlab.com/gitlab-org/charts/auto-deploy-app/-/blob/master/.gitlab-ci.yml
alpine-helm test: *test_build
danger test: *test_build
danger-ruby-2.6.6 test: *test_build
gitlab-charts-build-base test: *test_build
gitlab-charts-build-base-helm-3 test: *test_build
gitlab-helm3.5-kubectl1.17 test: *test_build
gitlab-qa-ruby-2.7 test: *test_build
gitlab-qa-ruby-3.0 test: *test_build
gitlab-qa-alpine-ruby-2.7 test: *test_build
gitlab-qa-alpine-ruby-3.0 test: *test_build
gitlab-puppeteer test: *test_build
kaniko test: *test_build
omnibus-gitlab-bionic test: *test_build
omnibus-gitlab-centos7 test: *test_build
omnibus-gitlab-centos8 test: *test_build
omnibus-gitlab-jessie test: *test_build
omnibus-gitlab-opensuse15.1 test: *test_build
omnibus-gitlab-opensuse15.2 test: *test_build
omnibus-gitlab-opensuse15.3 test: *test_build
omnibus-gitlab-stretch test: *test_build
omnibus-gitlab-buster test: *test_build
omnibus-gitlab-xenial test: *test_build
omnibus-gitlab-focal test: *test_build
omnibus-gitlab-depscan test: *test_build
omnibus-gitlab-cve-search test: *test_build
release-tools test: *test_build
sitespeed-gitlab test: *test_build
ubi-release test: *test_build
www-gitlab-com-3.0 test: *test_build
www-gitlab-com-3.0-patched-gsutil test: *test_build
build-git: *test_build
# Used by GitLab: https://gitlab.com/gitlab-org/gitlab/-/blob/13-8-stable-ee/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
terraform test: *test_build
# Used by go projects for linting https://gitlab.com/gitlab-org/gitlab/blob/master/doc/development/go_guide/index.md#automatic-linting
golangci-lint-alpine test: *test_build
# Used by gitlab-operator: https://gitlab.com/gitlab-org/gl-openshift/gitlab-operator
gitlab-operator-build-base test: *test_build
alpine-bash-jq-curl-git test: *test_build
# Used by frontend related tasks for linting GraphQL
apollo test: *test_build
# Used by https://gitlab.com/gitlab-org/charts/auto-deploy-app/-/blob/master/.gitlab-ci.yml
alpine-helm push: *build_and_deploy
danger push: *build_and_deploy
danger-ruby-2.6.6 push: *build_and_deploy
gitlab-charts-build-base push: *build_and_deploy
gitlab-charts-build-base-helm-3 push: *build_and_deploy
gitlab-helm3.5-kubectl1.17 push: *build_and_deploy
gitlab-qa-ruby-2.7 push: *build_and_deploy
gitlab-qa-ruby-3.0 push: *build_and_deploy
gitlab-qa-alpine-ruby-2.7 push: *build_and_deploy
gitlab-qa-alpine-ruby-3.0 push: *build_and_deploy
gitlab-puppeteer push: *build_and_deploy
kaniko push: *build_and_deploy
omnibus-gitlab-bionic push: *build_and_deploy
omnibus-gitlab-centos7 push: *build_and_deploy
omnibus-gitlab-centos8 push: *build_and_deploy
omnibus-gitlab-jessie push: *build_and_deploy
omnibus-gitlab-opensuse15.1 push: *build_and_deploy
omnibus-gitlab-opensuse15.2 push: *build_and_deploy
omnibus-gitlab-opensuse15.3 push: *build_and_deploy
omnibus-gitlab-stretch push: *build_and_deploy
omnibus-gitlab-buster push: *build_and_deploy
omnibus-gitlab-xenial push: *build_and_deploy
omnibus-gitlab-focal push: *build_and_deploy
omnibus-gitlab-depscan push: *build_and_deploy
omnibus-gitlab-cve-search push: *build_and_deploy
release-tools push: *build_and_deploy
sitespeed-gitlab push: *build_and_deploy
ubi-release push: *build_and_deploy
www-gitlab-com-3.0 push: *build_and_deploy
www-gitlab-com-3.0-patched-gsutil push: *build_and_deploy
build-git push: *build_and_deploy
# Used by GitLab: https://gitlab.com/gitlab-org/gitlab/-/blob/13-8-stable-ee/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
terraform push: *build_and_deploy
# Used by go projects for linting https://gitlab.com/gitlab-org/gitlab/blob/master/doc/development/go_guide/index.md#automatic-linting
golangci-lint-alpine push: *build_and_deploy
# Used by gitlab-operator: https://gitlab.com/gitlab-org/gl-openshift/gitlab-operator
gitlab-operator-build-base push: *build_and_deploy
alpine-bash-jq-curl-git push: *build_and_deploy
# Used by frontend related tasks for linting GraphQL
apollo push: *build_and_deploy