.. literalinclude:: ../../.jjb-test/lf-ci-jobs/openstack-cron-full.yaml
+.. _gjjb-openstack-update-cloud-image:
+
+OpenStack Update Cloud Image
+----------------------------
+
+This job finds and updates OpenStack cloud images on the ci-management source
+repository.
+
+The job is triggered in two ways:
+
+1. When packer merge job completes, the new image name created is passed
+ down to the job.
+2. When the job is triggered manually to update all new images.
+
+When the job is triggered through an upstream packer merge job, this only
+generates a change request for the new image built.
+
+When the job is triggered manually, this job finds the latest images on
+OpenStack cloud and compares them with the images currently used in the source
+ci-management source repository. If the compared images have newer
+time stamps are **all** updated through a change request.
+
+This job requires a Jenkins configuration merge and verify job setup and
+working on Jenkins.
+
+:Template Names:
+ - {project-name}-openstack-update-cloud-image
+ - gerrit-openstack-update-cloud-image
+ - github-openstack-update-cloud-image
+
+:Required parameters:
+
+ :build-node: The node to run build on.
+ :jenkins-ssh-credential: Credential to use for SSH. (Generally should
+ be configured in defaults.yaml)
+ :new-image-name: Name of new image name passed from packer merge job or
+ set to 'all' to update all images. (default: all)
+
+: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: 90)
+ :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
+ :openstack-cloud: OS_CLOUD setting to pass to openstack client.
+ (default: vex)
+ :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)
+ :submodule-disable: Disable submodule checkout operation.
+ (default: false)
+ :update-cloud-image: Submit a change request to update new built cloud
+ image to Jenkins. (default: false)
+
+Minimal Example:
+
+.. literalinclude:: ../../.jjb-test/lf-ci-jobs/openstack-update-cloud-image-minimal.yaml
+
+Full Example:
+
+.. literalinclude:: ../../.jjb-test/lf-ci-jobs/openstack-update-cloud-image-full.yaml
+
.. _gjjb-packer-merge:
(default: false)
:gerrit_verify_triggers: Override Gerrit Triggers.
+ :update-cloud-image: Submit a change request to update new built cloud
+ image to Jenkins. (default: false)
+
Test an in-progress patch
^^^^^^^^^^^^^^^^^^^^^^^^^
:sonar-properties: Sonar configuration properties. (default: "")
:sonar-java-opts: JVM options. (default: "")
:sonar-additional-args: Additional command line arguments. (default: "")
+
+
+ Sonar with Prescan
+ ------------------
+
+ The same as the Sonar job above, except the caller also defines a builder
+ called ``lf-sonar-prescan``, in which they can put any builders that they want
+ to run prior to the Sonar scan.
+
+ .. code-block:: yaml
+
+ - builder:
+ name: lf-sonar-prescan
+ builders:
+ - shell: "# Pre-scan shell script"
+
+ :Template Names:
+
+ - {project-name}-sonar-prescan
+ - gerrit-sonar-prescan
+ - github-sonar-prescan
+
+ :Required Parameters:
+ :lf-sonar-prescan: A builder that will run prior to the Sonar scan.
+
+ :Optional Parameters:
+ :sonar-task: Sonar task to run. (default: "")
+ :sonar-properties: Sonar configuration properties. (default: "")
+ :sonar-java-opts: JVM options. (default: "")
+ :sonar-additional-args: Additional command line arguments. (default: "")
:platform: Build platform as found in the vars directory.
:template: Packer template to build as found in the templates directory.
+:Optional parameters:
+
+ :update-cloud-image: Submit a change request to update new built cloud
+ image to Jenkins.
+
lf-infra-packer-validate
------------------------
Retrieves system stats.
+lf-infra-update-packer-images
+-----------------------------
+
+Find and update the new built cloud image{s} in the ci-management source
+repository.
+
+
lf-jacoco-nojava-workaround
---------------------------
lf-rtd-verify
-------------
-ReadTheDocs verify script.
+ReadTheDocs verify script. Installs and runs tox.
+
+:Required parameters:
+
+ :doc-dir: Document directory.
+ :python-version: Python version.
check-info-votes
----------------
Requires ``SonarQube Scanner for Jenkins``
+ :Optional Parameters:
+ :sonar-task: Sonar task to run. (default: "")
+ :sonar-properties: Sonar configuration properties. (default: "")
+ :sonar-java-opts: JVM options. (default: "")
+ :sonar-additional-args: Additional command line arguments. (default: "")
+
+ lf-infra-sonar-with-prescan
+ ---------------------------
+
+ Runs Jenkins SonarQube plug-in after a pre-scan builder, which is defined by
+ the macro's caller.
+
+ Requires ``SonarQube Scanner for Jenkins``
+
+ :Required Parameters:
+ :lf-sonar-prescan: A builder that will run prior to the Sonar scan.
+
:Optional Parameters:
:sonar-task: Sonar task to run. (default: "")
:sonar-properties: Sonar configuration properties. (default: "")
openstack: true
openstack-cloud: vex
+ update-cloud-image: false
#####################
# Job Configuration #
branch: "{branch}"
- lf-packer-parameters:
packer-version: "{packer-version}"
+ - bool:
+ name: UPDATE_CLOUD_IMAGE
+ default: "{update-cloud-image}"
+ description: "Update new built image on the cloud."
builders:
- lf-infra-packer-build:
packer-version: "{packer-version}"
platform: "{platforms}"
template: "{templates}"
+ update-cloud-image: "{update-cloud-image}"
- description-setter:
regexp: '(\s+.*)(ZZCI\s+.*\d+-\d+\.\d+)'
description: 'Image: \2'
+ # - trigger-builds:
+ # - project: '{project-name}-openstack-update-cloud-image'
+ # block: false
+ # predefined-parameters: |
+ # GERRIT_BRANCH=$GERRIT_BRANCH
+ # GERRIT_PROJECT=$GERRIT_PROJECT
+ # GERRIT_REFSPEC=$GERRIT_REFSPEC
+ # NEW_IMAGE_NAME=$NEW_IMAGE_NAME
+ # property-file: variables.jenkins-trigger
+ # property-file-fail-on-missing: true
+
+ publishers:
+ - lf-infra-publish
+ - trigger-parameterized-builds:
+ - project: "{project-name}-openstack-update-cloud-image"
+ condition: UNSTABLE_OR_BETTER
+ predefined-parameters: |
+ NEW_IMAGE_NAME=$NEW_IMAGE_NAME
+ property-file: variables.jenkins-trigger
+ fail-on-missing: true
- job-template:
name: "{project-name}-packer-merge-{platforms}-{templates}"
white-list-target-branches:
- "{branch}"
+################################
+# Openstack Update Cloud Image #
+################################
+
+- lf_openstack_cron: &lf_openstack_update_cloud_image
+ name: lf-openstack-update-cloud-image
+
+ ######################
+ # Default parameters #
+ ######################
+
+ branch: master
+ build-days-to-keep: 7
+ build-timeout: 10
+ cron: "@monthly"
+ disable-job: false
+ git-url: "$GIT_URL/$PROJECT"
+ github-url: "https://github.com"
+ new-image-name: "all"
+ openstack-cloud: vex
+ stream: master
+ submodule-timeout: 10
+ submodule-disable: false
+ update-cloud-image: false
+
+ #####################
+ # Job Configuration #
+ #####################
+
+ project-type: freestyle
+ node: "{build-node}"
+ concurrent: false
+ disabled: "{disable-job}"
+
+ properties:
+ - lf-infra-properties:
+ build-days-to-keep: "{build-days-to-keep}"
+
+ parameters:
+ - lf-infra-parameters:
+ project: "{project}"
+ stream: "{stream}"
+ branch: "{branch}"
+ - string:
+ name: NEW_IMAGE_NAME
+ default: "{new-image-name}"
+ description: "Name of cloud image to update in Jenkins"
+
+ wrappers:
+ - lf-infra-wrappers:
+ build-timeout: "{build-timeout}"
+ jenkins-ssh-credential: "{jenkins-ssh-credential}"
+ # Listed after to override openstack-infra-wrappers clouds.yaml definition
+ - config-file-provider:
+ files:
+ - file-id: clouds-yaml
+ target: "$HOME/.config/openstack/clouds.yaml"
+ - file-id: npmrc
+ target: "$HOME/.npmrc"
+ - file-id: pipconf
+ target: "$HOME/.config/pip/pip.conf"
+
+ builders:
+ - lf-infra-pre-build
+ - inject:
+ properties-content: |
+ OS_CLOUD={openstack-cloud}
+ - shell: |
+ #!/bin/bash
+ echo "Extract the image type for commit message"
+ # echo IMAGE_TYPE=${{NEW_IMAGE_NAME% -*}} >> image-type.txt
+ IMAGE_TYPE=$(echo ${{NEW_IMAGE_NAME}} | tr -d "\'\"\ " | awk -F- '{{ print $2 " " $3 " " $4 }}')
+ echo IMAGE_TYPE=${{IMAGE_TYPE}} >> image-type.txt
+ cat image-type.txt
+ - inject:
+ properties-file: "image-type.txt"
+ - lf-infra-update-packer-images
+ - lf-infra-push-gerrit-patch:
+ project: "{project}"
+ gerrit-user: "{gerrit-user}"
+ gerrit-host: "{gerrit-host}"
+ gerrit-topic: "{gerrit-topic}"
+ gerrit-commit-message: "Update cloud image $IMAGE_TYPE"
+ reviewers-email: "{reviewers-email}"
+
+ publishers:
+ - lf-infra-publish
+
+- job-template:
+ name: "{project-name}-openstack-update-cloud-image"
+ id: gerrit-openstack-update-cloud-image
+ <<: *lf_openstack_update_cloud_image
+
+ ######################
+ # Default parameters #
+ ######################
+
+ git-url: "$GIT_URL/$GERRIT_PROJECT"
+
+ #####################
+ # Job Configuration #
+ #####################
+
+ scm:
+ - lf-infra-gerrit-scm:
+ git-url: "{git-url}"
+ refspec: "$GERRIT_REFSPEC"
+ branch: "$GERRIT_BRANCH"
+ submodule-recursive: false
+ submodule-timeout: "{submodule-timeout}"
+ submodule-disable: "{submodule-disable}"
+ choosing-strategy: gerrit
+ jenkins-ssh-credential: "{jenkins-ssh-credential}"
+
+ triggers:
+ - timed: "{obj:cron}"
+
#################
# Puppet Verify #
#################
default: "{archive-artifacts}"
description: Artifacts to archive to the logs server.
+ publishers:
+ - lf-infra-publish
+
+ - lf_sonar_builders: &lf_sonar_builders
+ name: lf-sonar-builders
builders:
- lf-infra-pre-build
- lf-infra-sonar:
sonar-java-opts: "{sonar-java-opts}"
sonar-additional-args: "{sonar-additional-args}"
- publishers:
- - lf-infra-publish
-
- - job-template:
- name: "{project-name}-sonar"
- id: gerrit-sonar
- <<: *lf_sonar_common
- # yamllint disable-line rule:key-duplicates
-
- ######################
- # Default parameters #
- ######################
+ - lf_sonar_builders_prescan: &lf_sonar_builders_prescan
+ name: lf-sonar-builders-prescan
+ builders:
+ - lf-infra-pre-build
+ - lf-infra-sonar-with-prescan:
+ sonar-task: "{sonar-task}"
+ sonar-properties: "{sonar-properties}"
+ sonar-java-opts: "{sonar-java-opts}"
+ sonar-additional-args: "{sonar-additional-args}"
+ - lf_sonar_gerrit_common: &lf_sonar_gerrit_common
+ name: lf-sonar-gerrit-common
gerrit_sonar_triggers:
- comment-added-contains-event:
comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
- #####################
- # Job Configuration #
- #####################
-
scm:
- lf-infra-gerrit-scm:
jenkins-ssh-credential: "{jenkins-ssh-credential}"
unstable: true
notbuilt: true
- - job-template:
- name: "{project-name}-sonar"
- id: github-sonar
- <<: *lf_sonar_common
- # yamllint disable-line rule:key-duplicates
-
+ - lf_sonar_github_common: &lf_sonar_github_common
+ name: lf-sonar-github-common
properties:
- lf-infra-properties:
build-days-to-keep: "{build-days-to-keep}"
white-list-target-branches:
- "{branch}"
included-regions: "{obj:github_included_regions}"
+
+ - job-template:
+ name: "{project-name}-sonar"
+ id: gerrit-sonar
+ <<: *lf_sonar_common
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_sonar_builders
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_sonar_gerrit_common
+
+ - job-template:
+ name: "{project-name}-sonar"
+ id: github-sonar
+ <<: *lf_sonar_common
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_sonar_builders
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_sonar_github_common
+
+ - job-template:
+ name: "{project-name}-sonar-prescan"
+ id: gerrit-sonar-prescan
+ <<: *lf_sonar_common
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_sonar_builders_prescan
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_sonar_gerrit_common
+
+ - job-template:
+ name: "{project-name}-sonar-prescan"
+ id: github-sonar-prescan
+ <<: *lf_sonar_common
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_sonar_builders_prescan
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_sonar_github_common
PACKER_PLATFORM={platform}
PACKER_TEMPLATE={template}
PACKER_VERSION={packer-version}
+ UPDATE_CLOUD_IMAGE={update-cloud-image}
- shell: !include-raw-escape:
- ../shell/packer-install.sh
- ../shell/packer-build.sh
- shell: !include-raw:
- ../shell/packer-clear-credentials.sh
+- builder:
+ name: lf-infra-update-packer-images
+ builders:
+ - shell: !include-raw: ../shell/update-cloud-images.sh
+
- builder:
name: lf-infra-push-gerrit-patch
builders:
name: lf-rtd-verify
builders:
- inject:
- properties-content: DOC_DIR={doc-dir}
+ properties-content: |
+ DOC_DIR={doc-dir}
+ PYTHON={python-version}
- shell: !include-raw-escape: ../shell/tox-install.sh
- shell: !include-raw-escape: ../shell/rtd-verify.sh
java-opts: "{sonar-java-opts}"
additional-arguments: "{sonar-additional-args}"
+ - builder:
+ name: lf-infra-sonar-with-prescan
+ # Run a Sonar Jenkins Plugin
+ builders:
+ - lf-sonar-prescan # Must be defined by caller
+ - sonar:
+ sonar-name: Sonar
+ scanner-name: SonarQubeScanner
+ task: "{sonar-task}"
+ project: "sonar-project.properties"
+ properties: "{sonar-properties}"
+ java-opts: "{sonar-java-opts}"
+ additional-arguments: "{sonar-additional-args}"
+
##############
# PARAMETERS #
##############