Created by Chu-Siang Lai / @chusiang
$ git clone ssh://jonny@192.168.33.25:29418/demo
$ echo 'Hell o World' > readme.rst
$ git add re adme.rst
$ git commit -m "first commit."
git push ?
Gerrit 預設不允許直接對分支 (branch) push,需對 refs/for/<branch-name> 特殊引用 push 才可將提交納入審查系統。
HEAD:refs/for/master
的 branch 以外,還需在 commit 裡補上 Change-Id
。
$ git push origin HEAD:refs/for/master
Counting objects: 4, done.
Writing objects: 100% (3/3), 252 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done
remote: ERROR: missing Change-Id in commit message footer
remote: Suggestion for commit message:
remote: first commit.
remote:
remote: Change-Id: I9001c46e4afae9f3e0021f7aba6608dccf05295e
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 jonny@192.168.33.25:hooks/commit-msg ${gitdir}/hooks/
remote:
remote:
To ssh://jonny@192.168.33.25:29418/demo
! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit message footer)
error: failed to push some refs to 'ssh://jonny@192.168.33.25:29418/demo'
$ git commit --amend
...
Change-Id: I9001c46e4afae9f3e0021f7aba6608dccf05295e
$ git push origin HEAD:refs/for/master
Counting objects: 4, done.
Writing objects: 100% (3/3), 295 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Processing changes: new: 1, refs: 1, done
remote:
remote: New Changes:
remote: http://192.168.33.25/13
remote:
To ssh://jonny@192.168.33.25:29418/demo
* [new branch] HEAD -> refs/for/master
※ 可搭配 git-review 簡化 git push,但需先行設定相關參數。
push code 以後除了 Reviewer 人工審核外,也可搭配 jenkins 進行自動測試 (請搭配 流程圖 理解觀念)。
※ 由於在下還不會撰寫測試 code,故此 Demo 為手動 Verified。
※ 由於 Jenkins 還未建置完,故只 Demo 部份功能。
S: 上次建置狀態,
W: 建置成功率。
jenkins@gerrit has posted comments on this change.
Change subject: first commit.
......................................................................
Patch Set 1: Verified+1
manual verified by jenkins user.
--
To view, visit http://192.168.33.25/13
To unsubscribe, visit http://192.168.33.25/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9001c46e4afae9f3e0021f7aba6608dccf05295e
Gerrit-PatchSet: 1
Gerrit-Project: demo
Gerrit-Branch: master
Gerrit-Owner: Chu-Siang lai <chusiang.lai (dot) gmail.com>
Gerrit-Reviewer: Chu-Siang lai <chusiang.lai (dot) gmail.com>
Gerrit-Reviewer: jenkins@gerrit
Gerrit-HasComments: No
jenkins@gerrit has posted comments on this change.
Change subject: testing
......................................................................
Patch Set 1:
Build Started http://192.168.33.25:8080/job/sandbox/18/
jenkins@gerrit has posted comments on this change.
Change subject: testing
......................................................................
Patch Set 1:
Build Failed
http://192.168.33.25:8080/job/sandbox/18/ : FAILURE
查看 <http://192.168.33.25:8080/job/sandbox/18/>
------------------------------------------
Triggered by Gerrit: http://192.168.33.25/12
建置中 工作區 <http://192.168.33.25:8080/job/sandbox/ws/>
Fetching changes from the remote Git repository
Fetching upstream changes from ssh://jenkins@192.168.33.25:29418/sandbox.git
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.