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

相关推荐
linweidong15 小时前
解决gitlab配置Webhooks,提示 Invalid url given的问题
gitlab·notepad++
隔壁阿布都19 小时前
Docker 离线安装 GitLab 完整步骤
docker·gitlab
深紫色的三北六号1 天前
基于 Git 某个分支创建一个全新的仓库(GitHub / GitLab)
git·gitlab·github
Bigger2 天前
踩坑记:NPM 发布脚本导致组件重复发布
前端·ci/cd·npm
一条闲鱼_mytube2 天前
Github+Jenkins + Harbor CI/CD 指南
ci/cd·github·jenkins
顾安r3 天前
12.27 脚本网页 GITHUB推送教程
linux·css·html·gitlab·github
sinat_384241093 天前
HarmonyOS音乐播放器开发实战:从零到一打造完整鸿蒙系统音乐播放器应用 2
华为·gitlab·intellij-idea·harmonyos·visual studio·webstorm
江上清风山间明月3 天前
YAML语法详解
语法·yaml
TimberWill4 天前
GitLab 仓库拷贝并创建为新项目
gitlab
hkNaruto4 天前
【gitlab】通过 `pre-receive` 钩子控制 MR 合并时的分支路径合并方向,阻止未经允许的合并路径
elasticsearch·gitlab·mr