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

相关推荐
不爱吃米饭_5 小时前
Gitea 轻量级的Git方案 - Gitlab的替代品
git·gitlab·gitea
昵称为空C7 小时前
Spring Boot 项目docker分层镜像构建案例
spring boot·ci/cd·docker
卓码软件测评9 小时前
第三方软件CMA/CNAS测评机构:【Apifox的自定义加密和签名的安全测试技巧】
测试工具·ci/cd·单元测试·测试用例·压力测试
嘻哈baby10 小时前
自建GitLab与CI/CD实战:团队协作完整方案
ci/cd·gitlab
秦时明月天明10 小时前
GitLab SSH Key 过期:git pull failed : remote your ssh key has expired
git·ssh·gitlab
weixin_3077791312 小时前
Jenkins声明式管道扩展点API:深度解析与应用指南
开发语言·ci/cd·自动化·jenkins·etl
极限实验室21 小时前
程序员爆哭!我们让 COCO AI 接管 GitLab 审查后,团队直接起飞:连 CTO 都说“这玩意儿比人靠谱多了
人工智能·gitlab
song5011 天前
鸿蒙 Flutter 复杂表单验证:自定义规则与联动逻辑
分布式·python·flutter·ci/cd·分类
HIT_Weston2 天前
61、【Ubuntu】【Gitlab】拉出内网 Web 服务:Gitlab 配置审视(五)
前端·ubuntu·gitlab