Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 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: |
Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 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. |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 13 | # |
| 14 | # Turn this list into a series of yml files separated by colons to pass to kas |
| 15 | |
| 16 | set -e -u |
| 17 | |
Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 18 | # First, parse the GitLab CI job name (CI_JOB_NAME via $1) and accumulate a list |
| 19 | # of Kas files. |
| 20 | JOBNAME="$1" |
| 21 | shift |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 22 | |
Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 23 | # The base name of the job |
| 24 | FILES="ci/$(echo $JOBNAME | cut -d ':' -f 1).yml" |
| 25 | |
| 26 | # The list of matrix variations |
| 27 | for i in $(echo $JOBNAME | cut -s -d ':' -f 2 | sed 's/[][,]//g'); do |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 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. |
Andrew Geissler | 2daf84b | 2023-03-31 09:57:23 -0500 | [diff] [blame] | 32 | if [[ $i == 'none' ]]; then |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 33 | continue |
| 34 | fi |
| 35 | FILES+=":ci/$i.yml" |
| 36 | done |
| 37 | |
Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 38 | # Now pick up any further names |
| 39 | for i in $*; do |
| 40 | FILES+=":ci/$i.yml" |
| 41 | done |
| 42 | |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 43 | echo $FILES |