环境:Eclipse + OCP 3.4
1. 下载并安装 Eclipse
下载地址:https://www.eclipse.org/downloads/eclipse-packages/
介质:eclipse-jee-neon-1a-macosx-cocoa-x86_64.tar.gz
2. 导入一个 Git Project
(1)
(2)
(3)
(4)修改 index.jsp 把 images/small_bank.png 改为 images/big_bank.png,add,commit,push
发现有错误,push failed。
(5)改为使用 ssh 协议
ssh://root@git.example.com/opt/git/repo/mybank.git
(6)
(7)导入 project 时,选择 Import as general project
(8)再次修改 index.jsp 把 images/small_bank.png 改为 images/big_bank.png,add,commit,push,这次成功了。
3. 开始一个新 build (在 Master 机器上操作)
oc start-build mybank -e MAVEN_MIRROR_URL='http://192.168.56.1:8081/nexus/content/groups/public/'
4. 使用 Web Hook,每次代码修改提交后,自动开始一个新 build
Builds -> mybank,复制 Generic Webhook URL:
https://master.example.com:8443/oapi/v1/namespaces/applications/buildconfigs/mybank/webhooks/N04J1KQ2/generic
在 Registry 机器上操作
cd /opt/git/repo/mybank.git/hooks
cp post-update post-receive
vim post-receive
#!/bin/sh
curl -i -H "Accept: application/json" -H "X-HTTP-Method-Override: PUT" -X POST -k https://master.example.com:8443/oapi/v1/namespaces/applications/buildconfigs/mybank/webhooks/N04J1KQ2/generic
上面的 curl 有问题,应该使用下面这个 curl
curl -k -H 'Content-Type: application/json' -X POST https://master.example.com:8443/oapi/v1/namespaces/applications/buildconfigs/mybank/webhooks/kFwcxKcy/generic
修改 Builds -> mybank,Action -> Edit,增加环境变量:MAVEN_MIRROR_URL
修改代码,commit,push,发现自动启动了一个新 build。
1. 下载并安装 Eclipse
下载地址:https://www.eclipse.org/downloads/eclipse-packages/
介质:eclipse-jee-neon-1a-macosx-cocoa-x86_64.tar.gz
2. 导入一个 Git Project
(1)
(2)
(3)
(4)修改 index.jsp 把 images/small_bank.png 改为 images/big_bank.png,add,commit,push
发现有错误,push failed。
(5)改为使用 ssh 协议
ssh://root@git.example.com/opt/git/repo/mybank.git
(6)
(7)导入 project 时,选择 Import as general project
(8)再次修改 index.jsp 把 images/small_bank.png 改为 images/big_bank.png,add,commit,push,这次成功了。
3. 开始一个新 build (在 Master 机器上操作)
oc start-build mybank -e MAVEN_MIRROR_URL='http://192.168.56.1:8081/nexus/content/groups/public/'
4. 使用 Web Hook,每次代码修改提交后,自动开始一个新 build
Builds -> mybank,复制 Generic Webhook URL:
https://master.example.com:8443/oapi/v1/namespaces/applications/buildconfigs/mybank/webhooks/N04J1KQ2/generic
在 Registry 机器上操作
cd /opt/git/repo/mybank.git/hooks
cp post-update post-receive
vim post-receive
#!/bin/sh
curl -i -H "Accept: application/json" -H "X-HTTP-Method-Override: PUT" -X POST -k https://master.example.com:8443/oapi/v1/namespaces/applications/buildconfigs/mybank/webhooks/N04J1KQ2/generic
上面的 curl 有问题,应该使用下面这个 curl
curl -k -H 'Content-Type: application/json' -X POST https://master.example.com:8443/oapi/v1/namespaces/applications/buildconfigs/mybank/webhooks/kFwcxKcy/generic
修改 Builds -> mybank,Action -> Edit,增加环境变量:MAVEN_MIRROR_URL
修改代码,commit,push,发现自动启动了一个新 build。
没有评论:
发表评论