1#! /bin/bash 2 3# This script is expecting an input of machine name, optionally followed by a 4# colon and a list of one or more parameters separated by commas between 5# brackets. For example, the following are acceptable: 6# corstone1000-mps3 7# fvp-base: [testimage] 8# qemuarm64-secureboot: [clang, glibc, testimage] 9# This argument should be quoted to avoid expansion and to be handled 10# as a single value. 11# 12# Any further arguments will be handled as further yml file basenames. 13# 14# Turn this list into a series of yml files separated by colons to pass to kas 15 16set -e -u 17 18# First, parse the GitLab CI job name (CI_JOB_NAME via $1) and accumulate a list 19# of Kas files. 20JOBNAME="$1" 21shift 22 23# The base name of the job 24FILES="ci/$(echo $JOBNAME | cut -d ':' -f 1).yml" 25 26# The list of matrix variations 27for i in $(echo $JOBNAME | cut -s -d ':' -f 2 | sed 's/[][,]//g'); do 28 # Given that there are no yml files for gcc or glibc, as those are the 29 # defaults, we can simply ignore those parameters. They are necessary 30 # to pass in so that matrix can correctly setup all of the permutations 31 # of each individual run. 32 if [[ $i == 'none' ]]; then 33 continue 34 fi 35 FILES+=":ci/$i.yml" 36done 37 38# Now pick up any further names 39for i in $*; do 40 FILES+=":ci/$i.yml" 41done 42 43echo $FILES 44