include & reference
gitlab-ci/setup.gitlab-ci.yml
.set_envs:
set_ssh:
- apt-get install -qq git
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p $HOME/.ssh
- echo -e "Host code.xxx.yyy\n\tport 2222\n\tStrictHostKeyChecking no\n\n" > $HOME/.ssh/config
- cat $HOME/.ssh/config
.integration_test_pipe:
before_script:
- pip install -r "$DEPENDS_PATH"
- !reference [.set_envs, set_ssh]
引用
.run_task: &run_task
- export CUDA_VISIBLE_DEVICES=0
- export MASTER_PORT=29100 && dist_train.sh --cfg_file ${CFG_FILE} --work_dir=${INTEGRATION_WORK_DIR} --integration
extends
.integration_test_pipe:
script:
- *run_task
test_xxx:
extends: .integration_test_pipe
variables:
CFG_FILE: configs/xxx.py
变量相关
模糊匹配
参考文档:http://blog.dhainidewo.com/gitlab/gitlab-ci-变量.html
例:$VARIABLE =~ /^content.*/,可以对变量使用正则表达式进行模式匹配,如果找到匹配,则为真。默认情况下,模式匹配区分大小写,使用i标志来不区分大小写,例:/pattern/i