Gitlab中的CICD的使用方法

  • 一、CI/CD执行机制
  • 二、离线安装gitlab-runner
  1. 下载相应版本的gitlab-runner

(下载地址:https://packages.gitlab.com/runner/gitlab-runner)

  1. dpkg -i gitlab-runner_12.8.0_amd64.deb
  2. gitlab-runner register
  3. 第3步中需要的信息可从下图所示位置获取
  • 三、示例

3.1 .gitlab-ci.yml

内容如下:

before_script:

  • date

stages:

  • test

  • build

  • deploy

test:

stage: test

script:

  • echo "Running tests"

  • echo $username

  • export

build:

stage: build

script:

deploy_staging:

stage: deploy

script:

  • echo "Deploy to staging server"

environment:

name: staging

url: https://staging.example.com

only:

  • master

deploy_prod:

stage: deploy

script:

  • echo "Deploy to production server"

environment:

name: production

url: https://example.com

when: manual

only:

  • master

3.2 Pipelines执行结果列表

3.3 Pipeline执行结果详情

3.4 Jobs执行结果列表

3.5 Jobs执行结果详情

3.6 Schedules列表

3.7 Schedules详情

3.8 Pipeline triggers

3.9 Pipeline triggers调用结果

  • 四、其它

1、哪个分支发生了push或merge事件,则gitlab-runner执行哪个分支下的.gitlab-ci.yml

  • 五、参考地址:

1、.gitlab-ci.yml 语法:{gitlabHost}/help/ci/yaml/README.md

相关推荐
星释1 天前
如何自动部署GitLab项目
gitlab
keson要进步1 天前
CICD实战(二)-----gitlab的安装与配置
linux·运维·gitlab
猫头虎1 天前
[特殊字符]解决 “IDEA 登录失败。不支持早于 14.0 的 GitLab 版本” 问题的几种方法
java·ide·网络协议·http·https·gitlab·intellij-idea
风早君2 天前
jenkins集成gitlab发布到远程服务器
服务器·gitlab·jenkins
大白要努力!4 天前
在 Android Studio 中使用 GitLab 添加图片到 README.md
android·gitlab·android studio
星释4 天前
如何编写GitLab-CI配置文件
ci/cd·gitlab
馨羽的玩具4 天前
gitlab rss订阅失败
gitlab
t198751284 天前
jenkins结合gitlab实现CI
ci/cd·gitlab·jenkins
一颗小豆5 天前
07-接着玩-linux的CD/CI全流程体验
gitlab