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。

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

相关推荐
啦啦啦啦啦zzzz15 分钟前
5种IO模型
运维·服务器·网络·c++
FreeTinker25 分钟前
企业存储服务器NAS的选型逻辑与补充路径
运维·服务器
acrel732 分钟前
算力机房供电不间断,智能电力运维保驾护航
运维·安全·机房电力运维·机房配电·列头柜监测
mengpp_1234561 小时前
物联网云平台可以离线使用吗?摒弃云端依赖,工业现场离线自动化解决方案
运维·物联网·自动化·华为云
Acrellea2 小时前
ADL200W/ADL400W 导轨电表:一块小表终结光储防逆流之痛
运维·能源
xiaoxiangsiyan2 小时前
企业网络运维自动化与管理协议深度指南
linux·运维·服务器·网络·学习·自动化
AIgorithmGEEK2 小时前
Linux 进程控制完全指南:fork、wait、exec 三部曲
linux·运维·多进程·进程创建·进程等待·进程终止·exec家族
wgh6532 小时前
旁挂组网双机热备负载分担
运维·服务器
2401_894915532 小时前
部署 GEO 优化源码常见报错排查:端口、伪静态、缓存问题解决
java·运维·服务器·后端·缓存·开源
Lysander.Jovian2 小时前
Nginx服务2
运维·数据库·nginx