Skip to content

Upgrade Hugo to 0.163.3 and add Playwright E2E tests#731

Draft
rossigee wants to merge 38 commits into
goharbor:mainfrom
rossigee:docs/dockerfile-display
Draft

Upgrade Hugo to 0.163.3 and add Playwright E2E tests#731
rossigee wants to merge 38 commits into
goharbor:mainfrom
rossigee:docs/dockerfile-display

Conversation

@rossigee

Copy link
Copy Markdown

Summary

  • Upgrade Hugo from 0.74.0 (2020) to 0.163.3 (latest stable)
  • Fix breaking changes: markdownify on template.HTML, disableKinds taxonomy rename, mediaTypes config, toCSS → css.Sass
  • Add Playwright E2E test suite validating breaking changes are fixed
  • Update npm dependencies to latest versions (autoprefixer, bulma, postcss-cli)
  • Add GitHub Actions test workflow for CI/CD
  • Fix .gitignore to not track generated cli-docs content

Test plan

✅ All 5 Playwright E2E tests passing
✅ Production build succeeds
✅ _redirects file generated correctly
✅ CSS pipeline works with updated packages
✅ No npm audit vulnerabilities
✅ All commits signed-off (DCO)

Files changed

  • Hugo version pins: netlify.toml, Dockerfile
  • Template fixes: layouts/partials/admonition.html, layouts/partials/css.html
  • Configuration: config.toml (disableKinds, mediaTypes)
  • Tests: e2e/breaking-changes.spec.ts, playwright.config.ts
  • CI/CD: .github/workflows/test.yml
  • Dependencies: package.json (npm packages and Playwright test suite)
  • Documentation: README.md, Makefile
  • Cleanup: Removed unused version.html shortcode, cli-docs from git tracking

@rossigee rossigee requested review from a team as code owners June 30, 2026 11:42
@rossigee rossigee force-pushed the docs/dockerfile-display branch from f530836 to 1bfd5f4 Compare June 30, 2026 11:44
rossigee added 7 commits June 30, 2026 18:44
Breaking changes fixed:
- markdownify on template.HTML: Add string cast in admonition.html
- disableKinds: Rename taxonomyTerm to term in config.toml
- mediaTypes: Replace delimiter with suffixes array
- toCSS: Replace with css.Sass function
- Removed unused version.html shortcode

New features:
- Add Playwright E2E test suite to validate breaking changes are fixed
- Tests cover admonition rendering, custom output formats, CSS pipeline
- Update Dockerfile and netlify.toml to pin Hugo 0.163.3
- Simplify CSS pipeline and remove unreliable .Site.IsServer usage

Signed-off-by: Ross Golder <ross@golder.org>
- autoprefixer: 9.8.5 → 10.5.2
- bulma: 0.8.2 → 1.0.4
- postcss-cli: 7.1.2 → 11.0.1

Verified CSS pipeline still works correctly with new versions.
Fixed npm audit vulnerabilities (picomatch ReDoS).

Signed-off-by: Ross Golder <ross@golder.org>
- Use docs page with admonitions instead of blog post
- Remove toBeVisible() checks on metadata elements (always hidden)
- Separate CSS pipeline live test from fingerprinting validation
- All 5 tests now pass successfully

Signed-off-by: Ross Golder <ross@golder.org>
- Document Playwright E2E tests in README
- Add 'make test' and 'make test-ui' targets
- Tests validate Hugo breaking changes are fixed

Signed-off-by: Ross Golder <ross@golder.org>
Signed-off-by: Ross Golder <ross@golder.org>
The content/cli-docs/ directory is generated at build time by cli-docs.sh,
similar to content/docs/. It should not be tracked in git.

This reverts the accidental tracking added in PR goharbor#645 by untracking the 109
generated files and adding content/cli-docs/ to .gitignore.

Signed-off-by: Ross Golder <ross@golder.org>
Runs on all PRs and pushes to main:
- Build validation with Hugo 0.163.3
- Playwright E2E tests with Chromium
- YAML and whitespace linting

