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

Check potential output format issue with output formats in hugo server on GitHub action #11089

Closed
bep opened this issue Jun 13, 2023 · 6 comments · Fixed by #11099
Closed

Check potential output format issue with output formats in hugo server on GitHub action #11089

bep opened this issue Jun 13, 2023 · 6 comments · Fixed by #11099

Comments

@bep
Copy link
Member

bep commented Jun 13, 2023

https://discourse.gohugo.io/t/hugo-serve-randomly-fails-to-load-pages-and-alias/44771/8

This isn't obvious to me, but I will try to read through the code to see what may happen. If someone have a project that somehow reproduces this reliably, please shout.

@jmichelgarcia
Copy link

jmichelgarcia commented Jun 13, 2023

Hey @bep, it took some time but I think I was able to reproduce on a slimmed and public repository.

Clean build:

  • 4 pages
  • 3 aliases
hugo: collected modules in 692 ms
Start building sites … 
hugo v0.113.0+extended linux/amd[6](https://github.com/jmichelgarcia/docs-temp-2/actions/runs/5254069557/jobs/9492217795#step:7:7)4 BuildDate=unknown
WARN 2023/06/13 10:05:5[7](https://github.com/jmichelgarcia/docs-temp-2/actions/runs/5254069557/jobs/9492217795#step:7:8) .File.UniqueID on zero object. Wrap it in if or with: {{ with .File }}{{ .UniqueID }}{{ end }}

                   | EN | FR  
-------------------+----+-----
  Pages            |  4 |  0  
  Paginator pages  |  0 |  0  
  Non-page files   |  0 |  0  
  Static files     | 33 | 33  
  Processed images |  0 |  0  
  Aliases          |  3 |  0  
  Sitemaps         |  0 |  0  
  Cleaned          |  0 |  0  

Total in 11[8](https://github.com/jmichelgarcia/docs-temp-2/actions/runs/5254069557/jobs/9492217795#step:7:9)5 ms

Glitched build

  • 1 page
  • no aliases
hugo: collected modules in 1259 ms
Start building sites … 
hugo v0.113.0+extended linux/amd[6](https://github.com/jmichelgarcia/docs-temp-2/actions/runs/5254100494/jobs/9492291541#step:7:7)4 BuildDate=unknown

                   | EN | FR  
-------------------+----+-----
  Pages            |  1 |  0  
  Paginator pages  |  0 |  0  
  Non-page files   |  0 |  0  
  Static files     | 33 | 33  
  Processed images |  0 |  0  
  Aliases          |  0 |  0  
  Sitemaps         |  1 |  0  
  Cleaned          |  0 |  0  

Total in 12[9](https://github.com/jmichelgarcia/docs-temp-2/actions/runs/5254100494/jobs/9492291541#step:7:10)3 ms

I can also successfully reproduce locally, by simply executing the below command several times

hugo --config hugo.toml --configDir config --disableKinds=taxonomy,term,rss,sitemap,robotsTXT --noBuildLock --noChmod --noTimes --watch=false --enableGitInfo=false -e development

docs-temp-2 git:(main) hugo --config hugo.toml --configDir config --disableKinds=taxonomy,term,rss,sitemap,robotsTXT --noBuildLock --noChmod --noTimes --watch=false --enableGitInfo=false -e development
Start building sites … 
hugo v0.113.0+extended darwin/arm64 BuildDate=unknown
WARN 2023/06/13 11:19:15 .File.UniqueID on zero object. Wrap it in if or with: {{ with .File }}{{ .UniqueID }}{{ end }}

                   | EN | FR  
-------------------+----+-----
  Pages            |  4 |  0  
  Paginator pages  |  0 |  0  
  Non-page files   |  0 |  0  
  Static files     | 33 | 33  
  Processed images |  0 |  0  
  Aliases          |  3 |  0  
  Sitemaps         |  0 |  0  
  Cleaned          |  0 |  0  

Total in 410 ms
➜  docs-temp-2 git:(main) hugo --config hugo.toml --configDir config --disableKinds=taxonomy,term,rss,sitemap,robotsTXT --noBuildLock --noChmod --noTimes --watch=false --enableGitInfo=false -e development
Start building sites … 
hugo v0.113.0+extended darwin/arm64 BuildDate=unknown
WARN 2023/06/13 11:19:17 .File.UniqueID on zero object. Wrap it in if or with: {{ with .File }}{{ .UniqueID }}{{ end }}

                   | EN | FR  
-------------------+----+-----
  Pages            |  4 |  0  
  Paginator pages  |  0 |  0  
  Non-page files   |  0 |  0  
  Static files     | 33 | 33  
  Processed images |  0 |  0  
  Aliases          |  3 |  0  
  Sitemaps         |  0 |  0  
  Cleaned          |  0 |  0  

Total in 389 ms
➜  docs-temp-2 git:(main) hugo --config hugo.toml --configDir config --disableKinds=taxonomy,term,rss,sitemap,robotsTXT --noBuildLock --noChmod --noTimes --watch=false --enableGitInfo=false -e development
Start building sites … 
hugo v0.113.0+extended darwin/arm64 BuildDate=unknown

                   | EN | FR  
-------------------+----+-----
  Pages            |  1 |  0  
  Paginator pages  |  0 |  0  
  Non-page files   |  0 |  0  
  Static files     | 33 | 33  
  Processed images |  0 |  0  
  Aliases          |  0 |  0  
  Sitemaps         |  1 |  0  
  Cleaned          |  0 |  0  

Total in 113 ms

My intuition is telling me that it could be related to my configs:

  • _default
    • hugo.toml
  • production
    • hugo.toml

When I delete production/hugo.toml, then I cannot reproduce this locally anymore. When I add it back, the build randomly glitches.


I just did some tests locally (tried to break it starting from 110, and from my tests this glitches was introduced as part of 112

hugo v0.112.0-0a95d6704a8ac8d41cc5ca8fffaad8c5c7a3754a+extended darwin/arm64 BuildDate=2023-05-23T08:14:20Z VendorInfo=gohugoio
➜  docs-temp-2 git:(main) ✗ npm run break-it                            

> docs@0.0.1 break-it
> hugo --config hugo.toml --configDir config --disableKinds=taxonomy,term,rss,sitemap,robotsTXT --noBuildLock --noChmod --noTimes --watch=false --enableGitInfo=false -e development --debug

Start building sites … 
hugo v0.112.0-0a95d6704a8ac8d41cc5ca8fffaad8c5c7a3754a+extended darwin/arm64 BuildDate=2023-05-23T08:14:20Z VendorInfo=gohugoio
INFO 2023/06/13 11:46:57 syncing static files to /
INFO 2023/06/13 11:46:57 process in 0 ms
INFO 2023/06/13 11:46:57 assemble in 0 ms
INFO 2023/06/13 11:46:57 render in 2 ms
INFO 2023/06/13 11:46:57 postProcess in 0 ms

                   | EN | FR  
-------------------+----+-----
  Pages            |  1 |  0  
  Paginator pages  |  0 |  0  
  Non-page files   |  0 |  0  
  Static files     | 33 | 33  
  Processed images |  0 |  0  
  Aliases          |  0 |  0  
  Sitemaps         |  1 |  0  
  Cleaned          |  0 |  0  

@bep
Copy link
Member Author

bep commented Jun 13, 2023

@jmichelgarcia OK, I can reproduce this too (but very rarely), thanks a lot, much appreciated.

@bep
Copy link
Member Author

bep commented Jun 13, 2023

This bash script fails every time:

#!/bin/bash
for i in {1..100} 
do
    rm -rf public
    hugo --quiet --config hugo.toml --configDir config --disableKinds=taxonomy,term,rss,sitemap,robotsTXT --noBuildLock --noChmod --noTimes --watch=false --enableGitInfo=false -e development
    size=`tree public | wc -l`
    expect=57
    if [ $size -ne $expect ]
    then
        echo "[$i] Expected $expect lines, got $size"
        exit 1
    fi
done

@bep
Copy link
Member Author

bep commented Jun 13, 2023

OK, the problems seem to be an ordering/merge issue with disableKinds (flag vs site config vs language config). Not sure exactly, but if you set these per language, things behaves:

[languages]
  [languages.en]
    disableKinds = ["taxonomy", "term", "rss", "sitemap", "robotsTXT"]
    title        = "Documentation"
    languageName = "English"
    languageCode = "en"
    staticDir    = "static"
    contentDir   = "content/en"
  [languages.fr]
    title = "Documentation"
    languageName = "French"
    languageCode = "fr"
    contentDir = "content/fr"
    staticDir = "static_fr"
    disableKinds = [
      "page",
      "home",
      "section",
      "taxonomy",
      "taxonomyTerm",
      "rss",
      "sitemap",
      "robotsTXT",
      "404",
    ]

bep added a commit to bep/hugo that referenced this issue Jun 13, 2023
Fixes gohugoio#11089

~/d/g/g/hugo ❯❯❯ git resetf                   fix/myseryconfigissue-11089 ✭ ✱
@jmichelgarcia
Copy link

Thanks @bep. Really helpful.

@github-actions
Copy link

github-actions bot commented Jul 5, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants