Skip to content

Commit

Permalink
fix(ci): Run_retried instead of curl --retry (#2162)
Browse files Browse the repository at this point in the history
Curl is unable to retry some transient errors, so it's more reliable to
use run_retried which retries any error

Signed-off-by: tomg10 <[email protected]>
  • Loading branch information
tomg10 authored Jun 7, 2024
1 parent 3e72364 commit 70eb588
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-contract-verifier-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
filtered_tag=""
while [ true ]; do
echo "Page: $page"
tags=$(curl --retry 5 -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" \
tags=$(run_retried curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/matter-labs/era-contracts/tags?per_page=100&page=${page}" | jq .)
if [ $(jq length <<<"$tags") -eq 0 ]; then
echo "No tag found on all pages."
Expand All @@ -73,9 +73,9 @@ jobs:
done
echo "Contracts tag is: ${filtered_tag}"
mkdir -p ./contracts
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l1-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l2-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/system-contracts.tar.gz
run_retried curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l1-contracts.tar.gz
run_retried curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l2-contracts.tar.gz
run_retried curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/system-contracts.tar.gz
tar -C ./contracts -zxf l1-contracts.tar.gz
tar -C ./contracts -zxf l2-contracts.tar.gz
tar -C ./contracts -zxf system-contracts.tar.gz
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk || true
ci_run yarn zk build
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: build contracts
if: env.BUILD_CONTRACTS == 'true'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
filtered_tag=""
while [ true ]; do
echo "Page: $page"
tags=$(curl --retry 5 -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" \
tags=$(run_retried curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/matter-labs/era-contracts/tags?per_page=100&page=${page}" | jq .)
if [ $(jq length <<<"$tags") -eq 0 ]; then
echo "No tag found on all pages."
Expand All @@ -82,9 +82,9 @@ jobs:
done
echo "Contracts tag is: ${filtered_tag}"
mkdir -p ./contracts
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l1-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l2-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/system-contracts.tar.gz
run_retried curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l1-contracts.tar.gz
run_retried curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l2-contracts.tar.gz
run_retried curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/system-contracts.tar.gz
tar -C ./contracts -zxf l1-contracts.tar.gz
tar -C ./contracts -zxf l2-contracts.tar.gz
tar -C ./contracts -zxf system-contracts.tar.gz
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk || true
ci_run yarn zk build
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: build contracts
if: env.BUILD_CONTRACTS == 'true'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-prover-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ jobs:
- name: download CRS for CPU compressor
if: matrix.component == 'proof-fri-compressor'
run: |
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: download CRS for GPU compressor
if: matrix.component == 'proof-fri-gpu-compressor'
run: |
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^24.key
ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^24.key
- name: login to Docker registries
Expand All @@ -115,7 +115,7 @@ jobs:
retry_count=0
while [[ $retry_count -lt $max_retries ]]; do
response=$(curl --retry 5 -s -w "%{http_code}" -o temp.json "$api_endpoint")
response=$(run_retried curl -s -w "%{http_code}" -o temp.json "$api_endpoint")
http_code=$(echo "$response" | tail -n1)
if [[ "$http_code" == "200" ]]; then
Expand Down

0 comments on commit 70eb588

Please sign in to comment.