cloudbees/gerrit-workflow-demo

Name: gerrit-workflow-demo

Owner: CloudBees

Description: Demo of dockerized gerrit/jenkins workflow functionality

Created: 2015-09-25 21:17:44.0

Updated: 2018-05-18 13:27:40.0

Pushed: 2017-05-16 18:14:49.0

Homepage: null

Size: 82

Language: Groovy

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

gerrit-workflow-demo

Demo of Dockerized gerrit/jenkins workflow functionality

What?

Why?

This comprises 3 parts:

In fitting with Docker best practices, this is split into two Docker containers:

Setup

168.99.100     gerrit
168.99.100     jenkins

To run:

Using it:

By default, this will use your git name & email, set the gerrit username as local username, and your HTTP gerrit password as 'goober' (and add your local SSH public RSA key). You can always set this up manually and change it from the gerrit interface.

Sample project

Creating commits and pushing to gerrit directly

  1. You must have a gerrit user configured (see “using it”)
  2. Git clone repositories (replace 'gerrit' with localhost if using native Docker)
  3. http://gerrit:8080/primary
  4. http://gerrit:8080/secondary
  5. Go into each repository and do the following to install Gerrit hooks:
  6. Linux: curl -Lo .git/hooks/commit-msg http://localhost:8080/tools/hooks/commit-msg && chmod u+x .git/hooks/commit-msg
  7. Mac: curl -Lo .git/hooks/commit-msg http://gerrit:8080/tools/hooks/commit-msg && chmod u+x .git/hooks/commit-msg
  8. Create a test commit
  9. echo 'blahblahblah' > newfile.txt && git add newfile.txt
  10. git commit -a -m "Test"
  11. Push by SSH
  12. Linux: git push ssh://$USER@localhost:29418/primary HEAD:refs/for/master
  13. Mac: git push ssh://$USER@gerrit:29418/primary HEAD:refs/for/master
  14. You should see new changes for review in Gerrit… and responses back from Jenkins after running 'wf-build'

Creating and uploading changes by repo

  1. You must have a gerrit user configured (see “using it”) and repo installed
  2. Pull down the project structure via repo (must be installed, see prerequisites)
  3. Linux, native docker: repo init -u http://localhost:8080/umbrella && repo sync
  4. Mac or linux with hosts entry: repo init -u http://gerrit:8080/umbrella -m jenkins.xml && repo sync
  5. Start a new working branch in repo
  6. repo start feature-testing --all
  7. Push back changes for review:
  8. repo upload
  9. You should see changes ready for review, and Jenkins test results from 'wf-build'
  10. Feel free to go back to the master branch:
  11. repo sync -d

To stop:

Troubleshooting

  1. Verifying Gerrit access by SSH for jenkins
  2. go to the gerrit-workflow-demo/jenkins
  3. run the following:
  4. Linux: ssh -i demo_key_rsa -p 29418 demouser@localhost
  5. Mac: ssh -i demo_key_rsa -p 29418 demouser@gerrit
  6. you should see the following:
    r passphrase for key 'demo_key_rsa': 
    
        Welcome to Gerrit Code Review    ****
    
    emouser, you have successfully connected over SSH.
    
    rtunately, interactive shells are disabled.
    lone a hosted Git repository, use:
    
    clone ssh://demouser@gerrit:29418/REPOSITORY_NAME.git
    

Connection to localhost closed.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.