GitHub Actions: periodic `flyctl: not found`
We have a GitHub action workflow that deploys our Fly instance upon git push.
Periodically and seemingly randomly, the workflow quickly fails with the following error:
Run superfly/[email protected]
with:
args: deploy --remote-only --strategy immediate --wait-timeout 360 --config ./packages/api/fly.staging.toml --dockerfile ./packages/api/Dockerfile --ignorefile .dockerignore --app paragraph-feature-par-[2](https://github.com/paragraph-xyz/monorepo/actions/runs/8740055948/job/23982824117#step:5:2)645 -e COMMIT=${GITHUB_SHA} --vm-size shared-cpu-2x
env:
FLY_API_TOKEN: ***
sh: flyctl: not found
Flyctl should never not be found, so I don't know why this is occurring.
@seeARMS it looks like you're pinned to v1.1 of the action which was released almost 4 years ago. We've made some improvements since then!
Could you try updating to the latest version, either v1, which will automatically pick up minor versions, or v1.5 if you want to lock to a specific version. I think this will fix things up for you.
specifically this line in your workflow:
- uses: superfly/flyctl-actions/setup-flyctl@v1
I'm going to close this for now, if you're still running into this in the future, feel free to bump it!
I upgraded to v1 but still encountering this:
Still continuing to happen:
A restart of the workflow fixes it, so this seems to happen intermittently.
Happening about once a day now.
@seeARMS I haven't been able to reproduce this, do you have any other context that might help me see what's happening?
This action continues to periodically fail with nothing logged:
We are seeing the same periodic failure
I have encountered this failure. A closer examination of the docker build process shows that curl failed to download the fly install script. This error doesn't abort the docker build, which allows the actions workflow to continue until it attempts to run a fly command. This results in users reporting the wrong error.
#8 [3/4] RUN curl -L https://fly.io/install.sh | FLYCTL_INSTALL=/usr/local sh
#8 0.151 % Total % Received % Xferd Average Speed Time Time Time Current
#8 0.151 Dload Upload Total Spent Left Speed
#8 0.151
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
#8 1.216 curl: (35) Recv failure: Connection reset by peer
#8 DONE 1.2s
The error seems random because network failures are unpredictable.
EDIT: I should also mention that the docker build doesn't fail because the pipe swallows the error code that docker uses to detect failures. Bash has the pipefail option to work around this exact problem. You could use the SHELL docker command to turn on pipefail, if your shell supports it.
SHELL ["/bin/bash", "-o", "pipefail", "-c"]