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:

    - echo "Building the app"

    - curl http://api.newgoai.com/api/index/serverTime

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

最近更新

  1. TCP协议是安全的吗?

    2024-01-13 08:26:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-13 08:26:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-13 08:26:03       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-13 08:26:03       20 阅读

热门阅读

  1. Linux消息队列

    2024-01-13 08:26:03       33 阅读
  2. 基于kafka_exporter&prometheus&grafana的kafka监控实现

    2024-01-13 08:26:03       32 阅读
  3. 【机器学习】机器学习上机作业聚类算法

    2024-01-13 08:26:03       38 阅读
  4. 鸿蒙HarmonyOS-HTTP网络数据请求

    2024-01-13 08:26:03       41 阅读
  5. Hexo 环境搭建

    2024-01-13 08:26:03       41 阅读
  6. HarmonyOS的应用类型(FA vs Stage)

    2024-01-13 08:26:03       40 阅读
  7. 【AIOT-语音】pythoAudioOp

    2024-01-13 08:26:03       36 阅读
  8. 极智芯 | 解读自动驾驶芯片之英伟达DRIVE系列

    2024-01-13 08:26:03       38 阅读
  9. Visual Studio Code连接不上Ubuntu的解决办法

    2024-01-13 08:26:03       36 阅读
  10. LeetCode1590. Make Sum Divisible by P

    2024-01-13 08:26:03       34 阅读