Artifacts:
- build-output: public/ directory (5-day retention)
- playwright-report: test results (7-day retention)

Signed-off-by: Ross Golder <ross@golder.org>
@rossigee rossigee force-pushed the docs/dockerfile-display branch from 1bfd5f4 to b62e50a Compare June 30, 2026 11:45
rossigee added 2 commits June 30, 2026 18:49
- .nvmrc: 14.11.0 (EOL) → 20 (LTS until April 2026)
- GitHub Actions workflow: 18 (EOL) → 20

Node 14 is 3 years past EOL. Node 20 is stable LTS.

Signed-off-by: Ross Golder <ross@golder.org>
v1.2.4 was from 2019. v2.1.2 is the latest stable version
with bug fixes and improvements.

Signed-off-by: Ross Golder <ross@golder.org>
@rossigee rossigee force-pushed the docs/dockerfile-display branch from 3021477 to 9f2d002 Compare June 30, 2026 11:50
rossigee added 5 commits June 30, 2026 18:50
Keep the conditional logic for dev vs prod CSS generation:
- Dev (hugo server): unfingerprinted CSS with source maps
- Prod (hugo build): fingerprinted, minified CSS with PostCSS

Uses .Site.BuildDrafts to detect dev mode (set by 'hugo server').
Preserves original optimization while using css.Sass function.

Signed-off-by: Ross Golder <ross@golder.org>
Resolves merge conflict by using main's site.IsServer detection
while keeping the critical toCSS → css.Sass upgrade needed for Hugo 0.163.3

Signed-off-by: Ross Golder <ross@golder.org>
Guard .File access with conditional check to prevent nil dereference
on pages without file metadata (e.g., homepage).

Signed-off-by: Ross Golder <ross@golder.org>
site.IsServer (lowercase) is not available in template context.
.Site.BuildDrafts is reliably set by 'hugo server' for dev detection.

Signed-off-by: Ross Golder <ross@golder.org>
Guard .File access with conditional check to prevent nil dereference.

Signed-off-by: Ross Golder <ross@golder.org>
@rossigee rossigee marked this pull request as draft June 30, 2026 12:00
rossigee added 4 commits June 30, 2026 19:04
Guard all .File accesses with conditional checks to handle pages
without file metadata (e.g., section list pages, homepage).

Signed-off-by: Ross Golder <ross@golder.org>
- Add 'sass' npm package (Dart Sass) for Bulma 1.0.4 compatibility
- Replace deprecated .Site.BuildDrafts with hugo.IsServer
- Dart Sass handles modern Sass features that LibSass cannot compile
- Hugo automatically uses Dart Sass when sass binary is in PATH

Signed-off-by: Ross Golder <ross@golder.org>
Signed-off-by: Ross Golder <ross@golder.org>
Ensures sass (Dart Sass) is available in node_modules/.bin for Hugo to use.
Without this, Hugo falls back to LibSass which cannot compile Bulma 1.0.x.

Signed-off-by: Ross Golder <ross@golder.org>
@rossigee rossigee force-pushed the docs/dockerfile-display branch from 609e6ce to 33dbd5a Compare June 30, 2026 12:19
rossigee added 2 commits June 30, 2026 19:21
npm install adds node_modules/.bin to PATH temporarily, but it's lost
when make commands run in a new shell context. Explicitly set PATH
to include node_modules/.bin so Hugo finds the sass binary.

Signed-off-by: Ross Golder <ross@golder.org>
Signed-off-by: Ross Golder <ross@golder.org>
rossigee added 16 commits June 30, 2026 19:28
Don't set PATH in environment (breaks Netlify's dependency installation).
Instead, pass PATH explicitly to make commands in the same shell context
where npm install has run, ensuring sass binary is available to Hugo.

Signed-off-by: Ross Golder <ross@golder.org>
Make needs PATH to be exported so child processes (Hugo) can access
the sass binary from node_modules/.bin. Use relative path for portability.

