From: Eric Ball Date: Thu, 31 Jan 2019 23:18:21 +0000 (-0800) Subject: Verify build node HARDWARE_ID X-Git-Tag: v0.30.0~1 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;ds=inline;h=28ea3ab0bd1aca3d00cf5428bd805481e137f0c8;hp=-c;p=releng%2Fglobal-jjb.git Verify build node HARDWARE_ID This script already checks each file's IMAGE_NAME for validity; this adds essentially the same validation to check the HARDWARD_ID. Also add the job to the ci-jobs groups, and set submodule-recursive value for github-jenkins-cfg-verify. Issue: RELENG-1418 Change-Id: I0266a0fcc276b2960c9c1749a89bc70e8115d152 Signed-off-by: Eric Ball --- 28ea3ab0bd1aca3d00cf5428bd805481e137f0c8 diff --git a/jjb/lf-ci-job-groups.yaml b/jjb/lf-ci-job-groups.yaml index 2dcff4cf..6dc377f3 100644 --- a/jjb/lf-ci-job-groups.yaml +++ b/jjb/lf-ci-job-groups.yaml @@ -4,6 +4,7 @@ jobs: - gerrit-jenkins-cfg-merge + - gerrit-jenkins-cfg-verify - gerrit-jenkins-sandbox-cleanup - gerrit-jjb-deploy-job - gerrit-jjb-merge @@ -14,6 +15,7 @@ jobs: - github-jenkins-cfg-merge + - github-jenkins-cfg-verify - github-jenkins-sandbox-cleanup - github-jjb-deploy-job - github-jjb-merge diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 1a799c68..bdcd65ef 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -506,7 +506,7 @@ url: '{git-clone-url}{github-org}/{project}' refspec: '+refs/pull/*:refs/remotes/origin/pr/*' branch: '$sha1' - submodule-recursive: '{submodule-recursive}' + submodule-recursive: true submodule-timeout: '{submodule-timeout}' choosing-strategy: default jenkins-ssh-credential: '{jenkins-ssh-credential}' diff --git a/shell/jenkins-verify-images.sh b/shell/jenkins-verify-images.sh index aed8d12f..c97f0630 100755 --- a/shell/jenkins-verify-images.sh +++ b/shell/jenkins-verify-images.sh @@ -12,19 +12,29 @@ echo "---> jenkins-verify-images.sh" # Verifies that openstack contains an image for each config file defined in the # jenkins-config/clouds/openstack directory. +set -eux -o pipefail + 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)" + 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 + + if ! openstack image list --property name="$IMAGE_NAME" | grep "active"; then echo "ERROR: No matching image found for $IMAGE_NAME" error=true fi + # Set the $HARDWARE_ID variable to the the file's HARDWARE_ID value + export "$(grep ^HARDWARE_ID= $file)" + # The flavor should be listed. Spaces in grep string ensure complete match. + + if ! openstack flavor list | grep " $HARDWARE_ID "; then + echo "ERROR: No matching flavor found for $HARDWARE_ID" + error=true + fi done -if [ "$error" = true ]; then +if $error; then exit 1 fi