mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-12-01 13:43:05 +00:00
ci: retry flaky release binary builds, attach the archives that built, and update the registry only once all are attached (#1714)
v0.110.1, v0.111.0 and v0.112.0 reached npm without binaries. In each run one `Build binaries` job failed, `upload-binaries` was skipped, and `trigger-registry-update` dispatched anyway, so the registry rejected the update and stayed on 0.110.0. ## Root causes From about 3,600 binary jobs, Oct 28 – Nov 25: - **darwin-arm64:** no macOS arm64 runner picked up the job within 15 minutes, so GitHub cancelled it. This happened to 22 of 452 jobs. It's a GitHub capacity problem; nothing inside the job can retry it. - **windows-arm64:** the smoke test's cleanup threw EPERM on its scratch directory after every check had passed. This happened to 11 of about 450 jobs: Windows briefly keeps a handle open after the process exits. ## Changes - **`smoke-binary.mjs`:** cleanup retries. A directory that stays locked is left behind with a warning instead of failing the job. - **`retry-binaries.yml` (new):** reruns a release's failed binary jobs up to twice, as long as nothing else failed. This works around the runner-capacity limit. - **`upload-binaries`:** attaches every archive that built and the release lacks, even if another build failed. While any archive is missing, it puts a warning naming them at the top of the release notes and fails red. It never replaces an archive that's already attached. A rerun that completes the release removes the warning. - **`scripts/missing-release-archives.sh` (new):** lists the archives a release lacks, taking the expected list from the build matrix in `binaries.yml`. `upload-binaries` checks the release itself rather than the run's artifacts, so `gh run rerun --failed` still completes a release after the 7-day artifact expiry. - **`trigger-registry-update`:** a stable release dispatches only once its release has every archive. - **Manual stable run:** a new `find-release` job checks the release for the version at `ref`. If archives are missing, the run builds them from the tag's commit and attaches only the missing ones. A complete release is not rebuilt. - **`docs/RELEASES.md`:** the recovery steps are updated. ## Testing `npm run check`, the smoke test on macOS, the script against the real releases (v0.112.0 complete, v0.111.0 missing all 8, unknown tag fails), and the upload steps against a stubbed `gh` (partial build, late rerun, nothing missing, every build failed, warning already present). It hasn't run on GitHub yet: `retry-binaries.yml` only fires from `main`, and the manual path can be tried with `gh workflow run publish.yml -f ref=v0.111.0 -f publish_npm=false`.
This commit is contained in:
8
.github/workflows/binaries.yml
vendored
8
.github/workflows/binaries.yml
vendored
@@ -13,6 +13,10 @@ on:
|
||||
description: Upload each archive as a workflow artifact for the release job.
|
||||
type: boolean
|
||||
default: false
|
||||
ref:
|
||||
description: Tag or commit to build. Defaults to the commit that triggered the workflow (github.sha).
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -24,6 +28,8 @@ jobs:
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
# scripts/missing-release-archives.sh reads the `archive:` lines to know
|
||||
# which archives a release needs.
|
||||
matrix:
|
||||
include:
|
||||
- target: bun-linux-x64
|
||||
@@ -61,6 +67,8 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
|
||||
with:
|
||||
|
||||
159
.github/workflows/publish.yml
vendored
159
.github/workflows/publish.yml
vendored
@@ -88,37 +88,153 @@ jobs:
|
||||
npm publish
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Standalone executables for the GitHub release, stable releases only. They
|
||||
# don't gate the npm publish: a failed build leaves the release without
|
||||
# binaries, and re-running the failed jobs attaches them.
|
||||
# A manual stable run has no release-please output to say which release it
|
||||
# is for, or whether that release still lacks archives. This finds the
|
||||
# release for the version at `ref` and lists the archives it lacks, so a
|
||||
# hand-made release (docs/RELEASES.md, "The release PR merged but nothing was
|
||||
# tagged") gets them, and a complete one is not rebuilt.
|
||||
find-release:
|
||||
name: Find the release's archives
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.channel == 'stable' }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
tag: ${{ steps.find.outputs.tag }}
|
||||
build: ${{ steps.find.outputs.build }}
|
||||
steps:
|
||||
# The workflow's own commit, for scripts/missing-release-archives.sh.
|
||||
# `ref` is only read through the API, so nothing from it lands on the
|
||||
# runner, and only the tag's commit is ever built.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
||||
- name: List the archives the release lacks
|
||||
id: find
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
REF: ${{ inputs.ref }}
|
||||
#language=bash
|
||||
run: |
|
||||
version="$(gh api --method GET "repos/$GH_REPO/contents/package.json" \
|
||||
-H "Accept: application/vnd.github.raw+json" -f ref="$REF" --jq .version)"
|
||||
tag="v$version"
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
if ! missing="$(scripts/missing-release-archives.sh "$tag")"; then
|
||||
echo "::error title=No release $tag::'$REF' is version $version, which has no GitHub release. Create it first (docs/RELEASES.md, 'The release PR merged but nothing was tagged')."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$missing" ]; then
|
||||
echo "build=false" >> "$GITHUB_OUTPUT"
|
||||
echo "$tag already has every archive; not rebuilding them." >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# binaries.yml builds the tag. A `ref` naming another commit would
|
||||
# get archives of a commit it didn't ask for, so refuse it.
|
||||
tagged="$(gh api "repos/$GH_REPO/commits/$tag" --jq .sha)"
|
||||
if [ "$(gh api "repos/$GH_REPO/commits/$REF" --jq .sha)" != "$tagged" ]; then
|
||||
echo "::error title=$tag lacks archives::'$REF' is not the commit $tag points to ($tagged). Run again with ref=$tag to build them."
|
||||
exit 1
|
||||
fi
|
||||
echo "build=true" >> "$GITHUB_OUTPUT"
|
||||
echo "$tag lacks $(paste -sd ' ' - <<<"$missing"); building them." >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
# Standalone executables for the GitHub release: every stable release from
|
||||
# release-please, and a manual stable run whose release lacks some. They
|
||||
# don't gate the npm publish: a failed build leaves the release without that
|
||||
# platform's archive, fails upload-binaries and holds back the registry
|
||||
# update. retry-binaries.yml re-runs the failed jobs, which attaches it.
|
||||
build-binaries:
|
||||
name: Build binaries
|
||||
needs: [release-please]
|
||||
if: ${{ needs.release-please.outputs.release_created == 'true' }}
|
||||
needs: [release-please, find-release]
|
||||
# !cancelled(): on a manual run release-please is skipped, which would skip
|
||||
# this job too by default.
|
||||
if: ${{ !cancelled() && (needs.release-please.outputs.release_created == 'true' || needs.find-release.outputs.build == 'true') }}
|
||||
# The called workflow only reads the repository; upload-binaries does the write.
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.github/workflows/binaries.yml
|
||||
with:
|
||||
upload: true
|
||||
# Empty on a push, which builds the release merge commit the run is for.
|
||||
ref: ${{ needs.find-release.outputs.tag }}
|
||||
|
||||
# Attaches every archive that built, even when another platform's build
|
||||
# failed, so those platforms can download it while the failure is fixed. It
|
||||
# succeeds only once the release has every archive, which is what lets the
|
||||
# registry update run. It checks the release rather than this run's
|
||||
# artifacts, so a re-run after the 7-day artifact retention still completes
|
||||
# the release from the archives attached earlier.
|
||||
upload-binaries:
|
||||
name: Attach binaries to the release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-please, build-binaries]
|
||||
needs: [release-please, find-release, build-binaries]
|
||||
if: ${{ !cancelled() && (needs.release-please.outputs.release_created == 'true' || needs.find-release.outputs.build == 'true') }}
|
||||
permissions:
|
||||
contents: write
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
TAG: ${{ needs.release-please.outputs.tag_name || needs.find-release.outputs.tag }}
|
||||
steps:
|
||||
# The workflow's own commit, for scripts/missing-release-archives.sh.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
||||
# Archives from every attempt of this run that are still within the
|
||||
# 7-day retention. With none (every build failed) it downloads nothing.
|
||||
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
- name: Upload to the release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ needs.release-please.outputs.tag_name }}
|
||||
run: gh release upload "$TAG" artifacts/* --clobber --repo "$GITHUB_REPOSITORY"
|
||||
- name: Attach the archives the release lacks
|
||||
#language=bash
|
||||
run: |
|
||||
# Never replaces an archive the release already has: someone may have
|
||||
# downloaded it or the registry may hold its sha256, and a rebuild is
|
||||
# not byte-identical. --clobber only replaces an upload that never
|
||||
# finished, which the script lists as missing.
|
||||
missing="$(scripts/missing-release-archives.sh "$TAG")"
|
||||
upload=()
|
||||
while read -r name; do
|
||||
if [ -n "$name" ] && [ -f "artifacts/$name" ]; then
|
||||
upload+=("artifacts/$name")
|
||||
fi
|
||||
done <<<"$missing"
|
||||
if [ "${#upload[@]}" -gt 0 ]; then
|
||||
gh release upload "$TAG" "${upload[@]}" --clobber
|
||||
fi
|
||||
- name: Check the release has every archive
|
||||
# Also after a failed upload, so the notice matches what is attached.
|
||||
if: ${{ !cancelled() }}
|
||||
#language=bash
|
||||
run: |
|
||||
missing="$(scripts/missing-release-archives.sh "$TAG")"
|
||||
|
||||
# Keep a notice at the top of the release notes while archives are
|
||||
# missing, so someone looking for one knows why it isn't there.
|
||||
start="<!-- missing-binaries -->"
|
||||
end="<!-- /missing-binaries -->"
|
||||
body="$(gh release view "$TAG" --json body --jq .body)"
|
||||
# The notes without an earlier notice and the blank line after it.
|
||||
notes="$(awk -v start="$start" -v end="$end" '
|
||||
drop_blank { drop_blank = 0; if ($0 == "") next }
|
||||
$0 == start { skip = 1 }
|
||||
skip { if ($0 == end) { skip = 0; drop_blank = 1 } next }
|
||||
{ print }' <<<"$body")"
|
||||
if [ -n "$missing" ]; then
|
||||
notice="$start"$'\n'"> [!WARNING]"$'\n'"> Not attached yet: $(paste -sd ' ' - <<<"$missing" | sed 's/ /, /g'). They will be attached once their build is fixed."$'\n'"$end"
|
||||
notes="$notice"$'\n\n'"$notes"
|
||||
fi
|
||||
if [ "$notes" != "$body" ]; then
|
||||
gh release edit "$TAG" --notes "$notes"
|
||||
fi
|
||||
|
||||
if [ -n "$missing" ]; then
|
||||
echo "::error title=$TAG lacks archives::The release still lacks $(paste -sd ' ' - <<<"$missing"), so the registry was not updated. retry-binaries.yml re-runs the failed jobs up to twice; after that, run: gh run rerun $GITHUB_RUN_ID --failed --repo $GITHUB_REPOSITORY"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Same shape as publish-npm. Tagging is a separate job, so nothing here needs
|
||||
# write access to the repository.
|
||||
@@ -231,11 +347,13 @@ jobs:
|
||||
echo "Tagged \`v$VERSION\` at \`$SHA\`" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
trigger-registry-update:
|
||||
# upload-binaries too, so a stable release's archives are attached before the
|
||||
# registry reads the release: it takes each archive's sha256 from the release
|
||||
# assets when it bumps the version. It only waits; a failed or skipped upload
|
||||
# (every preview) doesn't stop the dispatch.
|
||||
needs: [publish-npm, publish-npm-preview, upload-binaries]
|
||||
# A stable release dispatches only once its release has every archive:
|
||||
# upload-binaries found them all attached, or find-release found nothing
|
||||
# missing.
|
||||
# The registry takes each archive's sha256 from the release assets when it
|
||||
# bumps the version, and rejects the update while one is missing. Previews
|
||||
# are npm-only and dispatch without archives.
|
||||
needs: [publish-npm, publish-npm-preview, find-release, upload-binaries]
|
||||
# Both channels dispatch this: the registry has its own handling for preview
|
||||
# versions. The two never fire together — a release merge publishes stable and
|
||||
# skips the preview, and every other push does the reverse — so the registry sees
|
||||
@@ -244,9 +362,12 @@ jobs:
|
||||
if: >-
|
||||
${{
|
||||
always() && (
|
||||
needs.publish-npm.result == 'success'
|
||||
|| needs.publish-npm-preview.outputs.published == 'true'
|
||||
|| (github.event_name == 'workflow_dispatch' && inputs.channel == 'stable' && !inputs.publish_npm)
|
||||
needs.publish-npm-preview.outputs.published == 'true'
|
||||
|| (
|
||||
(needs.publish-npm.result == 'success'
|
||||
|| (github.event_name == 'workflow_dispatch' && inputs.channel == 'stable' && !inputs.publish_npm))
|
||||
&& (needs.upload-binaries.result == 'success' || needs.find-release.outputs.build == 'false')
|
||||
)
|
||||
)
|
||||
}}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
77
.github/workflows/retry-binaries.yml
vendored
Normal file
77
.github/workflows/retry-binaries.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# Re-runs a release's failed binary builds, up to twice, so that a flaky
|
||||
# runner doesn't leave the GitHub release missing archives and the registry on
|
||||
# the previous version. The usual cause is GitHub finding no macOS arm64 runner
|
||||
# within 15 minutes ("The job was not acquired by Runner of type hosted even
|
||||
# after multiple attempts"). No retry inside binaries.yml can cover that: the
|
||||
# job never starts. Re-running the failed jobs also re-runs upload-binaries and
|
||||
# trigger-registry-update, which depend on them; publish-npm is not re-run.
|
||||
name: Retry release binaries
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Publish and Release]
|
||||
types: [completed]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
rerun:
|
||||
name: Re-run failed binary builds
|
||||
# Only the first attempt: this job waits for its own re-runs, and whether
|
||||
# their completion triggers workflow_run again depends on the GITHUB_TOKEN
|
||||
# rules, so a later attempt must not start a second loop over the same run.
|
||||
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.run_attempt == 1 }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write # re-run the failed jobs
|
||||
# Two re-runs, each up to 15 minutes in the runner queue plus the build.
|
||||
timeout-minutes: 75
|
||||
steps:
|
||||
- name: Re-run while only the binaries fail
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
#language=bash
|
||||
run: |
|
||||
# filter=latest: each job's most recent attempt, so a job that passed
|
||||
# on an earlier attempt doesn't count as failed.
|
||||
failed_jobs() {
|
||||
gh api --paginate \
|
||||
"repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID/jobs?filter=latest&per_page=100" \
|
||||
--jq '.jobs[] | select(.conclusion != "success" and .conclusion != "skipped") | "\(.name) (\(.conclusion))"'
|
||||
}
|
||||
|
||||
for rerun in 1 2; do
|
||||
failed="$(failed_jobs)"
|
||||
if [ -z "$failed" ]; then
|
||||
echo "Run $RUN_ID succeeded after $((rerun - 1)) re-run(s)." >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 0
|
||||
fi
|
||||
echo "Jobs of run $RUN_ID that did not succeed:"
|
||||
echo "$failed"
|
||||
|
||||
# Anything else failing (npm, the preview tag, the registry
|
||||
# dispatch) has its own recovery in docs/RELEASES.md; re-running it
|
||||
# blindly could publish twice.
|
||||
if grep -v -e '^Build binaries / ' -e '^Attach binaries to the release ' <<<"$failed"; then
|
||||
echo "::notice::Not re-running run $RUN_ID: the jobs above failed outside the binary builds."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
gh run rerun "$RUN_ID" --failed --repo "$GITHUB_REPOSITORY"
|
||||
echo "Re-ran the failed jobs of run $RUN_ID ($rerun of 2)." >> "$GITHUB_STEP_SUMMARY"
|
||||
# The re-run is queued asynchronously; wait for it to show before
|
||||
# watching, or the watch returns on the previous attempt's result.
|
||||
for _ in $(seq 30); do
|
||||
[ "$(gh run view "$RUN_ID" --repo "$GITHUB_REPOSITORY" --json status --jq .status)" != completed ] && break
|
||||
sleep 2
|
||||
done
|
||||
gh run watch "$RUN_ID" --repo "$GITHUB_REPOSITORY" --interval 30 >/dev/null || true
|
||||
done
|
||||
|
||||
failed="$(failed_jobs)"
|
||||
if [ -n "$failed" ]; then
|
||||
echo "::error title=Release binaries still failing::Run $RUN_ID still has failed jobs after 2 re-runs: $(paste -sd ';' - <<<"$failed")"
|
||||
exit 1
|
||||
fi
|
||||
echo "Run $RUN_ID succeeded after 2 re-runs." >> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -208,12 +208,44 @@ npm versions are immutable. If the package already published and only the
|
||||
registry update failed, pass `-f publish_npm=false` so the run skips publishing
|
||||
and only re-dispatches the registry update.
|
||||
|
||||
### The release has no executables
|
||||
Either way, the run also checks the release's
|
||||
[executables](#the-release-is-missing-executables) before it dispatches. If the
|
||||
release has every archive, nothing is rebuilt. Otherwise it builds them from the
|
||||
tagged commit, attaches the ones the release lacks, then dispatches. Pass the
|
||||
tag as `ref`, as above: when archives need building, a `ref` that is not the
|
||||
tag's commit fails rather than attach archives built from a different commit. A
|
||||
version with no GitHub release fails until the release is created.
|
||||
|
||||
### The release is missing executables
|
||||
|
||||
`build-binaries` and `upload-binaries` don't gate npm, so a failed build only
|
||||
leaves the release without archives. Re-run the failed jobs of that publish run
|
||||
(`gh run rerun <run-id> --failed`); the upload uses `--clobber`, so archives
|
||||
already attached are replaced rather than duplicated.
|
||||
leaves the release without that platform's archive. `upload-binaries` attaches
|
||||
every archive that did build, adds a notice to the top of the release notes
|
||||
naming the missing ones, and fails with a "`v<version>` lacks archives" error.
|
||||
`trigger-registry-update` is skipped until the release has every archive, since
|
||||
the registry rejects a release with any missing.
|
||||
|
||||
[`retry-binaries.yml`](../.github/workflows/retry-binaries.yml) re-runs the
|
||||
failed jobs of that run up to twice, as long as nothing but the binary builds
|
||||
failed. That covers the usual causes: no macOS arm64 runner picking up the job
|
||||
within 15 minutes, and a transient network error in a setup step. Re-running
|
||||
the failed jobs also re-runs the upload, which removes the notice once nothing
|
||||
is missing, and then the registry update.
|
||||
|
||||
If archives are still missing after that, fix the cause and re-run the failed
|
||||
jobs of the publish run yourself (`gh run rerun <run-id> --failed`). The upload
|
||||
checks the release, not the run's build artifacts, so this still works after
|
||||
those expire at 7 days. It only adds archives the release lacks and never
|
||||
replaces one already attached, since a rebuild is not byte-identical and
|
||||
someone may already have downloaded it.
|
||||
|
||||
GitHub re-runs a run only within 30 days of it. After that, run the publish
|
||||
workflow against the tag, which builds the missing archives, attaches them and
|
||||
updates the registry:
|
||||
|
||||
```sh
|
||||
gh workflow run publish.yml -f ref="v<version>" -f publish_npm=false
|
||||
```
|
||||
|
||||
### A preview published but the commit was not tagged
|
||||
|
||||
|
||||
25
scripts/missing-release-archives.sh
Executable file
25
scripts/missing-release-archives.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Prints the archives of the build matrix in .github/workflows/binaries.yml that
|
||||
# a GitHub release does not have yet, one per line. Prints nothing when the
|
||||
# release is complete. Fails when the release does not exist.
|
||||
#
|
||||
# scripts/missing-release-archives.sh v0.112.0
|
||||
#
|
||||
# An asset that never finished uploading (state "open") counts as missing.
|
||||
# Requires an authenticated GitHub CLI; set GH_REPO outside a clone.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
tag="${1:?usage: $0 <tag>}"
|
||||
matrix="$(dirname "$0")/../.github/workflows/binaries.yml"
|
||||
|
||||
expected="$(sed -n 's/^ *archive: *//p' "$matrix" | sort)"
|
||||
if [ -z "$expected" ]; then
|
||||
echo "No 'archive:' entries in $matrix." >&2
|
||||
exit 1
|
||||
fi
|
||||
attached="$(gh release view "$tag" --json assets \
|
||||
--jq '.assets[] | select(.state == "uploaded") | .name' | sort)"
|
||||
|
||||
comm -23 <(printf '%s\n' "$expected") <(printf '%s\n' "$attached")
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
copyFileSync,
|
||||
mkdirSync,
|
||||
mkdtempSync,
|
||||
readdirSync,
|
||||
readFileSync,
|
||||
rmSync,
|
||||
symlinkSync,
|
||||
@@ -123,7 +124,29 @@ if (positionals.length === 0) {
|
||||
probe.stdout || probe.error,
|
||||
);
|
||||
} finally {
|
||||
rmSync(scratch, { recursive: true, force: true });
|
||||
removeScratch(scratch);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Windows sometimes refuses to delete a scratch directory right after a
|
||||
* process that ran from it exits: rmSync threw EPERM on `acp-layout-*` in about
|
||||
* 2% of windows-11-arm runs, after every check had passed. rmSync retries EPERM
|
||||
* and EBUSY, waiting 200ms longer each time on Windows. A directory that is
|
||||
* still locked after that is left in the temp directory with a warning that
|
||||
* lists what is left, instead of failing the smoke test.
|
||||
*/
|
||||
function removeScratch(dir) {
|
||||
try {
|
||||
rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 200 });
|
||||
} catch (error) {
|
||||
let left;
|
||||
try {
|
||||
left = readdirSync(dir, { recursive: true }).join(", ");
|
||||
} catch (listError) {
|
||||
left = String(listError);
|
||||
}
|
||||
console.warn(`warn could not remove ${dir} (left: ${left}): ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +275,7 @@ if (values.full) {
|
||||
try {
|
||||
await fullSmoke(work);
|
||||
} finally {
|
||||
rmSync(work, { recursive: true, force: true });
|
||||
removeScratch(work);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user