kubernetes / website

Kubernetes website and documentation repo:
https://kubernetes.io
Creative Commons Attribution 4.0 International
4.48k stars 14.4k forks source link

Error while running cloned website on local machine #45597

Closed arujjval closed 7 months ago

arujjval commented 7 months ago

This is a Bug Report

Problem: I tried to run the cloned website, which I forked on my Ubuntu Machine, but am getting error. I tried both running via docker and my running locally using Hugo but getting some issues in both.

Following is the error while running via docker Screenshot from 2024-03-19 12-34-56

and this is while running locally via Hugo Screenshot from 2024-03-19 12-35-53

I also initialized modules by running the command: make module-init

k8s-ci-robot commented 7 months ago

This issue is currently awaiting triage.

SIG Docs takes a lead on issue triage for this website, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
vaibhav2107 commented 7 months ago

/kind support

adityasamant25 commented 7 months ago

I tried to analyze a bit. On first investigation, it seems like a valid issue. However, I do not know the root cause.

I created a new Ubuntu VM, and tried to setup k/w from scratch.

npm version: 10.2.4
go version: go1.22.1 linux/arm64
hugo version: hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended linux/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=snap:0.124.1
Docker Engine version: 26.0.0

On running make serve, the hugo command was stuck at:

Start building sites … 
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended linux/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=snap:0.124.1

I then executed hugo -v --debug -D and managed to reproduce the issue you reported. (Note that at times this command gets stuck without an output as well).

ERROR [fr] Glossary Bundle not found for language. Create at least an index.md file inside docs/reference/glossary
ERROR [fr] No glossary items found
ERROR [fr] "/docs/concepts/overview/components": "kube-apiserver" is not a valid glossary term_id, see ./docs/reference/glossary/* for a full list
INFO  build:  step render pages 2897 content 6269 duration 23.51889686s
INFO  build:  step postProcess duration 12.459µs
INFO  build:  duration 26.870210574s
Total in 26951 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/home/ubuntu/website/layouts/docs/single.html:3:7": execute of template failed: template: docs/single.html:3:7: executing "main" at <partial "docs/content-page" (dict "ctx" . "page" .)>: error calling partial: "/home/ubuntu/website/layouts/partials/docs/content-page.html:6:8": execute of template failed: template: partials/docs/content-page.html:6:8: executing "partials/docs/content-page.html" at <.page.Content>: error calling Content: "/home/ubuntu/website/content/fr/docs/concepts/overview/components.md:29:1": failed to render shortcode "glossary_definition": failed to process shortcode: "/home/ubuntu/website/layouts/shortcodes/glossary_definition.html:18:19": execute of template failed: template: shortcodes/glossary_definition.html:18:19: executing "shortcodes/glossary_definition.html" at <$term_info.Content>: nil pointer evaluating resource.Resource.Content

On my local machine, I have older versions of npm, hugo, go and docker and k/w builds fine.

npm version: 10.2.3
go version: go version go1.21.5 darwin/arm64
hugo version: hugo v0.120.4-f11bca5fec2ebb3a02727fb2a5cfb08da96fd9df+extended darwin/arm64 BuildDate=2023-11-08T11:18:07Z VendorInfo=brew
Docker Engine version: 25.0.3

It could be related to one of the upgrades in the dependencies (most probably Hugo), however I cannot state for certain.

arujjval commented 7 months ago

I tried to analyze a bit. On first investigation, it seems like a valid issue. However, I do not know the root cause.

I created a new Ubuntu VM, and tried to setup k/w from scratch.

npm version: 10.2.4
go version: go1.22.1 linux/arm64
hugo version: hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended linux/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=snap:0.124.1
Docker Engine version: 26.0.0

On running make serve, the hugo command was stuck at:

Start building sites … 
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended linux/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=snap:0.124.1

I then executed hugo -v --debug -D and managed to reproduce the issue you reported. (Note that at times this command gets stuck without an output as well).

ERROR [fr] Glossary Bundle not found for language. Create at least an index.md file inside docs/reference/glossary
ERROR [fr] No glossary items found
ERROR [fr] "/docs/concepts/overview/components": "kube-apiserver" is not a valid glossary term_id, see ./docs/reference/glossary/* for a full list
INFO  build:  step render pages 2897 content 6269 duration 23.51889686s
INFO  build:  step postProcess duration 12.459µs
INFO  build:  duration 26.870210574s
Total in 26951 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/home/ubuntu/website/layouts/docs/single.html:3:7": execute of template failed: template: docs/single.html:3:7: executing "main" at <partial "docs/content-page" (dict "ctx" . "page" .)>: error calling partial: "/home/ubuntu/website/layouts/partials/docs/content-page.html:6:8": execute of template failed: template: partials/docs/content-page.html:6:8: executing "partials/docs/content-page.html" at <.page.Content>: error calling Content: "/home/ubuntu/website/content/fr/docs/concepts/overview/components.md:29:1": failed to render shortcode "glossary_definition": failed to process shortcode: "/home/ubuntu/website/layouts/shortcodes/glossary_definition.html:18:19": execute of template failed: template: shortcodes/glossary_definition.html:18:19: executing "shortcodes/glossary_definition.html" at <$term_info.Content>: nil pointer evaluating resource.Resource.Content

On my local machine, I have older versions of npm, hugo, go and docker and k/w builds fine.

npm version: 10.2.3
go version: go version go1.21.5 darwin/arm64
hugo version: hugo v0.120.4-f11bca5fec2ebb3a02727fb2a5cfb08da96fd9df+extended darwin/arm64 BuildDate=2023-11-08T11:18:07Z VendorInfo=brew
Docker Engine version: 25.0.3

It could be related to one of the upgrades in the dependencies (most probably Hugo), however I cannot state for certain.

The issue is in the Hugo version. Upon changing the version, it worked perfectly. Thanks for your input. I think this issue should be raised.

adityasamant25 commented 7 months ago

@arujjval Can you please mention the exact combination of versions (npm, Hugo, go, docker) that worked for you?

arujjval commented 7 months ago

@adityasamant25 here, it is npm version: 10.2.4 go version go1.22.1 linux/amd64 hugo v0.121.2-6d5b44305eaa9d0a157946492a6f319da38de154+extended linux/amd64 BuildDate=2024-01-05T12:21:15Z VendorInfo=gohugoio Docker version: 25.0.2 but I think the issue is with Hugo's version only.

sftim commented 7 months ago

Try make container-serve whilst you have the latest main branch checked out. That works for me.

You should find that you're using Hugo 0.121.2 (see netlify.toml).

If you want to test a Hugo upgrade, run make container-image before make container-serve.

adityasamant25 commented 7 months ago

The instruction to install a specific Hugo extended version as defined in netlify.toml is mentioned in the Running the website locally using Hugo section.

However, I believe it would be helpful to move the instruction to the Prerequisites section. This would prevent readers from inadvertently installing the latest Hugo extended version (currently v0.124.1) which is incompatible with k/w.

I'll try to work on a PR for this.

adityasamant25 commented 7 months ago

/assign