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。

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

相关推荐
likfishdn几秒前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean20 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=22 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
北京耐用通信1 小时前
航空装配自动化神器Ethercat转profient网关搭配机器人精准控制
运维·机器人·自动化
吃汤圆的抹香鲸1 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
崔lc4 小时前
linux中安装部署Jenkins,成功构建springboot项目详细教程
运维·jenkins
luojiaao4 小时前
【Jenkins】个人向-Jenkinsfile如何写
运维·jenkins
wanhengidc8 小时前
单线服务器和双线服务器分别是指什么?
运维·服务器
海绵宝宝10 小时前
Linux中常见命令使用
linux·运维·服务器