Harden Hugo release download retries in deploy workflows (#320)
* Initial plan * Harden Hugo release download retries --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot committed
Jun 8, 2026 at 09:33 UTC
9dfab9f36a2a6144955b91a54588f2b3a24361c2
3 files changed
+30
-4
.github/workflows/crawl-and-publish.yml
+2
-2
@@ -1085,9 +1085,9 @@ jobs:
1085
RELEASE_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}"
1086
TARBALL="hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
1087
CHECKSUM_FILE="hugo_${HUGO_VERSION}_checksums.txt"
1088
- curl --fail --silent --show-error --location --retry 5 --retry-delay 2 --retry-all-errors \
1088
+ curl --fail --silent --show-error --location --retry 10 --retry-delay 5 --retry-max-time 300 --retry-all-errors \
1089
--output "${TARBALL}" "${RELEASE_URL}/${TARBALL}"
1090
- curl --fail --silent --show-error --location --retry 5 --retry-delay 2 --retry-all-errors \
1090
+ curl --fail --silent --show-error --location --retry 10 --retry-delay 5 --retry-max-time 300 --retry-all-errors \
1091
--output "${CHECKSUM_FILE}" "${RELEASE_URL}/${CHECKSUM_FILE}"
1092
checksum_line="$(awk -v file="${TARBALL}" '$NF == file {print; found=1} END {if (!found) exit 1}' "${CHECKSUM_FILE}")" || {
1093
echo "Error: No checksum entry for ${TARBALL} found in ${CHECKSUM_FILE}" >&2
.github/workflows/deploy-site.yml
+2
-2
@@ -52,11 +52,11 @@ jobs:
52
RELEASE_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}"
53
TARBALL="hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
54
CHECKSUM_FILE="hugo_${HUGO_VERSION}_checksums.txt"
55
- curl --fail --silent --show-error --location --retry 5 --retry-delay 2 --retry-all-errors \
55
+ curl --fail --silent --show-error --location --retry 10 --retry-delay 5 --retry-max-time 300 --retry-all-errors \
56
--output "${TARBALL}" "${RELEASE_URL}/${TARBALL}"
57
58
# Download and verify checksums
59
- curl --fail --silent --show-error --location --retry 5 --retry-delay 2 --retry-all-errors \
59
+ curl --fail --silent --show-error --location --retry 10 --retry-delay 5 --retry-max-time 300 --retry-all-errors \
60
--output "${CHECKSUM_FILE}" "${RELEASE_URL}/${CHECKSUM_FILE}"
61
checksum_line="$(awk -v file="${TARBALL}" '$NF == file {print; found=1} END {if (!found) exit 1}' "${CHECKSUM_FILE}")" || {
62
echo "Error: No checksum entry for ${TARBALL} found in ${CHECKSUM_FILE}" >&2
tests/test_pipeline.py
+26
@@ -155,6 +155,32 @@ No press data was provided this week.
155
156
157
class WorkflowConfigTests(unittest.TestCase):
158
+ def test_hugo_install_steps_use_release_urls_and_resilient_retries(self) -> None:
159
+ expected_retry_flags = "--retry 10 --retry-delay 5 --retry-max-time 300 --retry-all-errors"
160
+
161
+ for workflow_file in (
162
+ ".github/workflows/deploy-site.yml",
163
+ ".github/workflows/crawl-and-publish.yml",
164
+ ):
165
+ workflow_path = Path(workflow_file)
166
+ workflow = yaml.safe_load(workflow_path.read_text(encoding="utf-8"))
167
+
168
+ install_step = next(
169
+ (
170
+ step
171
+ for job in workflow["jobs"].values()
172
+ for step in job.get("steps", [])
173
+ if step.get("name") == "Install Hugo"
174
+ ),
175
+ None,
176
+ )
177
+ self.assertIsNotNone(install_step, f"Install Hugo step not found in {workflow_file}")
178
+ install_run = install_step["run"]
179
+ self.assertIn('RELEASE_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}"', install_run)
180
+ self.assertIn('TARBALL="hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"', install_run)
181
+ self.assertIn('CHECKSUM_FILE="hugo_${HUGO_VERSION}_checksums.txt"', install_run)
182
+ self.assertEqual(install_run.count(expected_retry_flags), 2)
183
+
184
def test_crawl_workflow_persists_run_counter(self) -> None:
185
workflow_path = Path(".github/workflows/crawl-and-publish.yml")
186
workflow = yaml.safe_load(workflow_path.read_text(encoding="utf-8"))