我希望在具有触发器的作业中使用如下所示的环境关键字。
deploy:
stage: deploy
environment:
name: develop
variables:
ENV: develop
trigger:
include:
- local: '<path to pipeline config>'
Run Code Online (Sandbox Code Playgroud)
但是,它给出错误“配置包含未知密钥:环境”
使用“脚本”而不是触发器可以正常工作。无论如何,它可以与触发器一起使用吗?
在 Gitlab 中,我试图从父管道触发子管道。子管道位于同一项目的子目录下。但是,在合并请求事件时触发时,它会给出错误“无法创建下游管道,该管道没有阶段/作业”
文件夹结构:
父管道:
trigger_servicename:
stage: triggers
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "dev"'
changes:
- app-notifier/*
when: always
trigger:
include: servicename/.gitlab-ci.yml
strategy: depend
Run Code Online (Sandbox Code Playgroud)
子管道:
image:
name: registry.gitlab.com/who-docker/aws-cli:latest
entrypoint:
- /usr/bin/env
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
stages:
-build
build:
stage: build
script:
- echo "run build..."
test:
stage: test
script:
- echo "run test...."
Run Code Online (Sandbox Code Playgroud) 有什么方法可以将父管道的作业 ID 作为变量传递给子管道
package:
stage: package
script:
- zip -r ./service.zip
deploy:
stage: deploy
variables:
trigger:
include:
- project: '<namespace>/<project>'
ref: '<branch>'
file: '<path to yml file>'
strategy: depend
Run Code Online (Sandbox Code Playgroud)