GITLAB - CI 常用语法小记

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

相关推荐
Good_Starry15 小时前
Git介绍--github/gitee/gitlab使用
git·gitee·gitlab·github
陌殇殇殇1 天前
使用GitLab CI构建持续集成案例
运维·ci/cd·云原生·容器·kubernetes·gitlab
吕玉生1 天前
基于GitLab 的持续集成环境
ci/cd·gitlab
henan程序媛2 天前
jenkins项目发布基础
运维·gitlab·ansible·jenkins
THE WHY3 天前
Jenkins pipeline配置示例
运维·ci/cd·jenkins
极小狐4 天前
极狐GitLab 签约比博斯特,助力新能源智能底盘企业研发提效
gitlab·devsecops·devops·极狐gitlab·安全合规
YoungHong19924 天前
Gitlab服务搭建相关
gitlab
阿里斯顿k4 天前
CI/CD详细流程
ci/cd
zerotower5 天前
Jenkins集成化部署环境准备
ci/cd·docker·jenkins
sj11637394035 天前
docker-compose安装gitlab
docker·容器·gitlab