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

相关推荐
yunson_Liu12 小时前
jenkins更新了gitlab后出现报错
运维·gitlab·jenkins
stark张宇15 小时前
Git 与 GitHub 协同工作流:从0到1搭建版本控制体系
git·gitlab·github
牛马的人生6 天前
GitLab入门教程:打开DevOps全流程的大门
运维·其他·gitlab·devops
水冗水孚6 天前
Ubuntu服务器上使用docker-compose部署 gitlab(图文并茂记录)
gitlab
<花开花落>8 天前
gitlab-runner 再次实践中理解和学习
gitlab
Vahala0623-孔勇9 天前
CI/CD流水线优化:GitLab CI镜像构建加速实战
ci/cd·gitlab
Lin_Aries_04219 天前
部署 GitLab 服务器
linux·运维·服务器·docker·gitlab·github
FreeBuf_10 天前
GitLab高危漏洞可致实例崩溃(CVE-2025-10858 和 CVE-2025-8014)
gitlab
恒雨田10 天前
Jenkins安装并与GitLab集成,实现dev、qa、uat、prod多分支持续集成的详细步骤
ci/cd·gitlab·jenkins
꧁༺摩༒西༻꧂10 天前
Windows Server 2022离线搭建Gitlab
gitlab