Skip to content

Commit a5b5e46

Browse files
committed
Use BUILD_ID environment variable for global unique ID
Signed-off-by: Matt Hart <[email protected]>
1 parent ee77ec8 commit a5b5e46

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

.github/workflows/debos.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ defaults:
2525

2626
env:
2727
FILESERVER_URL: https://quic-yocto-fileserver-1029608027416.us-central1.run.app
28+
# github runs are only unique per repository and may also be re-run;
29+
# create an unique id with repository, run id, and run attempt
30+
BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
2831

2932
# cancel in progress builds for this workflow triggered by the same ref
3033
concurrency:
@@ -80,11 +83,8 @@ jobs:
8083
# curl will be used to talk to fileserver; should be installed by
8184
# default
8285
apt -y install curl
83-
# github runs are only unique per repository and may also be re-run;
84-
# create an unique id with repository, run id, and run attempt
85-
id="${GITHUB_REPOSITORY}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
8686
# create a directory for the current run
87-
dir="/fileserver-builds/${id}"
87+
dir="/fileserver-builds/${BUILD_ID}"
8888
mkdir -vp "${dir}"
8989
# copy output files
9090
cp -av rootfs.tar.gz "${dir}"
@@ -93,20 +93,21 @@ jobs:
9393
cp -av disk-sdcard.img.gz "${dir}"
9494
tar -cvf "${dir}"/flash.tar.gz disk-ufs.img1 disk-ufs.img2 flash_*
9595
# instruct fileserver to publish this directory
96-
url="${FILESERVER_URL}/${id}/"
96+
url="${FILESERVER_URL}/${BUILD_ID}/"
9797
curl -X POST -H 'Accept: text/event-stream' "${url}"
98+
9899
- name: Prepare LAVA test job
99100
run: |
100-
id="${GITHUB_REPOSITORY}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
101-
url="${FILESERVER_URL}/${id}/"
101+
set -x
102+
url="${FILESERVER_URL}/${BUILD_ID}/"
102103
BUILD_FILE_NAME=flash.tar.gz
103104
BUILD_DOWNLOAD_URL="${url}${BUILD_FILE_NAME}"
104105
LAVA_JOB_FILE="../ci/lava/rb3gen2-vision-kit-boot.yaml"
105106
106-
sed -i "s|{{BUILD_FILE_NAME}}|${BUILD_FILE_NAME}|g" ${LAVA_JOB_FILE}
107-
sed -i "s|{{BUILD_DOWNLOAD_URL}}|${BUILD_DOWNLOAD_URL}|g" ${LAVA_JOB_FILE}
108-
sed -i "s|{{GITHUB_SHA}}|${GITHUB_SHA}|g" ${LAVA_JOB_FILE}
109-
sed -i "s|{{GITHUB_RUN_ID}}|${GITHUB_RUN_ID}|g" ${LAVA_JOB_FILE}
107+
sed -i "s|{{BUILD_FILE_NAME}}|${BUILD_FILE_NAME}|g" "${LAVA_JOB_FILE}"
108+
sed -i "s|{{BUILD_DOWNLOAD_URL}}|${BUILD_DOWNLOAD_URL}|g" "${LAVA_JOB_FILE}"
109+
sed -i "s|{{GITHUB_SHA}}|${GITHUB_SHA}|g" "${LAVA_JOB_FILE}"
110+
sed -i "s|{{GITHUB_RUN_ID}}|${GITHUB_RUN_ID}|g" "${LAVA_JOB_FILE}"
110111
cat ${LAVA_JOB_FILE}
111112
echo "LAVA_JOB_FILE=${LAVA_JOB_FILE}" >> "$GITHUB_ENV"
112113
@@ -116,7 +117,7 @@ jobs:
116117
with:
117118
lava_token: ${{ secrets.LAVATOKEN }}
118119
lava_url: 'lava.infra.foundries.io'
119-
job_definition: ${LAVA_JOB_FILE}
120+
job_definition: "${LAVA_JOB_FILE}"
120121
wait_for_job: true
121122
fail_action_on_failure: false
122123
save_result_as_artifact: true

0 commit comments

Comments
 (0)