蠻簡單的先透過 svn server 的 hook 機制 (在某些時間點觸發一些 script)
觸發 Jenkins 來啟動專案 build
而 build 本身就是依賴 maven 或是 ant 等專案的設定來啟動
--- svn ---
1. svn commit
2. 透過 svn post-commit hook 觸發 Jenkins
3. Jenkins 透過 maven 啟動編譯或發佈等行為
SET CSCRIPT=%windir%\system32\cscript.exe SET VBSCRIPT=D:\Repositories\post-commit-hook-jenkins.vbs SET JENKINS=http://localhost:8080/jenkins/ SET REPOS=JENKINS_JOB_NAME "%CSCRIPT%" "%VBSCRIPT%" "%JENKINS%" "%REPOS%"---------
post-commit-hook-jenkins.vbs
jenkins = WScript.Arguments.Item(0) repos = WScript.Arguments.Item(1) url = jenkins + "job/" + repos + "/build?token=TOKEN" Set http = CreateObject("Microsoft.XMLHTTP") http.open "GET", url, False http.setRequestHeader "Content-Type", "text/plain;charset=UTF-8" http.send crumb = null if http.status = 200 then crumb = split(http.responseText,":") end if
--- maven ---
待續
沒有留言:
張貼留言