多个图像作为 GitLab-ci 配置文件的入口点
Multiple images as entrypoints for GitLab-ci configuration file
我正在编写一个 gitlab-ci.yml 文件来使用加壳器构建图像,然后使用 terraform 部署它们。由于我是 gitlab 的新手,我认为可以像这样同时引用 Terraform 和 Packer 图像:
image:
name: registry.gitlab.com/gitlab-org/gitlab-build-images:terraform
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
image:
name: hashicorp/packer
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
您只能将一个“默认”图像应用于管道中的每个步骤,但您可以指定一个图像用于每个作业,或仅指定不同于默认的作业。
从此处的 GitLab CI 文档 (https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#define-image-and-services-from-gitlab-ciyml),您可以指定要使用的所有步骤的默认值:
default:
image: ruby:2.6
services:
- postgres:11.7
before_script:
- bundle install
test:
script:
- bundle exec rake spec
还有一些步骤与默认设置不同:
default:
image: ruby:2.6
services:
- postgres:11.7
before_script:
- bundle install
test: # this uses the default image
script:
- bundle exec rake spec
db_setup: # this uses a specific image that is different from the default
image: mysql:8
script:
- mysql -h my_datbase.example.com -u root -ppassword -e "create database my_database"
我正在编写一个 gitlab-ci.yml 文件来使用加壳器构建图像,然后使用 terraform 部署它们。由于我是 gitlab 的新手,我认为可以像这样同时引用 Terraform 和 Packer 图像:
image:
name: registry.gitlab.com/gitlab-org/gitlab-build-images:terraform
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
image:
name: hashicorp/packer
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
您只能将一个“默认”图像应用于管道中的每个步骤,但您可以指定一个图像用于每个作业,或仅指定不同于默认的作业。
从此处的 GitLab CI 文档 (https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#define-image-and-services-from-gitlab-ciyml),您可以指定要使用的所有步骤的默认值:
default:
image: ruby:2.6
services:
- postgres:11.7
before_script:
- bundle install
test:
script:
- bundle exec rake spec
还有一些步骤与默认设置不同:
default:
image: ruby:2.6
services:
- postgres:11.7
before_script:
- bundle install
test: # this uses the default image
script:
- bundle exec rake spec
db_setup: # this uses a specific image that is different from the default
image: mysql:8
script:
- mysql -h my_datbase.example.com -u root -ppassword -e "create database my_database"