Skip to content
代码片段 群组 项目
提交 09062ba3 编辑于 作者: 张泽华's avatar 张泽华 提交者: Michael Kozono
浏览文件

Add CI_TEMPLATE_REGISTRY_HOST to predefined CI variables

Changelog: added
上级 fbb06e89
No related branches found
No related tags found
无相关合并请求
显示
33 个添加53 个删除
...@@ -2259,6 +2259,7 @@ def predefined_variables ...@@ -2259,6 +2259,7 @@ def predefined_variables
.concat(dependency_proxy_variables) .concat(dependency_proxy_variables)
.concat(auto_devops_variables) .concat(auto_devops_variables)
.concat(api_variables) .concat(api_variables)
.concat(ci_template_variables)
end end
end end
...@@ -2312,6 +2313,12 @@ def api_variables ...@@ -2312,6 +2313,12 @@ def api_variables
end end
end end
def ci_template_variables
Gitlab::Ci::Variables::Collection.new.tap do |variables|
variables.append(key: 'CI_TEMPLATE_REGISTRY_HOST', value: 'registry.gitlab.com')
end
end
def dependency_proxy_variables def dependency_proxy_variables
Gitlab::Ci::Variables::Collection.new.tap do |variables| Gitlab::Ci::Variables::Collection.new.tap do |variables|
break variables unless Gitlab.config.dependency_proxy.enabled break variables unless Gitlab.config.dependency_proxy.enabled
......
...@@ -103,8 +103,7 @@ ...@@ -103,8 +103,7 @@
image: { name: '$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION' }, image: { name: '$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION' },
variables: { variables: {
DAST_VERSION: 3, DAST_VERSION: 3,
SECURE_ANALYZERS_PREFIX: '$TEMPLATE_REGISTRY_HOST/security-products', SECURE_ANALYZERS_PREFIX: '$CI_TEMPLATE_REGISTRY_HOST/security-products',
TEMPLATE_REGISTRY_HOST: template_registry_host,
GIT_STRATEGY: 'none' GIT_STRATEGY: 'none'
}, },
allow_failure: true, allow_failure: true,
......
...@@ -201,8 +201,7 @@ ...@@ -201,8 +201,7 @@
}, },
variables: { variables: {
DAST_VERSION: 3, DAST_VERSION: 3,
SECURE_ANALYZERS_PREFIX: '$TEMPLATE_REGISTRY_HOST/security-products', SECURE_ANALYZERS_PREFIX: '$CI_TEMPLATE_REGISTRY_HOST/security-products',
TEMPLATE_REGISTRY_HOST: template_registry_host,
GIT_STRATEGY: 'none' GIT_STRATEGY: 'none'
}, },
allow_failure: true, allow_failure: true,
...@@ -243,8 +242,7 @@ ...@@ -243,8 +242,7 @@
}, },
variables: { variables: {
GIT_DEPTH: '50', GIT_DEPTH: '50',
SECURE_ANALYZERS_PREFIX: '$TEMPLATE_REGISTRY_HOST/security-products', SECURE_ANALYZERS_PREFIX: '$CI_TEMPLATE_REGISTRY_HOST/security-products',
TEMPLATE_REGISTRY_HOST: template_registry_host,
SECRETS_ANALYZER_VERSION: '4', SECRETS_ANALYZER_VERSION: '4',
SECRET_DETECTION_IMAGE_SUFFIX: '', SECRET_DETECTION_IMAGE_SUFFIX: '',
SECRET_DETECTION_EXCLUDED_PATHS: '', SECRET_DETECTION_EXCLUDED_PATHS: '',
......
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
it_behaves_like 'an offline image download job' do it_behaves_like 'an offline image download job' do
it 'sets SECURE_BINARIES_IMAGE explicitly' do it 'sets SECURE_BINARIES_IMAGE explicitly' do
image = "${TEMPLATE_REGISTRY_HOST}/security-products/${CI_JOB_NAME}:${SECURE_BINARIES_ANALYZER_VERSION}" image = "${CI_TEMPLATE_REGISTRY_HOST}/security-products/${CI_JOB_NAME}:${SECURE_BINARIES_ANALYZER_VERSION}"
expect(build.variables.to_hash).to include('SECURE_BINARIES_IMAGE' => image) expect(build.variables.to_hash).to include('SECURE_BINARIES_IMAGE' => image)
end end
......
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
masked: false masked: false
}, { }, {
key: 'SECURE_ANALYZERS_PREFIX', key: 'SECURE_ANALYZERS_PREFIX',
value: '$TEMPLATE_REGISTRY_HOST/security-products', value: '$CI_TEMPLATE_REGISTRY_HOST/security-products',
public: true, public: true,
masked: false masked: false
} }
......
...@@ -43,8 +43,7 @@ ...@@ -43,8 +43,7 @@
}, },
variables: { variables: {
GIT_DEPTH: '50', GIT_DEPTH: '50',
SECURE_ANALYZERS_PREFIX: '$TEMPLATE_REGISTRY_HOST/security-products', SECURE_ANALYZERS_PREFIX: '$CI_TEMPLATE_REGISTRY_HOST/security-products',
TEMPLATE_REGISTRY_HOST: template_registry_host,
SECRETS_ANALYZER_VERSION: '4', SECRETS_ANALYZER_VERSION: '4',
SECRET_DETECTION_IMAGE_SUFFIX: '', SECRET_DETECTION_IMAGE_SUFFIX: '',
SECRET_DETECTION_EXCLUDED_PATHS: '', SECRET_DETECTION_EXCLUDED_PATHS: '',
...@@ -78,9 +77,8 @@ ...@@ -78,9 +77,8 @@
dependencies: [], dependencies: [],
script: ['gtcs scan'], script: ['gtcs scan'],
variables: { variables: {
CS_ANALYZER_IMAGE: "$TEMPLATE_REGISTRY_HOST/security-products/container-scanning:5", CS_ANALYZER_IMAGE: "$CI_TEMPLATE_REGISTRY_HOST/security-products/container-scanning:5",
GIT_STRATEGY: 'none', GIT_STRATEGY: 'none'
TEMPLATE_REGISTRY_HOST: Gitlab::Saas.registry_prefix
}, },
rules: [ rules: [
{ if: "$CONTAINER_SCANNING_DISABLED", when: "never" }, { if: "$CONTAINER_SCANNING_DISABLED", when: "never" },
......
...@@ -63,8 +63,7 @@ ...@@ -63,8 +63,7 @@
image: { name: '$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION' }, image: { name: '$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION' },
variables: { variables: {
DAST_VERSION: 3, DAST_VERSION: 3,
SECURE_ANALYZERS_PREFIX: '$TEMPLATE_REGISTRY_HOST/security-products', SECURE_ANALYZERS_PREFIX: '$CI_TEMPLATE_REGISTRY_HOST/security-products',
TEMPLATE_REGISTRY_HOST: template_registry_host,
GIT_STRATEGY: 'none' GIT_STRATEGY: 'none'
}, },
allow_failure: true, allow_failure: true,
......
...@@ -26,7 +26,6 @@ variables: ...@@ -26,7 +26,6 @@ variables:
TF_VAR_SERVICE_DESK_EMAIL: incoming+${CI_PROJECT_PATH_SLUG}-${CI_PROJECT_ID}-issue-@incoming.gitlab.com TF_VAR_SERVICE_DESK_EMAIL: incoming+${CI_PROJECT_PATH_SLUG}-${CI_PROJECT_ID}-issue-@incoming.gitlab.com
TF_VAR_SHORT_ENVIRONMENT_NAME: ${CI_PROJECT_ID}-${CI_COMMIT_REF_SLUG} TF_VAR_SHORT_ENVIRONMENT_NAME: ${CI_PROJECT_ID}-${CI_COMMIT_REF_SLUG}
TF_VAR_SMTP_FROM: ${SMTP_FROM} TF_VAR_SMTP_FROM: ${SMTP_FROM}
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
cache: cache:
paths: paths:
...@@ -40,7 +39,7 @@ cache: ...@@ -40,7 +39,7 @@ cache:
terraform_apply: terraform_apply:
stage: provision stage: provision
image: "$TEMPLATE_REGISTRY_HOST/gitlab-org/5-minute-production-app/deploy-template/stable" image: "$CI_TEMPLATE_REGISTRY_HOST/gitlab-org/5-minute-production-app/deploy-template/stable"
extends: .needs_aws_vars extends: .needs_aws_vars
resource_group: terraform resource_group: terraform
before_script: before_script:
...@@ -54,7 +53,7 @@ terraform_apply: ...@@ -54,7 +53,7 @@ terraform_apply:
deploy: deploy:
stage: deploy stage: deploy
image: "$TEMPLATE_REGISTRY_HOST/gitlab-org/5-minute-production-app/deploy-template/stable" image: "$CI_TEMPLATE_REGISTRY_HOST/gitlab-org/5-minute-production-app/deploy-template/stable"
extends: .needs_aws_vars extends: .needs_aws_vars
resource_group: deploy resource_group: deploy
before_script: before_script:
...@@ -75,7 +74,7 @@ terraform_destroy: ...@@ -75,7 +74,7 @@ terraform_destroy:
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
stage: destroy stage: destroy
image: "$TEMPLATE_REGISTRY_HOST/gitlab-org/5-minute-production-app/deploy-template/stable" image: "$CI_TEMPLATE_REGISTRY_HOST/gitlab-org/5-minute-production-app/deploy-template/stable"
before_script: before_script:
- cp /*.tf . - cp /*.tf .
- cp /deploy.sh . - cp /deploy.sh .
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
variables: variables:
TEST_ROOT: ${CI_PROJECT_DIR}/my_folder_with_terraform_content TEST_ROOT: ${CI_PROJECT_DIR}/my_folder_with_terraform_content
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
default: default:
before_script: before_script:
...@@ -32,7 +31,7 @@ default: ...@@ -32,7 +31,7 @@ default:
init_and_plan: init_and_plan:
stage: build stage: build
image: "$TEMPLATE_REGISTRY_HOST/gitlab-org/terraform-images/releases/0.13" image: "$CI_TEMPLATE_REGISTRY_HOST/gitlab-org/terraform-images/releases/0.13"
rules: rules:
- if: $SAST_DISABLED - if: $SAST_DISABLED
when: never when: never
......
variables: variables:
AUTO_BUILD_IMAGE_VERSION: 'v1.14.0' AUTO_BUILD_IMAGE_VERSION: 'v1.14.0'
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
build: build:
stage: build stage: build
image: '${TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-build-image:${AUTO_BUILD_IMAGE_VERSION}' image: '${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-build-image:${AUTO_BUILD_IMAGE_VERSION}'
variables: variables:
DOCKER_TLS_CERTDIR: '' DOCKER_TLS_CERTDIR: ''
services: services:
......
variables: variables:
AUTO_BUILD_IMAGE_VERSION: 'v1.14.0' AUTO_BUILD_IMAGE_VERSION: 'v1.14.0'
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
build: build:
stage: build stage: build
image: '${TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-build-image:${AUTO_BUILD_IMAGE_VERSION}' image: '${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-build-image:${AUTO_BUILD_IMAGE_VERSION}'
variables: variables:
DOCKER_TLS_CERTDIR: '' DOCKER_TLS_CERTDIR: ''
services: services:
......
variables:
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
stages: stages:
- provision - provision
cloud_formation: cloud_formation:
image: '${TEMPLATE_REGISTRY_HOST}/gitlab-org/cloud-deploy/aws-cloudformation:latest' image: '${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cloud-deploy/aws-cloudformation:latest'
stage: provision stage: provision
script: script:
- gl-cloudformation create-stack - gl-cloudformation create-stack
......
...@@ -8,8 +8,7 @@ code_quality: ...@@ -8,8 +8,7 @@ code_quality:
variables: variables:
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "" DOCKER_TLS_CERTDIR: ""
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com' CODE_QUALITY_IMAGE: "$CI_TEMPLATE_REGISTRY_HOST/gitlab-org/ci-cd/codequality:0.85.29"
CODE_QUALITY_IMAGE: "$TEMPLATE_REGISTRY_HOST/gitlab-org/ci-cd/codequality:0.85.29"
needs: [] needs: []
script: script:
- export SOURCE_CODE=$PWD - export SOURCE_CODE=$PWD
......
variables: variables:
DAST_AUTO_DEPLOY_IMAGE_VERSION: 'v2.33.0' DAST_AUTO_DEPLOY_IMAGE_VERSION: 'v2.33.0'
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
.dast-auto-deploy: .dast-auto-deploy:
image: "${TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${DAST_AUTO_DEPLOY_IMAGE_VERSION}" image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${DAST_AUTO_DEPLOY_IMAGE_VERSION}"
.common_rules: &common_rules .common_rules: &common_rules
- if: $CI_DEFAULT_BRANCH != $CI_COMMIT_REF_NAME - if: $CI_DEFAULT_BRANCH != $CI_COMMIT_REF_NAME
...@@ -58,7 +57,7 @@ stop_dast_environment: ...@@ -58,7 +57,7 @@ stop_dast_environment:
when: always when: always
.ecs_image: .ecs_image:
image: '${TEMPLATE_REGISTRY_HOST}/gitlab-org/cloud-deploy/aws-ecs:latest' image: '${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cloud-deploy/aws-ecs:latest'
.ecs_rules: &ecs_rules .ecs_rules: &ecs_rules
- if: $AUTO_DEVOPS_PLATFORM_TARGET != "ECS" - if: $AUTO_DEVOPS_PLATFORM_TARGET != "ECS"
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
variables: variables:
# Setting this variable will affect all Security templates # Setting this variable will affect all Security templates
# (SAST, Dependency Scanning, ...) # (SAST, Dependency Scanning, ...)
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com' SECURE_ANALYZERS_PREFIX: "$CI_TEMPLATE_REGISTRY_HOST/security-products"
SECURE_ANALYZERS_PREFIX: "$TEMPLATE_REGISTRY_HOST/security-products"
DS_EXCLUDED_ANALYZERS: "" DS_EXCLUDED_ANALYZERS: ""
DS_EXCLUDED_PATHS: "spec, test, tests, tmp" DS_EXCLUDED_PATHS: "spec, test, tests, tmp"
DS_MAJOR_VERSION: 3 DS_MAJOR_VERSION: 3
......
variables: variables:
AUTO_DEPLOY_IMAGE_VERSION: 'v2.33.0' AUTO_DEPLOY_IMAGE_VERSION: 'v2.33.0'
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
.auto-deploy: .auto-deploy:
image: "${TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}" image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}"
dependencies: [] dependencies: []
review: review:
......
variables: variables:
AUTO_DEPLOY_IMAGE_VERSION: 'v2.33.0' AUTO_DEPLOY_IMAGE_VERSION: 'v2.33.0'
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
.auto-deploy: .auto-deploy:
image: "${TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}" image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}"
dependencies: [] dependencies: []
review: review:
......
variables:
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
stages: stages:
- review - review
- production - production
.push-and-deploy: .push-and-deploy:
image: '${TEMPLATE_REGISTRY_HOST}/gitlab-org/cloud-deploy/aws-ec2:latest' image: '${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cloud-deploy/aws-ec2:latest'
script: script:
- gl-ec2 push-to-s3 - gl-ec2 push-to-s3
- gl-ec2 deploy-to-ec2 - gl-ec2 deploy-to-ec2
......
...@@ -7,11 +7,8 @@ ...@@ -7,11 +7,8 @@
# then result in potentially breaking your future pipelines. # then result in potentially breaking your future pipelines.
# #
# More about including CI templates: https://docs.gitlab.com/ee/ci/yaml/#includetemplate # More about including CI templates: https://docs.gitlab.com/ee/ci/yaml/#includetemplate
variables:
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
.ecs_image: .ecs_image:
image: '${TEMPLATE_REGISTRY_HOST}/gitlab-org/cloud-deploy/aws-ecs:latest' image: '${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cloud-deploy/aws-ecs:latest'
.deploy_to_ecs: .deploy_to_ecs:
extends: .ecs_image extends: .ecs_image
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
# #
# To use, set the CI variable MIGRATE_HELM_2TO3 to "true". # To use, set the CI variable MIGRATE_HELM_2TO3 to "true".
# For more details, go to https://docs.gitlab.com/ee/topics/autodevops/upgrading_auto_deploy_dependencies.html#helm-v3 # For more details, go to https://docs.gitlab.com/ee/topics/autodevops/upgrading_auto_deploy_dependencies.html#helm-v3
variables:
TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'
.helm-2to3-migrate: .helm-2to3-migrate:
image: "${TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/helm-install-image/releases/helm-2to3-2.17.0-3.5.3-kube-1.16.15-alpine-3.12" image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/helm-install-image/releases/helm-2to3-2.17.0-3.5.3-kube-1.16.15-alpine-3.12"
# NOTE: We use the deploy stage because: # NOTE: We use the deploy stage because:
# - It exists in all versions of Auto DevOps. # - It exists in all versions of Auto DevOps.
# - It is _empty_. # - It is _empty_.
...@@ -56,7 +53,7 @@ variables: ...@@ -56,7 +53,7 @@ variables:
done done
.helm-2to3-cleanup: .helm-2to3-cleanup:
image: "${TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/helm-install-image/releases/helm-2to3-2.17.0-3.5.3-kube-1.16.15-alpine-3.12" image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/helm-install-image/releases/helm-2to3-2.17.0-3.5.3-kube-1.16.15-alpine-3.12"
stage: cleanup stage: cleanup
environment: environment:
action: prepare action: prepare
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册