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

相关推荐
w3296362716 小时前
八、OpenCode 高阶玩法:CLI 自动化、CI/CD 集成与远程协作
运维·ci/cd·自动化·ai编程·开发工具·opencode
brycegao6 小时前
如何搭建标准化 Git 工具流,保障 Android 团队代码质量
android·ci/cd
Dontla10 小时前
CI/CD前世今生(持续集成、持续交付、持续部署、Jenkins、Github Actions)
ci/cd·github·jenkins
qeen8710 小时前
【C++】类与对象之零散知识点补充(四)
c++·笔记·学习·语法
lisanmengmeng10 小时前
gitlab 免密配置
linux·服务器·gitlab
小雨青年11 小时前
GitHub Actions 可复用工作流设计模式:把 CI/CD 重复逻辑收起来
ci/cd·设计模式·github
求知若渴,虚心若愚。12 小时前
Jenkins 自动化流水线(CICD)
运维·自动化·gitlab
逻极1 天前
Jenkins 从入门到精通:CI/CD自动化流水线实战
ci/cd·自动化·jenkins·devops
咖啡星人k1 天前
MonkeyCode DevOps 实践:CI/CD流水线与自动化部署全流程
ci/cd·自动化·devops·monkeycode
mnasd2 天前
Gitlab + Jenkins 实现 CICD
运维·gitlab·jenkins