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

相关推荐
一念一花一世界4 小时前
Arbess从初级到进阶(9) - 使用Arbess+GitLab实现C++项目自动化部署
c++·ci/cd·gitlab·arbess
X***48964 小时前
GitLab
gitlab
一世一生命5 小时前
GitLab Package依赖管理:从 Dependabot 到 Renovate 的迁移实践和两者对比
gitlab
t***L2665 小时前
GitLab API使用实例
运维·gitlab
x***B41112 小时前
GitLab Runner配置教程
gitlab
9***Y4812 小时前
GitLab CI/CD配置教程
ci/cd·gitlab
y***548814 小时前
GitLab CI缓存配置
缓存·ci/cd·gitlab
p***c94914 小时前
GitLab CI/CD变量
git·ci/cd·gitlab
O***p60414 小时前
GitLab CI/CD自动化部署实践
ci/cd·自动化·gitlab
知兀1 天前
私有化部署的gitlab的push failed问题,使用http远程连接(使用token或用户、密码)
gitlab