Skip to content

The open alternative to Salesforce, designed for AI.

Retry npm publish when the provenance entry conflicts in Rekor (#29240)

Charles Bochet5f8f8c5332fb
diff --git a/.github/workflows/publish-npm-packages.yaml b/.github/workflows/publish-npm-packages.yaml
index 568cbe36887..1633b9959a8 100644
--- a/.github/workflows/publish-npm-packages.yaml
+++ b/.github/workflows/publish-npm-packages.yaml
@@ -180,7 +180,19 @@ jobs:
if curl --fail --silent --show-error "https://registry.npmjs.org/$package/$VERSION" > /dev/null; then
echo "$package@$VERSION already published; skipping"
else
- yarn workspace "$package" npm publish --provenance --tag "$DIST_TAG" --access public
+ for attempt in 1 2 3; do
+ publish_log=$(mktemp)
+ if yarn workspace "$package" npm publish --provenance --tag "$DIST_TAG" --access public 2>&1 | tee "$publish_log"; then
+ break
+ fi
+ # Yarn's Sigstore client times out on slow Rekor writes and its retry then hits a 409.
+ # Signing happens before the upload, so a failed attempt has published nothing.
+ if [[ "$attempt" == 3 ]] || ! grep -q "error creating tlog entry - (409)" "$publish_log"; then
+ exit 1
+ fi
+ echo "::warning::$package provenance entry conflicted in Rekor; retrying publish"
+ sleep 15
+ done
fi
if [[ "$package" != twenty && "$package" != create-twenty-app ]]; then
published_libraries="$published_libraries $package"