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

相关推荐
极小狐2 小时前
如何对极狐GitLab 议题进行过滤和排序?
人工智能·git·机器学习·gitlab
极小狐7 小时前
如何创建并使用极狐GitLab 部署令牌?
运维·git·ssh·gitlab·github
高峰君主8 小时前
全栈自动化:从零构建智能CI/CD流水线
运维·ci/cd·自动化
龙智DevSecOps解决方案8 小时前
CI/CD解决方案TeamCity在游戏开发中的应用价值与优势分析
ci/cd·游戏开发·jetbrains·持续集成·teamcity
极小狐9 小时前
极狐GitLab 的合并请求部件能干什么?
运维·git·安全·gitlab·极狐gitlab
极小狐19 小时前
极狐GitLab 议题权重有什么作用?
开发语言·数据库·chrome·c#·gitlab
极小狐19 小时前
极狐GitLab 的压缩和合并是什么?
运维·git·ssh·gitlab·github
极小狐1 天前
极狐GitLab 合并请求依赖如何解决?
运维·git·ssh·gitlab·github
鱼饼6号1 天前
Jenkins Pipeline 构建 CI/CD 流程
linux·运维·服务器·ci/cd·容器·jenkins
qq_400552002 天前
CI/CD自动化部署(持续集成和持续交付/部署)
运维·ci/cd·自动化