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