Skip to content
Snippets Groups Projects
Commit e9e63019 authored by Chase Qi's avatar Chase Qi
Browse files

ci: use string @var@ instead of $var for lava job template


This helps to understand that the actual interpolation process cannot use
syntax like bash/sh. In addition, putting the @ sigil at both ends so that
@FOO_BAR is not incorrectly replaced as well.

Signed-off-by: default avatarChase Qi <chase.qi@linaro.org>
parent 4d4126d5
No related branches found
No related tags found
No related merge requests found
...@@ -40,12 +40,12 @@ ...@@ -40,12 +40,12 @@
# Get the job definition from remote source. # Get the job definition from remote source.
- curl --silent "$CI_LAVA_JOB_DEFINITION" > job_def.yaml - curl --silent "$CI_LAVA_JOB_DEFINITION" > job_def.yaml
# Update the job definition with CI data. # Update the job definition with CI data.
- sed -i -e 's/$ci_job_id/'"$CI_JOB_ID"'/' - sed -i -e 's/@ci_job_id@/'"$CI_JOB_ID"'/'
-e 's/$ci_project_id/'"$CI_PROJECT_ID"'/' -e 's/@ci_project_id@/'"$CI_PROJECT_ID"'/'
-e 's/$ci_pipeline_id/'"$CI_PIPELINE_ID"'/' -e 's/@ci_pipeline_id@/'"$CI_PIPELINE_ID"'/'
-e 's,$ci_pipeline_url,'"$CI_PIPELINE_URL"',' -e 's,@ci_pipeline_url@,'"$CI_PIPELINE_URL"','
-e 's/$build_job_id/'"$build_job_id"'/' -e 's/@build_job_id@/'"$build_job_id"'/'
-e 's,$callback_url,'"$CALLBACK_URL"',' job_def.yaml -e 's,@callback_url@,'"$CALLBACK_URL"',' job_def.yaml
# Generate test jobs. # Generate test jobs.
- | - |
set -x set -x
...@@ -55,14 +55,14 @@ ...@@ -55,14 +55,14 @@
for image in $(find artifacts/images/${MACHINE} -name "*.elf" -exec basename {} \;); do for image in $(find artifacts/images/${MACHINE} -name "*.elf" -exec basename {} \;); do
image_basename=$(basename "${image}" ".elf") image_basename=$(basename "${image}" ".elf")
echo "--- Generating lava job definition ${image_basename}.yaml ---" echo "--- Generating lava job definition ${image_basename}.yaml ---"
sed "s/\$image_basename/$image_basename/" job_def.yaml | tee lava_jobs/"${image_basename}".yaml sed "s/@image_basename@/$image_basename/" job_def.yaml | tee lava_jobs/"${image_basename}".yaml
done done
# Generate job definitions for linux LTP test. # Generate job definitions for linux LTP test.
elif grep -q "\$TST_CMDFILES" job_def.yaml; then elif grep -q "\$TST_CMDFILES" job_def.yaml; then
for test_cmdfile in ${LTP_TST_CMDFILES}; do for test_cmdfile in ${LTP_TST_CMDFILES}; do
ltp_job_name="ltp-${test_cmdfile}.yaml" ltp_job_name="ltp-${test_cmdfile}.yaml"
echo "--- Generating lava job definition ${ltp_job_name} ---" echo "--- Generating lava job definition ${ltp_job_name} ---"
sed "s/\$TST_CMDFILES/${test_cmdfile}/" job_def.yaml | tee lava_jobs/"${ltp_job_name}" sed "s/@TST_CMDFILES@/${test_cmdfile}/" job_def.yaml | tee lava_jobs/"${ltp_job_name}"
done done
else else
mv job_def.yaml lava_jobs/ mv job_def.yaml lava_jobs/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment