version: "3.1"
services:
namenode:
image: jenkins/jenkins:2.83
container_name: jenkins
ports:
- 9090:8080
- 50000:50000
sudo docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword密码
docker exec -it Jenkins /bin/bash
ssh-keygen -t rsa -C "1079226090@qq.com"
cat ~/.ssh/id_rsa.pub
秘钥放到gitlab中
下载maven和gitlab插件
随机生成Token
openssl rand -hex 12
30910262eff664f2acbcb962
配置钩子
登录Gitlab,配置钩子,不同版本的Gitlab,钩子形式可能不一样,有的是Webhooks,有的是System Hooks,我本机上的就是后者
==进入Gitlab
==进入test
==点击“System Hooks”,在弹出的界面中,URL栏输入http://10.11.1.5:8080/buildByToken/build?job=auto-test&token=
30910262eff664f2acbcb962
URL格式为http://jenkins服务器地址:8080/buildByToken/build?job=job名称&token=token
勾选“Push events”
==保存
==点击“Test hook”,如果返回“Hook executed successfully:HTTP 201”,则配置成功