-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Foundryup failure due to GitHub API rate limiting #3942
Comments
my bashscript skills are pretty limited, but we def should handle this. https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425#set--o-pipefail from what I understand adding |
Yeah that should make the script at least catch this failure. |
Hm, it seems like Lines 239 to 244 in b78509f
|
i tried to fix this but was closed #2221 I actually have the fix here: https://github.com/foundry-rs/foundry/pull/3907/files#diff-79a844de4d6869f243ecd1e7ca4d9532d9a4987f85ca63d9f4af85aa227ecb38R22-R32 |
The real issue is that GitHub has no direct way to directly link to the latest build from GitHub actions of a given repository. Even if you do have a link to an artifact, using it requires the visitor to be logged into the GitHub website.1
Also, these are pre-releases so a service like https://nightly.link/ wont actually work Here is a script we use to download the latest releases in json file, https://github.com/sambacha/foundry-release/blob/master/get-release.sh just parse that to get your download link Footnotes |
forge init hello_foundry && cd hello_foundry |
This only correctly fixes the foundryup issue for exiting. The issue for rate limiting is still here. The correct way to solve the rate limiting issue would be the following: Conditional API Request for ETag version check
Conditional ETag check for downloading binary examplethe download() {
local url=$1
local output=$2
if [ -z "$GITHUB_API_SHA" ]; then
err "GITHUB_API_SHA is missing. Set the SHA for comparison."
fi
local etag_header=""
if [ -n "$GITHUB_API_ETAG" ]; then
etag_header="--header 'If-None-Match: \"$GITHUB_API_ETAG\"'"
fi
if check_cmd curl; then
response=$(curl -#L -w "%{http_code}" -o "$output" $etag_header \
--header "X-GitHub-Api-Version:2022-11-28" \
--header "Accept: application/vnd.github.sha" \
-D - "$url")
new_etag=$(echo "$response" | grep -i '^ETag:' | awk '{print $2}' | tr -d '\r')
if [ "$response" = "304" ]; then
say "No update needed, file is current"
return 0
else
GITHUB_API_ETAG="$new_etag"
fi
else
response=$(wget --header "If-None-Match: \"$GITHUB_API_ETAG\"" \
--header "X-GitHub-Api-Version:2022-11-28" \
--header "Accept: application/vnd.github.sha" \
-O "$output" "$url" -S --quiet 2>&1)
new_etag=$(echo "$response" | grep -i '^ETag:' | awk '{print $2}' | tr -d '\r')
if [[ "$response" != *"304 Not Modified"* ]]; then
GITHUB_API_ETAG="$new_etag"
fi
fi
computed_sha=$(sha256sum "$output" | awk '{print $1}')
if [ "$computed_sha" != "$GITHUB_API_SHA" ]; then
say "SHA mismatch! Expected: $GITHUB_API_SHA, Got: $computed_sha"
return 1
else
say "SHA matches the expected value."
fi
} |
This issue seems to have been fixed by #6155 which removed API requests from the script. |
Getting intermittent failures from foundryup in
slither-action
as seen here. The error doesn't seem abort the script and foundryup reports that it finished installing.In the first two lines we see curl returns 403 status and the next line shows
nightly-
.What seems to be failing is this request:
foundry/foundryup/foundryup
Lines 79 to 84 in f10df79
Unauthenticated requests to the GitHub API are heavily rate limited:
This seems to make
foundryup
not well suited for CI environments in its current form. Perhaps it should use thenightly
tag without a commit hash?Consider using
set -o pipefail
in addition toset -e
. I think this is why the error doesn't abort the script.The text was updated successfully, but these errors were encountered: