Skip to content

Commit

Permalink
fix npm registry flake (#9899)
Browse files Browse the repository at this point in the history
closes #9909 

This PR addresses an intermittent issue in the CI pipeline where the setup of a local NPM registry occasionally fails during integration tests. The issue occurs within a matrix strategy that runs tests across `yarn`, `npm`, and `npx`. The setup involves publishing packages using Verdaccio with a ci `dist-tag`, which is then used to configure `agoric-cli` with `npm`, `npx`, and `yarn` before running the `yarn integration` test command.

## Solution Implemented
Given that this issue happens occasionally, a retry mechanism has been added to the script. Retry mechanism has been added using the `nick-fields/retry@v3` GitHub Action. This solution configures the setup to retry up to three times, with a timeout of 10 minutes.
  • Loading branch information
mergify[bot] authored Aug 20, 2024
2 parents a18dbbf + b2c3609 commit 8981d86
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ jobs:
git reset --hard HEAD
git clean -f
git config user.email "[email protected]"
REGISTRY_PUBLISH_WORKSPACES="$HOME/endo" scripts/registry.sh bg-publish ${{ matrix.cli }}
REGISTRY_PUBLISH_WORKSPACES="$HOME/endo"
timeout 900 scripts/registry.sh bg-publish ${{ matrix.cli }}
- name: run agoric-cli integration-test
# These integration tests can be flaky so retry automatically
Expand Down
17 changes: 14 additions & 3 deletions scripts/registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ publish() {

# Publish the packages to our local service.
# without concurrency until https://github.com/Agoric/agoric-sdk/issues/8091
yarn lerna publish --concurrency 1 prerelease --exact \
--dist-tag="$DISTTAG" --preid=dev \
--no-push --no-git-reset --no-git-tag-version --no-verify-access --yes
yarn lerna version --concurrency 1 prerelease --exact \
--preid=dev --no-push --no-git-tag-version --yes

# Convention used in Endo
yarn lerna run clean:types
Expand All @@ -91,6 +90,18 @@ publish() {
| (popd > /dev/null && git hash-object -w --stdin))

git commit -am "chore: update versions"

while ! yarn lerna publish from-package \
--dist-tag="$DISTTAG" --no-git-reset --no-verify-access --yes; do
echo 1>&2 "Retrying publish..."
sleep 5
done

git reset --hard HEAD

# Convention used in Endo
yarn lerna run clean:types

git checkout "$prior"
popd
done
Expand Down

0 comments on commit 8981d86

Please sign in to comment.