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 以下是操作的全过程 ![](https://i-blog.csdnimg.cn/direct/860afad8049341d7ad5d3cc6af030407.png) ### 4.使用sudo gitlab-runner list 可以查看runner的list列表 ![](https://i-blog.csdnimg.cn/direct/ffb1c06349454ff69ad561fd86965918.png) ### 5.删除runner的list列表。 #### 5.1 找到/etc/gitlab-runner/,打开config.toml文件,逐个删除带\[\[runners\]\]的项即可,然后保存文件即可 ![](https://i-blog.csdnimg.cn/direct/69cffc0666514546b40906bf457c7100.png) ### 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。 ![](https://i-blog.csdnimg.cn/direct/89643e132f594b1099d617568ede83af.png) 希望我的博文能对大家的学习有所帮助,谢谢你们的支持。

相关推荐
longerxin20205 小时前
在 Linux 上使用 SCP 将文件传输到 Windows(已开启 SSH)
linux·运维·ssh
zhaotiannuo_19987 小时前
渗透测试之docker
运维·docker·容器
王正南8 小时前
kali-linux 虚拟机连接安卓模拟器
android·linux·运维·虚拟机连接模拟器·安卓模拟器,linux虚拟机
三不原则8 小时前
故障案例:容器启动失败排查(AI运维场景)——从日志分析到根因定位
运维·人工智能·kubernetes
吳所畏惧8 小时前
Linux环境/麒麟V10SP3下离线安装Redis、修改默认密码并设置Redis开机自启动
linux·运维·服务器·redis·中间件·架构·ssh
yueguangni9 小时前
sysstat 版本 10.1.5 是 CentOS 7 的默认版本,默认情况下确实不显示 %wait 字段。需要升级到新版sysstat
linux·运维·centos
funfan05179 小时前
【运维】MySQL数据库全量备份与恢复实战指南:从入门到精通
运维·数据库·mysql
-dcr9 小时前
49.python自动化
运维·python·自动化
萧曵 丶10 小时前
Linux 业务场景常用命令详解
linux·运维·服务器
乾元11 小时前
ISP 级别的异常洪泛检测与防护——大流量事件的 AI 自动识别与响应工程
运维·网络·人工智能·安全·web安全·架构