有 3 个阶段 - 在 .gitlab-ci.yml
中构建、测试和部署。
需要运行每晚回归测试阶段 - nightly
:)
这里是相关的.gitlab-ci.yml
代码:
stages:
- build
- test
- deploy
build_project:
stage: build
script:
- cd ./some-dir
- build-script.sh
except:
- tags
#Run this only when say variable 'NIGHTLY_TEST == True'. But HOW?
nightly_regression_test_project:
stage: test
script:
- cd ./some-dir
- execute test-script
每日标记到仅
运行测试
阶段是不可取的。
还有其他想法吗?
最佳答案
except
和 only
可以指定将触发它们的变量。
您可以在 .gitlab-ci.yml 中使用以下内容:
build1:
stage: build
script:
- echo "Only when NIGHTLY_TEST is false"
except:
variables:
- $NIGHTLY_TEST
test1:
stage: test
script:
- echo "Only when NIGHTLY_TEST is true"
only:
variables:
- $NIGHTLY_TEST
关于Gitlab有条件地执行阶段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39988497/