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

相关推荐
极小狐13 小时前
如何创建极狐GitLab 私密议题?
数据库·ci/cd·gitlab·devops·mcp
极小狐2 天前
如何使用极狐GitLab 的外部状态检查功能?
数据库·ci/cd·gitlab·devops·mcp
极小狐2 天前
如何对极狐GitLab 议题进行过滤和排序?
人工智能·git·机器学习·gitlab
极小狐2 天前
如何创建并使用极狐GitLab 部署令牌?
运维·git·ssh·gitlab·github
极小狐2 天前
极狐GitLab 的合并请求部件能干什么?
运维·git·安全·gitlab·极狐gitlab
极小狐3 天前
极狐GitLab 议题权重有什么作用?
开发语言·数据库·chrome·c#·gitlab
极小狐3 天前
极狐GitLab 的压缩和合并是什么?
运维·git·ssh·gitlab·github
极小狐3 天前
极狐GitLab 合并请求依赖如何解决?
运维·git·ssh·gitlab·github
极小狐4 天前
极狐GitLab 项目功能和权限解读
运维·git·安全·gitlab·极狐gitlab
宁酱醇4 天前
GitLab_密钥生成(SSH-key)
运维·ssh·gitlab