make curl error on non success status codes

By default something like a 404 will not make curl exit with an error
code. This is problematic for obvious reasons and instead of the file
you want you may now have some 404 html text instead.

I noticed this in #28003 which well just build fine installers except
the binary downloaded by the installer Makefile simply did not exist.

So to address that add --fail to most curl commands.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2026-02-06 17:29:49 +01:00
parent 0843c6ee1c
commit af7c36eae3
8 changed files with 15 additions and 15 deletions

View File

@@ -29,7 +29,7 @@ jobs:
- name: Get version - name: Get version
id: getversion id: getversion
run: | run: |
VERSION=$(curl "https://raw.githubusercontent.com/$PODMAN_REPO/$SHA/version/rawversion/version.go" | sed -n 's/^const RawVersion = \"\([0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\|-dev\)\?\)"$/\1/p') VERSION=$(curl --fail "https://raw.githubusercontent.com/$PODMAN_REPO/$SHA/version/rawversion/version.go" | sed -n 's/^const RawVersion = \"\([0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\|-dev\)\?\)"$/\1/p')
# ignore -dev version bumps unless on main # ignore -dev version bumps unless on main
if [[ -z "$VERSION" ]] ; then if [[ -z "$VERSION" ]] ; then
echo "::error:: Invalid version string" echo "::error:: Invalid version string"
@@ -48,7 +48,7 @@ jobs:
- name: Check machine-os-branch - name: Check machine-os-branch
if: steps.getversion.outputs.update == 'true' if: steps.getversion.outputs.update == 'true'
run: | run: |
if ! curl -s "https://api.github.com/repos/$UPSTREAM_MACHINE_OS/branches" | jq -e --arg branch "${GITHUB_BASE_REF}" '.[] | select(.name==$branch)'; then if ! curl --fail -s "https://api.github.com/repos/$UPSTREAM_MACHINE_OS/branches" | jq -e --arg branch "${GITHUB_BASE_REF}" '.[] | select(.name==$branch)'; then
echo "::error:: Release branch does not exist." echo "::error:: Release branch does not exist."
echo "::error:: Please push $branch to $UPSTREAM_MACHINE_OS, then re-run this task." echo "::error:: Please push $branch to $UPSTREAM_MACHINE_OS, then re-run this task."
exit 1 exit 1

View File

@@ -289,7 +289,7 @@ jobs:
title="${title/rc/"RC"}" title="${title/rc/"RC"}"
else else
# check if this version should not be marked latest # check if this version should not be marked latest
prevrelease=$(curl --retry 3 --silent -m 10 --connect-timeout 5 "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest") prevrelease=$(curl --fail --retry 3 --silent -m 10 --connect-timeout 5 "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest")
prevvers=$(echo "$prevrelease" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -e "s/^v//") prevvers=$(echo "$prevrelease" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -e "s/^v//")
vers=${VERSION#"v"} vers=${VERSION#"v"}
echo "${prevvers},${vers}" echo "${prevvers},${vers}"

View File

@@ -852,8 +852,8 @@ win-gvproxy-%: test/version/version
$(eval GVPROXY_FILENAME := $(if $(filter arm64,$(GOARCH)), gvproxy-windows-arm64.exe,gvproxy-windowsgui.exe)) $(eval GVPROXY_FILENAME := $(if $(filter arm64,$(GOARCH)), gvproxy-windows-arm64.exe,gvproxy-windowsgui.exe))
$(eval SSHPROXY_FILENAME := $(if $(filter arm64,$(GOARCH)), win-sshproxy-arm64.exe, win-sshproxy.exe)) $(eval SSHPROXY_FILENAME := $(if $(filter arm64,$(GOARCH)), win-sshproxy-arm64.exe, win-sshproxy.exe))
mkdir -p bin/windows/ mkdir -p bin/windows/
curl -sSL -o bin/windows/gvproxy.exe --retry 5 https://github.com/containers/gvisor-tap-vsock/releases/download/$(GVPROXY_VERSION)/$(GVPROXY_FILENAME) curl --fail -sSL -o bin/windows/gvproxy.exe --retry 5 https://github.com/containers/gvisor-tap-vsock/releases/download/$(GVPROXY_VERSION)/$(GVPROXY_FILENAME)
curl -sSL -o bin/windows/win-sshproxy.exe --retry 5 https://github.com/containers/gvisor-tap-vsock/releases/download/$(GVPROXY_VERSION)/$(SSHPROXY_FILENAME) curl --fail -sSL -o bin/windows/win-sshproxy.exe --retry 5 https://github.com/containers/gvisor-tap-vsock/releases/download/$(GVPROXY_VERSION)/$(SSHPROXY_FILENAME)
.PHONY: rpm .PHONY: rpm
rpm: ## Build rpm packages rpm: ## Build rpm packages

View File

@@ -70,7 +70,7 @@ query="{
}\" }\"
}" }"
result=$(curl -s -H "Authorization: bearer $CIRRUS_REPO_CLONE_TOKEN" -H "Accept: application/vnd.github.antiope-preview+json" -H "Content-Type: application/json" -X POST --data @- https://api.github.com/graphql <<<"$query") result=$(curl --fail -s -H "Authorization: bearer $CIRRUS_REPO_CLONE_TOKEN" -H "Accept: application/vnd.github.antiope-preview+json" -H "Content-Type: application/json" -X POST --data @- https://api.github.com/graphql <<<"$query")
labels=$(jq -r '.data.repository.pullRequest.labels.nodes[].name' <<<"$result") labels=$(jq -r '.data.repository.pullRequest.labels.nodes[].name' <<<"$result")

View File

@@ -52,7 +52,7 @@ query="{
}\" }\"
}" }"
result=$(curl -s -H "Authorization: bearer $CIRRUS_REPO_CLONE_TOKEN" -H "Accept: application/vnd.github.antiope-preview+json" -H "Content-Type: application/json" -X POST --data @- https://api.github.com/graphql <<<"$query") result=$(curl --fail -s -H "Authorization: bearer $CIRRUS_REPO_CLONE_TOKEN" -H "Accept: application/vnd.github.antiope-preview+json" -H "Content-Type: application/json" -X POST --data @- https://api.github.com/graphql <<<"$query")
labels=$(jq -r '.data.repository.pullRequest.labels.nodes[]?.name' <<<"$result") labels=$(jq -r '.data.repository.pullRequest.labels.nodes[]?.name' <<<"$result")

View File

@@ -360,7 +360,7 @@ case "$TEST_FLAVOR" in
;; ;;
compose_v2) compose_v2)
showrun dnf -y remove docker-compose showrun dnf -y remove docker-compose
showrun curl -SL https://github.com/docker/compose/releases/download/v2.32.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose showrun curl --fail -SL https://github.com/docker/compose/releases/download/v2.32.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
showrun chmod +x /usr/local/bin/docker-compose showrun chmod +x /usr/local/bin/docker-compose
;& # Continue with next item ;& # Continue with next item
apiv2) apiv2)

