Docker Jobs

Job Groups

Job groups are a great tool to configure categories of jobs together at the same time. Below the example are some starting point job-groups but we recommend creating your own to ensure that the jobs configured reflect the project’s needs.

An example project:

- job-group:
    name: odl-maven-jobs

    jobs:
      - gerrit-maven-clm
      - gerrit-maven-merge
      - gerrit-maven-release
      - gerrit-maven-verify
      - gerrit-maven-verify-dependencies:
          build-timeout: 180

    mvn-version: mvn35

- project:
    name: aaa
    jobs:
      - odl-maven-jobs

In this example we are using the job-group to assign a list of common jobs to the aaa project. The job-group also hardcodes mvn-version to mvn35 and build-timeout to 180 for all projects using this job-group.

A benefit of this method is for example disabling entire category of jobs by modifying the job-group, insert disable-job: true parameter against the jobs to disable.

Below is a list of Docker job groups:

---
- job-group:
    name: '{project-name}-gerrit-docker-jobs'

    # This job group contains all the recommended jobs that should be deployed
    # for any docker project ci.

    jobs:
      - gerrit-docker-verify
      - gerrit-docker-merge

- job-group:
    name: '{project-name}-github-docker-jobs'

    # This job group contains all the recommended jobs that should be deployed
    # for any docker project ci.

    jobs:
      - github-docker-verify
      - github-docker-merge

Macros

lf-docker-get-container-tag

Calls docker-get-git-describe.sh or docker-get-yaml-tag.sh (depending on the ‘docker-use-params-from’ condition) to obtain the tag to build.

lf-docker-build

Calls docker build to build the container.

lf-docker-push

Calls docker-push.sh script to push docker images.

Job Templates

Docker Verify

Executes a docker build task.

Template Names:
  • {project-name}-docker-verify-{stream}
  • gerrit-docker-verify
  • github-docker-verify
Comment Trigger:
 

recheck|reverify

Required parameters:
 
build-node:The node to run build on.
container-public-registry:
 Docker registry source with base images.
docker-name:Name of the Docker image.
docker-use-params-from:
 Used to select the source of the tag information. Options are “git-describe-params” or “yaml-file-params”. (yaml-file-params expects the tag to be defined in a local file “container-tag.yaml”).
jenkins-ssh-credential:
 Credential to use for SSH. (Generally should be configured in defaults.yaml)
mvn-settings:Maven settings.xml file containing credentials to use.
Optional parameters:
 
branch:Git branch to fetch for the build. (default: master)
build-days-to-keep:
 Days to keep build logs in Jenkins. (default: 7)
build-timeout:Timeout in minutes before aborting build. (default: 60)
docker-build-args:
 Additional arguments for the docker build command.
docker-root:Path of the Dockerfile within the repo.
git-url:URL clone project from. (default: $GIT_URL/$PROJECT)
pre_docker_build_script:
 Optional build script to execute before the main verify builder steps.
post_docker_build_script:
 Optional build script to execute after the main verify builder steps.
stream:Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master)
submodule-recursive:
 Whether to checkout submodules recursively. (default: true)
submodule-timeout:
 Timeout (in minutes) for checkout operation. (default: 10)
gerrit_verify_triggers:
 Override Gerrit Triggers.
gerrit_trigger_file_paths:
 Override Gerrit file paths which can be used to filter which file modifications will trigger a build.
github_included_regions:
 Override Github file paths which can be used to filter which file modifications will trigger a build; must match parameter gerrit_trigger_file_paths

container-tag.yaml example:

---
tag: 1.0.0

Docker Merge

Executes a docker build task and publishes the resulting images to a specified Docker registry.

Template Names:
  • {project-name}-docker-merge-{stream}
  • gerrit-docker-merge
  • github-docker-merge
Comment Trigger:
 

remerge

Required parameters:
 
build-node:The node to run build on.
container-public-registry:
 Docker registry source with base images.
container-push-registry:
 Docker registry target for the deploy action.
docker-name:Name of the Docker image.
docker-use-params-from:
 Used to select the source of the tag information. Options are “git-describe-params” or “yaml-file-params”. (yaml-file-params expects the tag to be defined in a local file “container-tag.yaml”).
jenkins-ssh-credential:
 Credential to use for SSH. (Generally should be configured in defaults.yaml)
mvn-settings:Maven settings.xml file containing credentials to use.
Optional parameters:
 
branch:Git branch to fetch for the build. (default: master)
build-days-to-keep:
 Days to keep build logs in Jenkins. (default: 7)
build-timeout:Timeout in minutes before aborting build. (default: 60)
docker-build-args:
 Additional arguments for the docker build command.
docker-root:Path of the Dockerfile within the repo.
git-url:URL clone project from. (default: $GIT_URL/$PROJECT)
pre_docker_build_script:
 Optional build script to execute before the main merge builder steps.
post_docker_build_script:
 Optional build script to execute after the main merge builder steps.
stream:Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master)
submodule-recursive:
 Whether to checkout submodules recursively. (default: true)
submodule-timeout:
 Timeout (in minutes) for checkout operation. (default: 10)
gerrit_merge_triggers:
 Override Gerrit Triggers.
gerrit_trigger_file_paths:
 Override Gerrit file paths which can be used to filter which file modifications will trigger a build.
github_included_regions:
 Override Github file paths which can be used to filter which file modifications will trigger a build; must match parameter gerrit_trigger_file_paths

container-tag.yaml example:

---
tag: 1.0.0