对于特定工作,您只能拥有关键字。所以它将在子 CI 文件中写入实际过程,而不是在调用程序文件中
所以下面将是我的子管道脚本,只有在 src 文件夹上发生更新时它才会运行
test_pylint:
stage: test
image: python:3.7
allow_failure: true
before_script:
- pip install pylint pylint-junit
- pip install -e .
- python -V
script:
- pylint --output-format=pylint_junit.JUnitReporter src/ | tee rspec.xml
artifacts:
paths:
- rspec.xml
reports:
junit: rspec.xml
when: always
expire_in: 1 week
rules:
- if: '($CI_PIPELINE_SOURCE == "merge_request_event") && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop")'
when: always
changes:
- src/*
下面是根 .gitlab-ci.yml 文件
stages:
- test
include:
- project: test
file: /job/py-lint.gitlab-ci.yml
所以所有唯一的条件都是子 CI 文件的一部分