jobs-to-kas 1.2 KB

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