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¶
Chooses a container tag to label the image based on the ‘container-tag-method’ parameter. If container-tag-method: latest, the tag ‘latest’ is used. If container-tag-method: git-describe, the tag is obtained using the git describe command, which requires that the repository has a git tag. If container-tag-method: yaml-file, the tag is obtained using the yq command, which requires that the repository has a YAML file named ‘container-tag.yaml’. The script checks the docker-root directory by default or the directory specified by parameter container-tag-yaml-dir. An example file appears below.
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: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
recheck|reverify post a comment with one of the triggers to launch this job manually. Do not include any other text or vote in the same comment. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required parameters: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
Optional parameters: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
remerge post a comment with the trigger to launch this job manually. Do not include any other text or vote in the same comment. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required parameters: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Optional parameters: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sample container-tag.yaml File¶
---
tag: 1.0.0