Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Update upload logic to use new streaming support #111

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/build-yocto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,21 @@ jobs:
# Instruct our file server to make these files available for download
url="https://quic-yocto-fileserver-1029608027416.us-central1.run.app/${GITHUB_RUN_ID}/${{ matrix.machine }}/"

retries=3
retries=4
okay=0
shopt -s lastpipe # allows us to capture the value of `okay` in the while loop below
for ((i=0; i<retries; i++)); do
curl -X POST -i -w '%{http_code}' --fail-with-body ${url} && break
curl -X POST -H "Accept: text/event-stream" -i --fail-with-body -s -N ${url} | \
while read line; do
echo $line
if [[ $line == STATUS=* ]]; then
if [[ $line == "STATUS=OK" ]]; then
okay=1
break
fi
fi
done
[ $okay -eq 1 ] && break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doanac I believe that this may not work as expected if the bash script code run with set -e.
In this case when the okay != 1 the script will abort as the evaluations of the expression will return false, what causes abort when set -e is active.

We need to replace that with if conditional statement

if [ $okay -eq 1 ]; then
    break
fi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test anything to verify what I said but if what I said is true, the consequence is that there are no retries and the loop aborts on the first failure when okay != 1.

echo # new line break in case response doesn't have one
echo "Error: unable to publish artifacts, sleep and retry"
sleep 2
Expand Down
Loading