2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> jenkins-verify-images.sh"
12 # Verifies that openstack contains an image for each config file defined in the
13 # jenkins-config/clouds/openstack directory.
21 echo "Verifying images on $1"
22 for file in "$1"/*; do
23 # Set the $IMAGE_NAME variable to the the file's IMAGE_NAME value
24 export "$(grep ^IMAGE_NAME= "$file")"
25 # The image should be listed as active
27 if ! openstack image list --property name="$IMAGE_NAME" | grep "active"; then
28 echo "ERROR: No matching image found for $IMAGE_NAME"
31 # Set the $HARDWARE_ID variable to the the file's HARDWARE_ID value
32 export "$(grep ^HARDWARE_ID= "$file")"
33 # The flavor should be listed. Spaces in grep string ensure complete match.
35 if ! openstack flavor list | grep " $HARDWARE_ID "; then
36 echo "ERROR: No matching flavor found for $HARDWARE_ID"
42 for cloud in jenkins-config/clouds/openstack/*; do
43 echo "Verifying that cloud has a master configuration file"
44 # Verify that we have a cloud config file
45 if [ -f "$cloud/cloud.cfg" ]; then
46 # Get the OS_CLOUD variable from cloud config and export it
47 os_cloud=$(grep ^OS_CLOUD= "$cloud/cloud.cfg" | cut -d'=' -f2)
48 OS_CLOUD="${os_cloud:-vex}"
51 verify_images "$cloud"
53 echo "ERROR: No cloud.cfg for $cloud"