Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,25 @@ spec:
run: |
: "${CLOUDFLARE_ACCOUNT_ID:?CLOUDFLARE_ACCOUNT_ID is required}"
: "${CLOUDFLARE_API_TOKEN:?CLOUDFLARE_API_TOKEN is required}"
pnpm exec wrangler deploy --config {{ .parameters.wranglerConfig }} --env {{ .orun.environment.name }}
# A first deploy of a brand-new worker can lose a race inside
# Cloudflare: the upload lands and the follow-up read answers
# "This Worker does not exist on your account" (code 10007). The
# deploy is idempotent, so retry it a few times with a short wait
# instead of parking the whole convergence on a resume.
attempts=3
for i in $(seq 1 "$attempts"); do
if pnpm exec wrangler deploy --config {{ .parameters.wranglerConfig }} --env {{ .orun.environment.name }}; then
[ "$i" -gt 1 ] && echo "deploy passed on attempt $i/$attempts"
exit 0
fi
if [ "$i" -lt "$attempts" ]; then
wait=$(( i * 10 ))
echo "deploy attempt $i/$attempts failed — retrying in ${wait}s"
sleep "$wait"
fi
done
echo "deploy failed after $attempts attempts"
exit 1
onFailure: stop

- id: secrets-live
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,24 @@ spec:
EFFECTIVE_WORKER_NAME="{{ .parameters.workerName }}"
{{- end }}

pnpm exec wrangler deploy \
--config "{{ .parameters.wranglerConfig }}" \
--name "${EFFECTIVE_WORKER_NAME}"
# Same first-deploy race as cloudflare-worker-turbo (Cloudflare code
# 10007 right after the upload); the deploy is idempotent, so retry.
attempts=3
for i in $(seq 1 "$attempts"); do
if pnpm exec wrangler deploy \
--config "{{ .parameters.wranglerConfig }}" \
--name "${EFFECTIVE_WORKER_NAME}"; then
[ "$i" -gt 1 ] && echo "deploy passed on attempt $i/$attempts"
exit 0
fi
if [ "$i" -lt "$attempts" ]; then
wait=$(( i * 10 ))
echo "deploy attempt $i/$attempts failed — retrying in ${wait}s"
sleep "$wait"
fi
done
echo "deploy failed after $attempts attempts"
exit 1
onFailure: stop

- id: smoke
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Stack
metadata:
name: stack-tectonic
title: Stack Tectonic
version: 0.18.2
version: 0.19.0
description: Versioned OCI-hosted catalog of Cloudflare, Terraform and monorepo compositions for Sourceplane repositories.
owner: sourceplane
tags:
Expand Down
Loading