used to push to Jenkins. In the event of a job failure this file can be
inspected.
+ .. _lf-global-jjb-jenkins-cfg-verify:
+
+Jenkins Configuration Verify
+----------------------------
+
+Jenkins job to verify the Global Jenkins configuration.
+
+Requires the ``clouds-yaml`` file to be setup on the Jenkins host.
+
+:Template names:
+
+ - {project-name}-jenkins-cfg-verify
+ - gerrit-jenkins-cfg-verify
+ - github-jenkins-cfg-verify
+
+:Optional parameters:
+
+ :branch: Git branch to build against. (default: master)
+ :git-url: URL to clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
+
+This job is not part of the "{project-name}-ci-jobs" group. It must be called
+explicitly.
+
+Example:
+
+.. literalinclude:: ../../.jjb-test/lf-ci-jobs/jenkins-cfg-verify.yaml
+ :language: yaml
Jenkins Sandbox Cleanup
-----------------------
white-list-target-branches:
- '{branch}'
+###########################################
+# Jenkins Configuration Management Verify #
+###########################################
+
+- lf_jenkins_configuration: &lf_jenkins_cfg_verify
+ name: lf-jenkins-cfg-verify
+
+ ######################
+ # Default parameters #
+ ######################
+
+ branch: master
+ build-days-to-keep: 7
+ disable-job: false
+ git-url: '$GIT_URL/$GERRIT_PROJECT'
+ github-url: 'https://github.com'
+ openstack-cloud: vex
+ submodule-timeout: 10
+
+ gerrit_verify_triggers:
+ - patchset-created-event:
+ exclude-drafts: true
+ exclude-trivial-rebase: false
+ exclude-no-code-change: false
+ - draft-published-event
+ - comment-added-contains-event:
+ comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
+
+ gerrit_trigger_file_paths:
+ - compare-type: REG_EXP
+ pattern: 'jenkins-config\/.*'
+
+ # github_included_regions MUST match gerrit_trigger_file_paths
+ github_included_regions:
+ - 'jenkins-config\/.*'
+
+ #####################
+ # Job Configuration #
+ #####################
+
+ project-type: freestyle
+ node: '{build-node}'
+ concurrent: true
+ disabled: '{disable-job}'
+
+ properties:
+ - lf-infra-properties:
+ project: '{project}'
+ build-days-to-keep: 1
+
+ parameters:
+ - lf-infra-parameters:
+ project: '{project}'
+ stream: ''
+ branch: master
+ lftools-version: '{lftools-version}'
+
+ wrappers:
+ - lf-infra-wrappers:
+ build-timeout: 10
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
+ - config-file-provider:
+ # Listed after to override openstack-infra-wrappers clouds.yaml
+ # definition
+ 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: !include-raw-escape: ../shell/jenkins-verify-images.sh
+
+ publishers:
+ - lf-infra-publish
+
+- job-template:
+ name: '{project-name}-jenkins-cfg-verify'
+ id: gerrit-jenkins-cfg-verify
+ <<: *lf_jenkins_cfg_verify
+
+ scm:
+ - lf-infra-gerrit-scm:
+ git-url: '{git-url}'
+ refspec: 'refs/heads/{branch}'
+ branch: '{branch}'
+ submodule-recursive: true
+ submodule-timeout: '{submodule-timeout}'
+ choosing-strategy: default
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+ triggers:
+ - gerrit:
+ server-name: '{gerrit-server-name}'
+ trigger-on: '{obj:gerrit_verify_triggers}'
+ projects:
+ - project-compare-type: ANT
+ project-pattern: '{project}'
+ branches:
+ - branch-compare-type: ANT
+ branch-pattern: '**/{branch}'
+ file-paths: '{obj:gerrit_trigger_file_paths}'
+
+- job-template:
+ name: '{project-name}-jenkins-cfg-verify'
+ id: github-jenkins-cfg-verify
+ <<: *lf_jenkins_cfg_verify
+
+ properties:
+ - github:
+ url: '{github-url}/{github-org}/{project}'
+
+ scm:
+ - lf-infra-github-scm:
+ url: '{git-clone-url}{github-org}/{project}'
+ refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
+ branch: '$sha1'
+ submodule-recursive: '{submodule-recursive}'
+ submodule-timeout: '{submodule-timeout}'
+ choosing-strategy: default
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+ triggers:
+ - github-pull-request:
+ trigger-phrase: '^(recheck|reverify)$'
+ only-trigger-phrase: false
+ status-context: 'Jenkins CFG Verify'
+ permit-all: true
+ github-hooks: true
+ included-regions: '{obj:github_included_regions}'
+ white-list-target-branches:
+ - '{branch}'
###########################
# JENKINS SANDBOX CLEANUP #
--- /dev/null
+#!/bin/bash -l
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2018 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+echo "---> jenkins-verify-images.sh"
+# Verifies that openstack contains an image for each config file defined in the
+# jenkins-config/clouds/openstack directory.
+
+error=false
+
+for file in jenkins-config/clouds/openstack/*/*; do
+ # Set the $IMAGE_NAME variable to the the file's IMAGE_NAME value
+ export "$(grep IMAGE_NAME $file)"
+ # The image should be listed as active
+ openstack image list --property name="$IMAGE_NAME" | grep "active"
+ if [ $? -ne 0 ]; then
+ echo "ERROR: No matching image found for $IMAGE_NAME"
+ error=true
+ fi
+done
+
+if [ "$error" = true ]; then
+ exit 1
+fi