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

Module version mismatch WARNINGs does not get printed to console #7285

Closed
frerich opened this issue May 18, 2020 · 7 comments
Closed

Module version mismatch WARNINGs does not get printed to console #7285

frerich opened this issue May 18, 2020 · 7 comments

Comments

@frerich
Copy link

frerich commented May 18, 2020

Hugo is progressing at an amazing pace and awesome features are added left and right. Of course, people want to benefit from those features and thus upgrade Hugo.

As it happens though, many non-trivial websites are developed by a team. It can happen that one person implements a change to e.g. the layouts which doesn't work unless you use a sufficiently recent Hugo version. Other people on the team may not have gotten around to updating Hugo yet, so their build will fail with a more or less cryptic error message.

Other software (e.g. CMake) permits describing a minimum supported version. If the currently executing version of the software is older than what's described, a useful error message including the information

  • What version you're running
  • What version you need
  • Where to get the new version

is printed.

It would be great if Hugo would support the same such that people can start using the latest features without also having to do tech support for fellow colleagues. :-)

@frerich
Copy link
Author

frerich commented May 18, 2020

One plausible implementation: support a new configuration key minimumHugoVersion which can take a string like 0.70.0 such that you can edit your config.yaml file and set e.g.

minimumHugoVersion: 0.70.0

When executing this with e.g. Hugo 0.69.1, the build could bail out right away, saying something along the lines of

This project requires Hugo 0.70.0 to build - you're currently running Hugo 0.69.1.

You can find the required Hugo version for download at

   https://github.com/gohugoio/hugo/releases/tag/v0.70.0 

@bep
Copy link
Member

bep commented May 18, 2020

See https://gohugo.io/hugo-modules/configuration/#module-config-hugoversion

Note that we currently do not fail build, but we print a big visible WARNING on version mismatch.

The above is especially relevant for themes (or theme components), but can also be set on the main project.

@frerich
Copy link
Author

frerich commented May 18, 2020

Thanks for the pointer - that looks much like what I was thinking of!

I just tried to see how it looks in practice but didn't notice any output. Here's what I did:

$ hugo version
Hugo Static Site Generator v0.70.0/extended darwin/amd64 BuildDate: unknown
$ hugo new site mysite
Congratulations! Your new Hugo site is created in /tmp/mysite.
...
$ cd mysite
$ vi config.toml
$ cat config.toml
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
[module]
  [module.hugoVersion]
    extended = true
    max = ""
    min = "0.71.0"
$ hugo
Building sites … WARN 2020/05/18 15:38:26 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/05/18 15:38:26 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/05/18 15:38:26 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

                   | EN
-------------------+-----
  Pages            |  3
...

I suppose my modifications to the config.toml file were incorrect?

@bep bep added Enhancement and removed Proposal labels May 18, 2020
@bep bep changed the title Encode minimum supported Hugo version in configuration file Also validate min/max Hugo version for the main project May 18, 2020
@bep
Copy link
Member

bep commented May 18, 2020

OK, thinking about it, I suspect we added this as a "theme thing". I will check.

@bep bep added this to the v0.71 milestone May 18, 2020
@bep
Copy link
Member

bep commented May 18, 2020

OK, I checked ... it gets logged as a warning, but the warning never gets printed. I assume somethings off with the log level. Hmmm...

@bep bep changed the title Also validate min/max Hugo version for the main project WARNINGs does not get printed to console May 18, 2020
@bep bep changed the title WARNINGs does not get printed to console Module version mismatch WARNINGs does not get printed to console May 18, 2020
@bep bep closed this as completed in 518d149 May 18, 2020
@frerich
Copy link
Author

frerich commented May 19, 2020

Thanks a lot for the quick turnaround time!

@github-actions
Copy link

github-actions bot commented Feb 2, 2022

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 Feb 2, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants