Skip to content

Commit 9007e98

Browse files
authored
fix(ci): cluster pinning with timeout and retry (#2321)
1 parent 5dbccfd commit 9007e98

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,40 @@ jobs:
123123
if: github.ref == 'refs/heads/main'
124124
continue-on-error: true
125125
run: |
126-
ipfs-cluster-ctl --enc=json \
127-
--host "${CLUSTER_HOST}" \
128-
--basic-auth "${CLUSTER_USER}:${CLUSTER_PASSWORD}" \
129-
add --format car --local \
130-
--name "${PIN_NAME}" \
131-
ipfs-webui_${{ github.sha }}.car
126+
timeout-minutes: 5 # pin should takes a few seconds, 5 min is a hard ceiling
127+
run: |
128+
echo "Avoid doing initial upload to am6-1 node with experimental pebble datastore"
129+
echo '127.0.0.1 collab-cluster-am6-1.cluster.dwebops.net' | sudo tee -a /etc/hosts
130+
131+
# run in a loop and retry until GA timeout-minutes hits
132+
attempt=1
133+
while true; do
134+
echo "Attempt #$attempt"
135+
136+
# pinning <100MiB file should not take more than few seconds
137+
timeout 1m ipfs-cluster-ctl --enc=json \
138+
--host "${CLUSTER_HOST}" \
139+
--basic-auth "${CLUSTER_USER}:${CLUSTER_PASSWORD}" \
140+
add --format car --local \
141+
--name "${PIN_NAME}" \
142+
ipfs-webui_${{ github.sha }}.car && {
143+
echo "Pin succeeded on attempt #$attempt"
144+
exit 0
145+
}
146+
147+
echo "Attempt #$attempt failed, retrying in 2 seconds..."
148+
attempt=$((attempt + 1))
149+
# if first attept failed, retry with debug enabled
150+
if [[ $counter -eq 2 ]]; then
151+
export GOLOG_LOG_LEVEL='debug'
152+
fi
153+
sleep 2
154+
done
132155
env:
133156
CLUSTER_HOST: "/dnsaddr/ipfs-websites.collab.ipfscluster.io"
134157
CLUSTER_USER: ${{ secrets.CLUSTER_USER }}
135158
CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }}
136159
PIN_NAME: "ipfs-webui@${{ github.sha }}"
137-
timeout-minutes: 15
138160

139161
- name: Fail job due to pinning failure
140162
# only fail if pinning failed for main commits

0 commit comments

Comments
 (0)