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

相关推荐
angushine3 天前
gitlab跨服务器备份
服务器·gitlab·github
蜡台4 天前
Git 常用配置:修改地址 ,提交模板配置
git·gitlab·template·git commit·gitbash
染夕陌木5 天前
极简教程:GitLab 上配置 SSH Key(附常见问题解决)
运维·ssh·gitlab
晨旭缘6 天前
GitLab CICD 中 K8s 部署:BOM 头与 YAML 格式全解
容器·kubernetes·gitlab
鳄鱼杆7 天前
服务器 | 2026年Ubuntu 24.04下GitLab Docker 企业级部署
服务器·ubuntu·gitlab
FreeBuf_7 天前
黑客滥用 GitHub 和 GitLab 托管恶意软件并实施凭证钓鱼攻击
gitlab·github
有理想的打工人10 天前
gitlab的参数设置与团队管理
gitlab
有理想的打工人11 天前
gitlab群组管理与ssh链接
ssh·gitlab
M-Ellen11 天前
从零搭建 Windows + WSL2 + Docker + GitLab CI/CD 完整手册
ci/cd·docker·gitlab
大脸胖柴11 天前
webStorm+gitLab操作学习
学习·gitlab·webstorm