Global Settings


HOME: /var/jenkins_home

Workspace Root Directory: ${JENKINS_HOME}/workspace/${ITEM_FULLNAME}

Build Record Root Directory: ${ITEM_ROOTDIR}/builds

  1. Docker Builder

    Docker URL: docker server REST API URL, if jenkins is running in a docker container.

  2. Gerrit Trigger

    Hostname, Frontend URL, SSH Port, Username, SSH Keyfile(/var/jenkins_home/.ssh/id_rsa), SSH Keyfile Password


    REST API -  HTTP Username && HTTP Password
    Enable code review
    Enable Verified

Integrate With Gerrit


refs/for/<branch name>
git hook  commit-msg  Change-Id

command line: ssh -P -p 29418 jenkins@ gerrit
get git hook: scp -P 29418 jenkins@ ./

Gerrit settings

  • User settings

    1. Add user jenkins on Gerrit Code review

      Email Address == git config

    2. Add SSH Public Keys

    3. Generate HTTP Password for HTTP REST API

    4. Add jenkins to groups: Anonymous Users, Event Streaming Users, Non-Interactive Users

  • Project settings

    1. Create a new project. Rights inherit from All-Projects
    2. Require Change-Id in commit message TRUE or FALSE if necessary
  • Project Access settings

    1. Global Capabilities

      Stream Events: ALLOW - Event Streaming Users

      Stream Events: ALLOW - Non-Interactive Users

    2. Reference: refs/*

      Read: ALLOW - Non-Interactive Users

      Label Verified: +1/-1 - Non-Interactive Users

    3. Reference: refs/heads/*

      Push: ALLOW - Non-Interactive Users

      Label Code-Review: +1/-1 - Non-Interactive Users

      Label Verified: +1/-1 - Non-Interactive Users

      • Add Label Verified to All-Project
      git init project
      git config 'admin'
      git config ''
      git remote add origin ssh://admin@
      git pull origin refs/meta/config
      cat << EOF >> project.config
      [label "Verified"]
      function = MaxWithBlock
      value = -1 Fails
      value =  0 No score
      value = +1 Verified
      git add project.config
      git commit -a -m 'add Label Verified to All-Project'
      git push origin HEAD:refs/meta/config

Jenkins Job

Auto Verify

  1. Source Code Management

    git repository: ssh://jenkins@

    Credentials: passwords/ssh key

    Name: gerrit

    Refspec: $GERRIT_REFSPEC

    Branches to build: $GERRIT_BRANCH

    Additional Behaviours

    • Strategy for choosing what to build - Gerrit Trigger
    • Clean before checkout
  2. Build Triggers - Gerrit event

    Choose a server Trigger on

    • Patchset Created
    • Draft Published

    Gerrit Project

    • Type - Plain

    • Pattern - esTookit

    • Branches

      • Type - Path
      • Pattern - **
  3. Build

    Use Execute shell to load extern scripts.

    Perform build & test

  4. Project will be automately checked with Label Verified if build succeed. So, no Post-build actions to perform.

Auto Publish

  1. Gerrit Trigger

    Trigger on - Change Merged

  2. Publish to Cloud Foundry

    Post-build Actions

    Target, Credentials, Space, Allow self-signed certificate Reset app if already exists Read configuration from a manifest file / Enter configuration in Jenkins

Tips && Suggestions

  1. Parameterize Jenkins jobs
  2. Destruct complex Jenkins jobs