有什么方法可以在 Gitlab CI/CD 中制作一个内部有两个阶段的阶段吗?
Is there any way to make in Gitlab CI/CD a stage with two stages inside?
我有一个包含两个阶段的 .gitlab-ci.yml 文件,我想在称为发布的一般阶段中包含这些阶段。换句话说,我希望在发行版中包含第 1 阶段和第 2 阶段。我的 .gitlab-ci.yml 文件是这样的:
image: google/cloud-sdk:slim
stages:
- deploy-website
- deploy-cloud-function
before_script:
- gcloud auth activate-service-account --key-file $GOOGLE_SERVICE_ACCOUNT_FILE
- gcloud config set project $GOOGLE_PROJECT_ID
deploy-website:
stage: deploy-website
script:
- gsutil -m rm gs://ahinko.com/**
- gsutil -m cp -R src/client-side/* gs://ahinko.com
environment:
name: production
url: https://ahinko.com
only:
- ci-test
deploy-cloud-function:
stage: deploy-cloud-function
script:
- gcloud functions deploy send_contact --entry-point=send_contact_form --ingress-settings=all --runtime=python37 --source=src/server-side/cf-send-email/ --trigger-http
environment:
name: production
url: https://ahinko.com
only:
- ci-test
要实现您想要的效果,您只需使用与
相同的舞台名称
image: google/cloud-sdk:slim
stages:
- release
before_script:
- gcloud auth activate-service-account --key-file $GOOGLE_SERVICE_ACCOUNT_FILE
- gcloud config set project $GOOGLE_PROJECT_ID
deploy-website:
stage: release
script:
- gsutil -m rm gs://ahinko.com/**
- gsutil -m cp -R src/client-side/* gs://ahinko.com
environment:
name: production
url: https://ahinko.com
only:
- ci-test
deploy-cloud-function:
stage: release
script:
- gcloud functions deploy send_contact --entry-point=send_contact_form --ingress-settings=all --runtime=python37 --source=src/server-side/cf-send-email/ --trigger-http
environment:
name: production
url: https://ahinko.com
only:
- ci-test
但如果您这样做,您的工作将同时开始。
为避免此行为,您需要将作业更改为手动启动
when: manual
我有一个包含两个阶段的 .gitlab-ci.yml 文件,我想在称为发布的一般阶段中包含这些阶段。换句话说,我希望在发行版中包含第 1 阶段和第 2 阶段。我的 .gitlab-ci.yml 文件是这样的:
image: google/cloud-sdk:slim
stages:
- deploy-website
- deploy-cloud-function
before_script:
- gcloud auth activate-service-account --key-file $GOOGLE_SERVICE_ACCOUNT_FILE
- gcloud config set project $GOOGLE_PROJECT_ID
deploy-website:
stage: deploy-website
script:
- gsutil -m rm gs://ahinko.com/**
- gsutil -m cp -R src/client-side/* gs://ahinko.com
environment:
name: production
url: https://ahinko.com
only:
- ci-test
deploy-cloud-function:
stage: deploy-cloud-function
script:
- gcloud functions deploy send_contact --entry-point=send_contact_form --ingress-settings=all --runtime=python37 --source=src/server-side/cf-send-email/ --trigger-http
environment:
name: production
url: https://ahinko.com
only:
- ci-test
要实现您想要的效果,您只需使用与
相同的舞台名称 image: google/cloud-sdk:slim
stages:
- release
before_script:
- gcloud auth activate-service-account --key-file $GOOGLE_SERVICE_ACCOUNT_FILE
- gcloud config set project $GOOGLE_PROJECT_ID
deploy-website:
stage: release
script:
- gsutil -m rm gs://ahinko.com/**
- gsutil -m cp -R src/client-side/* gs://ahinko.com
environment:
name: production
url: https://ahinko.com
only:
- ci-test
deploy-cloud-function:
stage: release
script:
- gcloud functions deploy send_contact --entry-point=send_contact_form --ingress-settings=all --runtime=python37 --source=src/server-side/cf-send-email/ --trigger-http
environment:
name: production
url: https://ahinko.com
only:
- ci-test
但如果您这样做,您的工作将同时开始。 为避免此行为,您需要将作业更改为手动启动
when: manual