Signed-off-by: Ross Golder <ross@golder.org>
Use npm ci (clean install) in all build contexts.
Netlify automatically adds node_modules/.bin to PATH after npm install,
so no need for complex PATH manipulation in commands.

Signed-off-by: Ross Golder <ross@golder.org>
Bulma 1.0.x requires Dart Sass which adds complexity to the build pipeline.
Bulma 0.9.4 works with Hugo's built-in LibSass transpiler.
Simplify netlify.toml - Netlify auto-handles npm install.

Signed-off-by: Ross Golder <ross@golder.org>
Signed-off-by: Ross Golder <ross@golder.org>
Add transpiler: dartsass to css.Sass options in template.
Upgrade Bulma back to 1.0.4 which requires Dart Sass.
Netlify will have access to dart-sass via npm package.

Signed-off-by: Ross Golder <ross@golder.org>
Download official Dart Sass CLI from GitHub releases instead of
relying on npm wrapper. Hugo needs the actual executable, not JavaScript wrapper.
Run setup script before build to install sass to node_modules/.bin

Signed-off-by: Ross Golder <ross@golder.org>
The sass binary wrapper needs the full dart-sass directory structure
to work correctly. Extract to temp dir and copy everything to node_modules/.bin

Signed-off-by: Ross Golder <ross@golder.org>
The npm sass package was interfering with our Dart Sass setup script.
Since we're downloading the precompiled Dart Sass binary, we don't need
the npm wrapper package.

Signed-off-by: Ross Golder <ross@golder.org>
Dart Sass is stricter than LibSass about syntax. Indented Sass syntax
requires semicolons at end of statements when using Dart Sass.

Signed-off-by: Ross Golder <ross@golder.org>
Revert semicolon addition - indented Sass doesn't allow them.
Comment out problematic mergeColorMaps call to get build working.
Can revisit color customizations after basic build passes.

Signed-off-by: Ross Golder <ross@golder.org>
The Dart Sass binary is in place via setup script. mergeColorMaps uses
meta.type-of() which is Dart Sass only. Function is imported globally
via 'bulma/sass/utilities/functions' and is now usable.

Signed-off-by: Ross Golder <ross@golder.org>
mergeColorMaps with complex nested params doesn't parse in Dart Sass
with indented Sass syntax. Bulma 1.0.4 provides sufficient default colors.
Removed custom secondary, twitter-blue, slack-green color definitions.

Signed-off-by: Ross Golder <ross@golder.org>
Signed-off-by: Ross Golder <ross@golder.org>
Dart Sass has issues parsing mixed .sass/.scss imports.
The utilities/_all and base/_all imports should provide all needed Bulma styles.

Signed-off-by: Ross Golder <ross@golder.org>
Hugo templates cannot run inside Sass files before compilation.
Removed dynamic font and color configuration - use Bulma defaults only.
Font/color customization should be handled outside the Sass pipeline.

Signed-off-by: Ross Golder <ross@golder.org>
@rossigee rossigee force-pushed the docs/dockerfile-display branch from ddc7f70 to f147c85 Compare June 30, 2026 23:36
@rossigee

Copy link
Copy Markdown
Author

Other than the Netlify failures and the weird 'conflict' claims here, and despite the huge six year gap the upgrades have covered, the branch itself actually works well running locally and compares well with the live site.

Right now, I need some assistance understanding the remaining Netlify failures and why GitHub insists these files are conflicts despite them not showing as such locally or from a fresh checkout. My AI agents can't figure it out and think GH has something cached, and sugggest raising a new PR, but I'm not so sure about the explanation, and I tried it once (#730) and it made no difference.

This commit contains only Hugo/Bulma framework updates and configuration
changes. The new viewing-artifact-dockerfile documentation has been moved
to the docs/viewing-artifact-dockerfile branch as a separate feature.
@rossigee rossigee force-pushed the docs/dockerfile-display branch from 873773f to b5a7481 Compare July 1, 2026 01:01
@OrlinVasilev

Copy link
Copy Markdown
Member

thank you for that contribution can you slipt that in to few PRs ?:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants