
版本声明
部署时通过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 (二)