refactor: move LAVA job definition templates into independent files

This change introduces a new script function to expand the variables in
a file. With this, we can move the LAVA YAML job template descriptions,
which are currently embedded inside individual HEREDOCs, into their own
files.

Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: I09805ab4b6894a371e63a944d113ca2f475a806b
diff --git a/script/gen_juno_tftf_yaml.sh b/script/gen_juno_tftf_yaml.sh
index 2008028..24ac0a2 100755
--- a/script/gen_juno_tftf_yaml.sh
+++ b/script/gen_juno_tftf_yaml.sh
@@ -35,60 +35,4 @@
         tags=""
 fi
 
-cat <<EOF
-device_type: juno
-job_name: tf-juno
-
-$tags
-$juno_revision
-
-timeouts:
-  # Global timeout value for the whole job.
-  job:
-    minutes: 45
-  actions:
-    lava-test-monitor:
-      seconds: 120
-  connections:
-    lava-test-monitor:
-      seconds: 120
-
-priority: medium
-visibility: public
-
-actions:
-
-- deploy:
-    timeout:
-      minutes: 10
-    to: vemsd
-    recovery_image:
-      url: $recovery_img_url
-      compression: zip
-
-- boot:
-    method: minimal
-
-- test:
-    # Timeout for all the TFTF tests to complete.
-    timeout:
-      minutes: 30
-
-    monitors:
-    - name: TFTF
-      # LAVA looks for a testsuite start string...
-      start: 'Booting trusted firmware test framework'
-      # ...and a testsuite end string.
-      end: 'Exiting tests.'
-
-      # For each test case, LAVA looks for a string which includes the testcase
-      # name and result.
-      pattern: "(?s)> Executing '(?P<test_case_id>.+?(?='))'(.*)  TEST COMPLETE\\\s+(?P<result>(Skipped|Passed|Failed|Crashed))"
-
-      # Teach to LAVA how to interpret the TFTF Tests results.
-      fixupdict:
-        Passed: pass
-        Failed: fail
-        Crashed: fail
-        Skipped: skip
-EOF
+expand_template "$(dirname "$0")/lava-templates/juno-tftf.yaml"