Gitlab和Jenkins集成 实现CI (一)

版本声明

部署时通过docker拉取的最新版本

gitlab: 16.8

jenkins: 2.426.3

安装环境

可参考这篇文章

停止防火墙

由于在内网,这里防火墙彻底关掉,如果再外网或者云上的悠着点

shell 复制代码
systemctl stop firewalled
systemctl disable firewalled

systemctl stop iptables
systemctl disable iptables

配置gitlab

登录gitlab
获取初始密码或者重置root用户密码,可参考这篇博文

设置本地化

Admin Area settings Preferences Localization Default first day of the week 选择Monday Default language 选择简体中文

设置用户邮箱&设置密码

邮箱用于系统发送主要信息给管理员
用户头像 Edit profile Time zone 选择UTF+8 beijing Main settings Email 填写管理员邮箱 需管理员点收到的链接确认 选择同级的Password 修改密码

设置注册安全

Admin Area settings Genera Sign-up restrictions Sign-up enabled 取消勾选

新增群组&创建项目

Homepage Groups New Group Create Group 填写组名

Visibility level:

  • Private 群组内可访问
  • Internal 登录gitlab的用户可访问
  • Public 所有人员可以访问

创建完成群组之后,直接创建项目(项目依赖于组)
New Project Create blank project 填写项目名称

项目创建完成后,增加一个文件,内容随便填点,方便后续使用

配置Jenkins

这里默认你已经安装好jenkins

获取初始密码

shell 复制代码
#jenkins可以改成你自己的容器名称
docker container logs jenkins
#复制日志里面的密码,登录jenkins

修改密码

用户头像 Configure Password 填写新的密码

安装插件

注意:插件卸载,下次重新启动时才会执行卸载
Dashboard Manage Jenkins Plugins 安装以下插件

  • Build Timeout
  • Email Extension Plugin
  • GitLab Authentication plugin
  • GitLab Branch Source Plugin
  • GitLab Plugin
  • Matrix Authorization Strategy Plugin
  • OkHttp Plugin
  • PAM Authentication plugin
  • Pipeline
  • Pipeline: Stage View Plugin
  • SSH Build Agents plugin
  • Timestamper
  • Workspace Cleanup Plugin
  • Localization: Chinese (Simplified)

基础配置

Dashboard Manage Jenkins System Jenkins Location System Admin e-mail address 填写用户邮箱 GitLab 勾掉 Enable authentication for '/project' end-point GitLab GitLab connections Connection name 填写 jenkins GitLab host URL 填写gitlab的裸url Credentials 配置gitlab api token一章介绍

都看到这里了,点个赞再走吧!^ _ ^ 继续看 Gitlab和Jenkins集成 实现CI (二)

相关推荐
NexTunnel1 天前
公司老项目还在 SVN,远程维护怎么做更稳?
git·svn·gitlab·远程工作·nextunnel
Hy行者勇哥1 天前
用Cursor智能编写Ansible/Terraform脚本,打通CI/CD链路
ci/cd·ansible·terraform
想你依然心痛2 天前
AtomCode 在 DevOps 场景中的实战:CI/CD 流水线脚本自动生成
运维·ci/cd·docker·devops·自动化部署·github actions
IT二叔2 天前
Java项目部署-03-teamcity-cicd-docker镜像流水线方式部署
java·ci/cd·持续部署
想你依然心痛3 天前
持续集成在嵌入式开发中的实践:GitLab CI与交叉编译——自动化构建、固件生成
ci/cd·自动化·gitlab
Sean‘4 天前
GitLab 升级后 502:Puma 反复重启问题处理记录
docker·gateway·gitlab
NexTunnel4 天前
告别传统组网,也能安全访问公司 GitLab / SVN
安全·svn·gitlab
longze_74 天前
Github仓库一直拉取不了
github·jenkins
江畔柳前堤4 天前
第14章:Docker 与 CI/CD
运维·ci/cd·docker·容器·eureka·github
Bigger9 天前
从零搭建 AI 代码审查服务:一份前端也能看懂的 Python 学习笔记
前端·ci/cd·ai编程