gitlab集成CI/CD,shell方式部署

目录

1.首先安装好gitlab和gitlab-runner,这两个,看我以往的教程

[2.注册新的 Runner](#2.注册新的 Runner)

[3. 步骤](#3. 步骤)

[3.1 Enter the GitLab instance URL (for example, https://gitlab.com/):](#3.1 Enter the GitLab instance URL (for example, https://gitlab.com/):)

[3.2 Enter the registration token:](#3.2 Enter the registration token:)

[3.3 Enter a description for the runner:](#3.3 Enter a description for the runner:)

[3.4 Enter tags for the runner (comma-separated):](#3.4 Enter tags for the runner (comma-separated):)

[3.5 Enter optional maintenance note for the runner:](#3.5 Enter optional maintenance note for the runner:)

[3.6 以下是操作的全过程](#3.6 以下是操作的全过程)

[4.使用sudo gitlab-runner list 可以查看runner的list列表](#4.使用sudo gitlab-runner list 可以查看runner的list列表)

5.删除runner的list列表。

[5.1 找到/etc/gitlab-runner/,打开config.toml文件,逐个删除带\[runners]的项即可,然后保存文件即可](#5.1 找到/etc/gitlab-runner/,打开config.toml文件,逐个删除带[[runners]]的项即可,然后保存文件即可)

7.上述步骤完成之后,我们就可以自定义我们的.gitlab-ci.yml文件了

8.上传之后,即可看到,gitlab会自动的集成CI/CD。


1.首先安装好gitlab和gitlab-runner,这两个,看我以往的教程

2.注册新的 Runner

复制代码
sudo gitlab-runner register

3. 步骤

3.1 Enter the GitLab instance URL (for example, https://gitlab.com/):

http://127.0.0.1:8089/(你的gitlab项目地址)

3.2 Enter the registration token:

GR1348941iujWBKn8Hyvk5pzLydny(项目的token,可以在runner那里找到)

3.3 Enter a description for the runner:

xingranserver: my-runner(项目的描述,可按照自己的意思去填)

3.4 Enter tags for the runner (comma-separated):

tag,other-tg(标签,可以写多个,用逗号隔开,这个后面项目部署会用到)

3.5 Enter optional maintenance note for the runner:

回车

3.6 以下是操作的全过程

4.使用sudo gitlab-runner list 可以查看runner的list列表

5.删除runner的list列表。

5.1 找到/etc/gitlab-runner/,打开config.toml文件,逐个删除带\[runners]的项即可,然后保存文件即可

7.上述步骤完成之后,我们就可以自定义我们的.gitlab-ci.yml文件了

复制代码
stages:
    - build
    - test
    - deploy

build_job:
    stage: build
    tags:
        - tag
    script:
        - echo "Building the project..."
#        - ./build.sh

test_job:
    stage: test
    tags:
        - tag
    script:
        - echo "Running tests..."
#        - ./test.sh

deploy_job:
    stage: deploy
    tags:
        - tag
    script:
        - echo "Deploying application..."
#        - ./deploy.sh
    only:
        - testmain

8.上传之后,即可看到,gitlab会自动的集成CI/CD。

希望我的博文能对大家的学习有所帮助,谢谢你们的支持。

相关推荐
咖啡星人k1 分钟前
MonkeyCode 的 CI/CD 实践:开源项目如何做到每2周稳定发布
ci/cd·开源
VX_1810 分钟前
Docker镜像直接部署JumpServer
运维·docker·容器
丑过三八线10 分钟前
Umi 配置文件 .umirc.ts 详解
linux·运维·ubuntu·react.js
咖啡星人k11 分钟前
用 MonkeyCode 构建全栈应用:从需求到部署的AI自动化实践
运维·人工智能·自动化
团象科技29 分钟前
中小出海团队运维观察:WordPress站点境外云环境搭建实操路径梳理
大数据·运维·人工智能
HoneyMoose31 分钟前
Jenkins Firefox 登录提示错误
运维·jenkins
江湖有缘34 分钟前
Docker部署Beaver Habit Tracker习惯追踪应用
运维·docker·容器
小此方36 分钟前
Re:Linux系统篇(二十七)进程篇·十二:从零构建属于你的自定义 Shell 解释器
linux·运维·服务器
Shadow(⊙o⊙)41 分钟前
mkfifo()命名管道-FIFO客户端 服务端模拟。*System V消息队列、信号量(信号灯)。
linux·运维·服务器·开发语言·c++
maosheng11461 小时前
基于AI 文本生成的自动化Linux 运维文档系统
运维·人工智能·自动化