Install

global-jjb requires configuration in 2 places; Jenkins and the ci-management repository.

Jenkins configuration

On the Jenkins side, we need to prep environment variables and plugins required by the jobs in global-jjb before we can start our first jobs.

Install Jenkins plugins

Install the following required Jenkins plugins and any optional ones as necessary by the project.

Required

Required for Gerrit connected systems

Required for GitHub connected systems

Optional

Environment Variables

The Jenkins Configuration Merge job can manage environment variables job but we must first bootstrap them in Jenkins so that the job can run and take over.

Required:

GIT_URL=ssh://jenkins-$SILO@git.opendaylight.org:29418
JENKINS_HOSTNAME=jenkins092
NEXUS_URL=https://nexus.opendaylight.org
SILO=production
SONAR_URL=https://sonar.opendaylight.org

Gerrit:

GERRIT_URL=https://git.opendaylight.org/gerrit

GitHub:

GIT_URL=https://github.com
GIT_CLONE_URL=git@github.com:

Note

Use GIT_CLONE_URL for GitHub projects as this will be different from the URL used in the properties configuration.

Optional:

LOGS_SERVER=https://logs.opendaylight.org

Steps

  1. Navigate to https://jenkins.example.org/configure

  2. Configure the environment variables as described above

  3. Configure the same environment variables in the ci-management repo

ci-management

ci-management is a git repository containing JJB configuration files for Jenkins Jobs. Deploying Global JJB here as a submodule allows us easy management to install, upgrade, and rollback changes via git tags. Install Global JJB as follows:

  1. Install Global JJB

    GLOBAL_JJB_VERSION=v0.1.0
    git submodule add https://github.com/lfit/releng-global-jjb.git global-jjb
    cd global-jjb
    git checkout $GLOBAL_JJB_VERSION
    cd ..
    
    # Setup symlinks
    mkdir -p jjb/global-jjb
    ln -s ../../global-jjb/jenkins-init-scripts jjb/global-jjb/jenkins-init-scripts
    ln -s ../../global-jjb/shell jjb/global-jjb/shell
    ln -s ../../global-jjb/jjb jjb/global-jjb/jjb
    git add jjb/global-jjb
    
    git commit -sm "Install global-jjb $GLOBAL_JJB_VERSION"
    

    Note

    We are purposely using github for production deploys of global-jjb so that uptime of LF Gerrit does not affect projects using global-jjb. In a test environment we can use https://gerrit.linuxfoundation.org/infra/releng/global-jjb if desired.

  2. Setup jjb/defaults.yaml

    Create and configure the following parameters in the jjb/defaults.yaml file as described in the defaults.yaml configuration docs <defaults-yaml>.

    Once configured commit the modifications:

    git add jjb/defaults.yaml
    git commit -sm "Setup defaults.yaml"
    
  3. Push patches to Gerrit / GitHub using your favourite push method

At this point global-jjb installation is complete in the ci-management repo and is ready for use.

Deploy ci-jobs

The CI job group contains jobs that should deploy in all LF Jenkins infra. The minimal configuration to deploy the {project-name}-ci-jobs job group as defined in lf-ci-jobs.yaml is as follows:

jjb/ci-management/ci-management.yaml:

- project:
    name: ci-jobs

    jobs:
      - '{project-name}-ci-jobs'

    project: ci-management
    project-name: ci-management
    build-node: centos7-builder-2c-1g

Required parameters:

project:

The project repo as defined in source control.

project-name:

A custom name to call the job in Jenkins.

build-node:

The name of the builder to use when building (Jenkins label).

Optional parameters:

branch:

The git branch to build from. (default: master)

jjb-version:

The version of JJB to install in the build minion. (default: <defined by the global-jjb project>)

Deploy packer-jobs

The packer job group contains jobs to build custom minion images. The minimal configuration needed to deploy the packer jobs is as follows which deploys the {project-name}-packer-jobs job group as defined in lf-ci-jobs.yaml.

jjb/ci-management/packer.yaml:

- project:
    name: packer-builder-jobs

    jobs:
      - '{project-name}-packer-jobs'

    project: ci-management
    project-name: ci-management
    branch: master
    build-node: centos7-builder-2c-1g

    platforms:
      - centos
      - ubuntu-16.04

    templates: builder

- project:
    name: packer-docker-jobs

    jobs:
      - '{project-name}-packer-jobs'

    project: ci-management
    project-name: ci-management
    branch: master
    build-node: centos7-builder-2c-1g

    templates: docker

    platforms:
      - centos
      - ubuntu-16.04

Required parameters:

project:

The project repo as defined in source control.

project-name:

A custom name to call the job in Jenkins.

build-node:

The name of the builder to use when building (Jenkins label).

platforms:

A list of supported platforms.

templates:

A list of templates to build. We recommend setting one template per project section so that we can control which platforms to build for specific templates.

Optional parameters:

branch:

The git branch to build from. (default: master)

packer-version:

The version of packer to install in the build minion, when packer is not available. (default: <defined by global-jjb>)