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

相关推荐
IT大白鼠4 天前
GitLab 未认证 RCE 应急实战CVE-2026-97229(CVSS 10.0)
网络·安全·gitlab
71777710 天前
Git自建用什么工具比较好:Gitea、Forgejo、GitLab CE与Gitee的选型对比
git·gitlab·gitea
colinu12 天前
Create gitlab-runner
gitlab
master33613 天前
GitLab 10.x → 19.5.x 升级路线图
gitlab
长不大的杨瑞杰13 天前
OpenCode v2 GitLab 集成实战:Issue 驱动开发、MR 审查与 CI/CD 最小权限
人工智能·ci/cd·gitlab·ai编程·opencode
极小狐19 天前
极狐GitLab万人并发架构实践,大规模组织的扩容路线图
架构·gitlab·极狐gitlab
Lvan的前端笔记20 天前
GitLab CI 环境变量整理
ci/cd·gitlab
李迟21 天前
CICD实例:解决GitLab Runner无法执行CICD问题
gitlab
hanjq_code23 天前
gitlab本地文件 跨分支 忽略改动 不提交
gitlab
极小狐23 天前
极狐GitLab集群高可用方案,多节点架构与故障自愈实践
架构·gitlab·高可用·极狐gitlab