Skip to content
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

Fix PR Build Failures Due to Hugo Version Mismatch #1495

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ibrahimjaved12
Copy link
Contributor

@ibrahimjaved12 ibrahimjaved12 commented Jan 21, 2025

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/6548

Description (What does it do?)

Hugo's latest version is 0.141.0, whereas:

  1. In our codebase, we use 0.112.7.
  2. For our PR checks, we use latest version.
    Which means, if latest version has any breaking changes, they would have an effect on our PR checks. Which is why our build is currently failing with the errors:

execute of template failed: template: partials/featured_course_cards.html:27:24: executing "partials/featured_course_cards.html" at <.Err>: can't evaluate field Err in type resource.Resource: Resource.Err was removed in Hugo v0.141.0 and replaced with a new try keyword, see
We could fix them by using try keyword, but we would still have a version mismatch between what we use for production, and what we use for these tests.

Apart from this, there are more breaking changes in the latest version so we would have to incrementally upgrade Hugo to get there.

This PR upgrades Hugo version from 0.112.7 to 0.115.4.

Additional Context - Why 0.115.4?

From 0.115.4 to 0.117.0 it seems there are some internal changes due to which our jest tests became super slow.
FAIL tests-e2e/jest/build-failures.test.ts (24.125 s)

  OCW Build Failures
    ✓ Instructor static API errors crash build (1076 ms)
    ✕ Instructor static API errors crash build (5010 ms)
    ✓ Featured course static API failures (1[13](https://github.com/mitodl/ocw-hugo-themes/actions/runs/12903355910/job/35978461722#step:6:14)6 ms)
    ✕ Featured course static API failures (5017 ms)
    ✓ Featured course static API failures (1898 ms)
    ✕ Featured course static API failures (5017 ms)

The 3 tests fail because of timeout. After removing the timeout, they pass at 152 seconds:

 PASS  tests-e2e/jest/build-failures.test.ts (152.508 s)
  OCW Build Failures
    ✓ Instructor static API errors crash build (2141 ms)
    ✓ Instructor static API errors crash build (84098 ms)
    ✓ Featured course static API failures (1200 ms)
    ✓ Featured course static API failures (30646 ms)
    ✓ Featured course static API failures (1176 ms)
    ✓ Featured course static API failures (30670 ms)

For 0.117.0, the release notes indicate:

  • testing: Write test caches to /tmp
  • Add retry in resources.GetRemote for temporary HTTP errors

Particularly, the second one seems related, where it adds exponential backoff for retry for HTTP errors. The tests that are taking much longer time actually have 504 in them. From the code in Hugo PR for 0.117.0:
temporaryHTTPCodes := []int{408, 429, 500, 502, 503, 504}

So for now, I'm upgrading to 0.115.4 to fix the breaking build check on our PRs. But I shared the R&D because it may be helpful for next upgrade.

How can this be tested?

Run yarn install
Run yarn start course and yarn start www and make sure everything is working fine.
For detailed testing, you can follow this PR instructions: #1167

@github-actions github-actions bot temporarily deployed to pull request January 21, 2025 15:19 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 21, 2025 15:19 Inactive
Copy link

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ibrahimjaved12 ibrahimjaved12 changed the title Fix PR build failure caused by Hugo resource.Err removal in 0.141.0 Fix PR build failure caused by Hugo resource.Err removal Jan 21, 2025
@ibrahimjaved12 ibrahimjaved12 force-pushed the fix-hugo-resource-Err-removal branch from bd56a76 to 082fbc3 Compare January 22, 2025 07:01
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:18 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:18 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:24 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:24 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:34 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:34 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:40 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:41 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:51 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:51 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:59 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 07:59 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 09:43 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 09:43 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 22, 2025 09:47 Inactive
@ibrahimjaved12 ibrahimjaved12 changed the title Fix PR build failure caused by Hugo resource.Err removal Fix PR build failure caused by resource.Err removal in latest version Jan 22, 2025
@ibrahimjaved12 ibrahimjaved12 changed the title Fix PR build failure caused by resource.Err removal in latest version Fix PR Build Failures Due to Hugo Version Mismatch Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant