940 likes | 1.16k Views
Continuous Deployment with Gerrit and Jenkins. R. Tyler Croy Lookout, Inc. http://mylookout.com/about/jobs. Who is this guy?. I work here. Brief overview of Continuous Deployment Meet Gerrit A Basic Commit-to-Deploy Pipeline Multiple branches with Gerrit + Jenkins The Human Factor
E N D
Continuous Deployment with Gerrit and Jenkins R. Tyler Croy Lookout, Inc. http://mylookout.com/about/jobs
Brief overview of Continuous Deployment Meet Gerrit A Basic Commit-to-Deploy Pipeline Multiple branches with Gerrit + Jenkins The Human Factor Pro-tips/best practices
As a Git repository server ~ % git checkout -b change-4 Switched to a new branch 'change-4' ~ % git fetch gerrit refs/changes/04/4/1 From gerrit:ttyclock * branch refs/changes/04/4/1 -> FETCH_HEAD ~ % git cherry-pick FETCH_HEAD Finished one cherry-pick. [change-4 1d4351c] Greatly improve the stability of tty-clock 1 files changed, 3 insertions(+), 0 deletions(-) ~ %
Changes in Gerrit Change 123 Patchset 1 Commit cdeb34 Patchset 2 Commit 41dbe5
Changes in Gerrit Change 123 Patchset 1 Commit cdeb34 Patchset 2 Commit 41dbe5
The Gerrit Flow gerrit upstream dev-b dev-a
Flow of changes Create Local Branch % git checkout -b topic-branch work Push to Gerrit % git push gerrit HEAD:refs/for/master
Flow of changes Create Local Branch % git checkout -b topic-branch work Push to Gerrit % git push gerrit HEAD:refs/for/master
Flow of changes Create Local Branch Fix commit work rejected rebased! Review Push to Gerrit Upstream repo approved/ submitted
Flow of changes Create Local Branch Fix commit work rejected rebased! Review Push to Gerrit Upstream repo approved/ submitted
Your development workflow in commands git checkout -b local-topic-branch work work work git rebase -i upstream/master # fix up commits git push gerrit HEAD:refs/for/master Create new commits based on reviews git rebase -i upstream/master # squash up git push gerrit HEAD:refs/for/master
REBASE IS SCARY (but necessary)
How it works upstream/master A B C % git rebase upstream/master local-topic-branch A B D E
How it works upstream/master A B C local-topic-branch A B C D E
How it works upstream/master A B C % git rebase -i upstream/master local-topic-branch A B C D E Change-Id: Icde43 Change-Id: I51bdc2
~ % git rebase -i origin/master pick e59df21 Greatly improve the stability of tty-clock squash 6c1ffe1 Fix some whitespace [detached HEAD 785692b] Greatly improve the stability of tty-clock 1 files changed, 2 insertions(+), 0 deletions(-) Successfully rebased and updated refs/heads/change-4. ~ %
How it works upstream/master A B C local-topic-branch A B C DE Change-Id: Icde43
How it works upstream/master A B C local-topic-branch A B C DE Change-Id: Icde43
Creating a role account ~ % ssh gerrit gerrit create-account
gerrit Jenkins Commands sent over SSH Streamed events over SSH