View File

@@ -25,15 +25,15 @@ podman_version:
$(TMP_BIN)/gvproxy: $(TMP_BIN)/gvproxy:
mkdir -p $(TMP_BIN) mkdir -p $(TMP_BIN)
cd $(TMP_BIN) && curl -sLo gvproxy $(GVPROXY_RELEASE_URL) cd $(TMP_BIN) && curl --fail -sLo gvproxy $(GVPROXY_RELEASE_URL)
$(TMP_BIN)/vfkit: $(TMP_BIN)/vfkit:
mkdir -p $(TMP_BIN) mkdir -p $(TMP_BIN)
cd $(TMP_BIN) && curl -sLo vfkit $(VFKIT_RELEASE_URL) cd $(TMP_BIN) && curl --fail -sLo vfkit $(VFKIT_RELEASE_URL)
$(TMP_BIN)/krunkit.tgz: $(TMP_BIN)/krunkit.tgz:
mkdir -p $(TMP_BIN) mkdir -p $(TMP_BIN)
cd $(TMP_BIN) && curl -sLo krunkit.tgz $(KRUNKIT_RELEASE_URL) cd $(TMP_BIN) && curl --fail -sLo krunkit.tgz $(KRUNKIT_RELEASE_URL)
packagedir: podman_version package_root Distribution welcome.html packagedir: podman_version package_root Distribution welcome.html
mkdir -p $(PACKAGE_DIR) mkdir -p $(PACKAGE_DIR)

View File

@@ -106,12 +106,12 @@ function Win-SSHProxy {
} }
Write-Host "Downloading gvproxy version $version" Write-Host "Downloading gvproxy version $version"
if ($architecture -eq 'amd64') { if ($architecture -eq 'amd64') {
curl.exe -sSL -o './bin/windows/gvproxy.exe' --retry 5 "https://github.com/containers/gvisor-tap-vsock/releases/download/$Version/gvproxy-windowsgui.exe" curl.exe --fail -sSL -o './bin/windows/gvproxy.exe' --retry 5 "https://github.com/containers/gvisor-tap-vsock/releases/download/$Version/gvproxy-windowsgui.exe"
curl.exe -sSL -o './bin/windows/win-sshproxy.exe' --retry 5 "https://github.com/containers/gvisor-tap-vsock/releases/download/$Version/win-sshproxy.exe" curl.exe --fail -sSL -o './bin/windows/win-sshproxy.exe' --retry 5 "https://github.com/containers/gvisor-tap-vsock/releases/download/$Version/win-sshproxy.exe"
} }
else { else {
curl.exe -sSL -o './bin/windows/gvproxy.exe' --retry 5 "https://github.com/containers/gvisor-tap-vsock/releases/download/$Version/gvproxy-windows-arm64.exe" curl.exe --fail -sSL -o './bin/windows/gvproxy.exe' --retry 5 "https://github.com/containers/gvisor-tap-vsock/releases/download/$Version/gvproxy-windows-arm64.exe"
curl.exe -sSL -o './bin/windows/win-sshproxy.exe' --retry 5 "https://github.com/containers/gvisor-tap-vsock/releases/download/$Version/win-sshproxy-arm64.exe" curl.exe --fail -sSL -o './bin/windows/win-sshproxy.exe' --retry 5 "https://github.com/containers/gvisor-tap-vsock/releases/download/$Version/win-sshproxy-arm64.exe"
} }
} }