您可以通过CI_MERGE_REQUEST_TARGET_BRANCH_NAME环境变量获得目标分支,并且可以更改上面的示例,以便在...
job:script:echo"Hello, Rules!"rules:-if:'$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'when:manualallow_failure:true 解释起来并不复杂,一个判断语句,二句赋值语句。即如果当前分支是master,在任务的执行方式改为手动,并且运行失败。 写在最后 懂了以上这些关键词,那就不难写出一条规则复杂,易于扩展...
secscan-job:stage: secscan:-exportMULT_COMMIT_BRANCH=${CI_COMMIT_BRANCH}-if[ !"$MULT_COMMIT_BRANCH"];thenexportMULT_COMMIT_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME};fi-if[ !"$MULT_COMMIT_BRANCH"];thenexportMULT_COMMIT_BRANCH=${CI_COMMIT_TAG};fi- python3 /home/agent/gitlab_secscan...
CI_MERGE_REQUEST_SOURCE_BRANCH_NAME: The URL of the source project of the merge request if the pipelines are for merge requests. Available only if only: [merge_requests] or rules syntax is used and the merge request is created. CI_MERGE_REQUEST_TARGET_BRANCH_NAME: The target branch name ...
rules: - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"' when: manual allow_failure: true 1 2 3 4 5 6登录后即可复制 解释起来并不复杂,一个判断语句,二句赋值语句。即如果当前分支是master,在任务的执行方式改为手动,并且运行失败。 写在最后 懂了以上这些关键词,那就不难写出一条规则复...
job:script:"echo Hello, Rules!"rules:-if:'$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'when:manual allow_failure:true 在此示例中,如果第一个规则匹配,则作业将具有以下when: manual和allow_failure: true。 workflow:rules 顶级workflow:关键字适用于整个管道,并将确定是否创建管道。when :可以设置...
CI_MERGE_REQUEST_TARGET_BRANCH_NAME: The target branch name of the merge request if the pipelines are for merge requests. Available only if only: [merge_requests] or rules syntax is used and the merge request is created. variables 参考:《variables》 GitLab CI/CD allows you to define ...
git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME; # git diff 循环整个输出 for dir in $(git diff --name-only $CI_COMMIT_SHA origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME | awk -F/ '{print $1}' | sort -u); do # 判断是否是文件目录类型`dictionary`, ...
CI_MERGE_REQUEST_TARGET_BRANCH_NAME: The target branch name of the merge request if the pipelines are for merge requests. Available only if only: [merge_requests] or rules syntax is used and the merge request is created. variables 参考:《variables》 GitLab CI/CD allows you to define ...
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"' tags: - yehanli script: - echo 'Is experiencing before-merge?' $IS_EXPERIENCING_MERGING - echo '=== job_5_beforeMR 完成 ===' stage: fifth_stage retry: 2 # pull 官方...