Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaki-lknr/d03031acf299905dffeff43978295d58 to your computer and use it in GitHub Desktop.
Save zaki-lknr/d03031acf299905dffeff43978295d58 to your computer and use it in GitHub Desktop.

ドキュメントの動作確認を手元で行う。
動作確認にはHugoを使用する。

makeを利用

make container-imageはsuccess

正常

[zaki@cloud-dev website]$ sudo make container-image
docker build . \
        --network=host \
        --tag kubernetes-hugo \
        --build-arg HUGO_VERSION=0.70.0
Sending build context to Docker daemon  3.584kB
Step 1/7 : FROM alpine:latest
 ---> a24bb4013296
Step 2/7 : LABEL maintainer="Luc Perkins <lperkins@linuxfoundation.org>"
 ---> Using cache
 ---> 3b4310c1ed93
Step 3/7 : RUN apk add --no-cache     curl     git     openssh-client     rsync     build-base     libc6-compat
 ---> Using cache
 ---> c9bdf4c53f67
Step 4/7 : ARG HUGO_VERSION
 ---> Using cache
 ---> c9ac98a4089c
Step 5/7 : RUN mkdir -p /usr/local/src &&     cd /usr/local/src &&     curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz | tar -xz &&     mv hugo /usr/local/bin/hugo &&     addgroup -Sg 1000 hugo &&     adduser -Sg hugo -u 1000 -h /src hugo
 ---> Running in af88c864ab9a
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   650  100   650    0     0   1666      0 --:--:-- --:--:-- --:--:--  1666
100 13.8M  100 13.8M    0     0  2926k      0  0:00:04  0:00:04 --:--:-- 3336k
Removing intermediate container af88c864ab9a
 ---> 4dcd223e93b5
Step 6/7 : WORKDIR /src
 ---> Running in 7a1661640eb8
Removing intermediate container 7a1661640eb8
 ---> 7641c012146e
Step 7/7 : EXPOSE 1313
 ---> Running in c2b1ea5c416f
Removing intermediate container c2b1ea5c416f
 ---> 376bc09a5beb
Successfully built 376bc09a5beb
Successfully tagged kubernetes-hugo:latest

make container-buildでエラー

大量の警告のあとエラー発生。

[zaki@cloud-dev website]$ sudo make container-build
docker run --rm --interactive --tty --volume /home/zaki/src/tmp/website:/src kubernetes-hugo hugo
Building sites … WARN 2020/07/19 09:36:23 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/07/19 09:36:23 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

[... 340行程繰り返し ]

WARN 2020/07/19 09:36:23 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/07/19 09:36:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/07/19 09:36:24 found no layout file for "HTML" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/07/19 09:36:24 found no layout file for "HTML" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/07/19 09:36:24 found no layout file for "HTML" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
ERROR 2020/07/19 09:36:24 render of "page" failed: execute of template failed: template: case-studies/single.html:4:5: executing "case-studies/single.html" at <partial "head.html" .>: error calling partial: "/src/layouts/partials/head.html:35:3": execute of template failed: template: partials/head.html:35:3: executing "partials/head.html" at <partialCached "head-css.html" . "asdf">: error calling partialCached: partial "head-css.html" not found
ERROR 2020/07/19 09:36:24 render of "page" failed: execute of template failed: template: case-studies/single.html:4:5: executing "case-studies/single.html" at <partial "head.html" .>: error calling partial: "/src/layouts/partials/head.html:35:3": execute of template failed: template: partials/head.html:35:3: executing "partials/head.html" at <partialCached "head-css.html" . "asdf">: error calling partialCached: partial "head-css.html" not found
ERROR 2020/07/19 09:36:24 render of "page" failed: execute of template failed: template: case-studies/single.html:4:5: executing "case-studies/single.html" at <partial "head.html" .>: error calling partial: "/src/layouts/partials/head.html:35:3": execute of template failed: template: partials/head.html:35:3: executing "partials/head.html" at <partialCached "head-css.html" . "asdf">: error calling partialCached: partial "head-css.html" not found
ERROR 2020/07/19 09:36:24 render of "page" failed: execute of template failed: template: case-studies/single.html:4:5: executing "case-studies/single.html" at <partial "head.html" .>: error calling partial: "/src/layouts/partials/head.html:35:3": execute of template failed: template: partials/head.html:35:3: executing "partials/head.html" at <partialCached "head-css.html" . "asdf">: error calling partialCached: partial "head-css.html" not found
Total in 1998 ms
Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: case-studies/single.html:4:5: executing "case-studies/single.html" at <partial "head.html" .>: error calling partial: "/src/layouts/partials/head.html:35:3": execute of template failed: template: partials/head.html:35:3: executing "partials/head.html" at <partialCached "head-css.html" . "asdf">: error calling partialCached: partial "head-css.html" not found
make: *** [container-build] エラー 255
[zaki@cloud-dev website]$ 

READMEを確認

website/README-ja.md at dev-1.17-ja.3 · kubernetes/websiteを見ると、Docker版ではないけどsubmoduleの実行が載っている。

submodule実行

[zaki@cloud-dev website]$ git submodule update --init --recursive
Submodule 'themes/docsy' (https://github.com/google/docsy.git) registered for path 'themes/docsy'
Cloning into 'themes/docsy'...
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 3821 (delta 19), reused 5 (delta 1), pack-reused 3785
Receiving objects: 100% (3821/3821), 7.51 MiB | 1.87 MiB/s, done.
Resolving deltas: 100% (2106/2106), done.
Submodule path 'themes/docsy': checked out '5d5e6402c901492f325af4117adbd151bf869c52'
Submodule 'assets/vendor/Font-Awesome' (https://github.com/FortAwesome/Font-Awesome.git) registered for path 'assets/vendor/Font-Awesome'
Submodule 'assets/vendor/bootstrap' (https://github.com/twbs/bootstrap.git) registered for path 'assets/vendor/bootstrap'
Cloning into 'assets/vendor/Font-Awesome'...
remote: Enumerating objects: 162, done.
remote: Counting objects: 100% (162/162), done.
remote: Compressing objects: 100% (150/150), done.
remote: Total 109013 (delta 42), reused 40 (delta 11), pack-reused 108851
Receiving objects: 100% (109013/109013), 96.75 MiB | 14.49 MiB/s, done.
Resolving deltas: 100% (63471/63471), done.
Submodule path 'themes/docsy/assets/vendor/Font-Awesome': checked out '538a5bc4cf7989821d052e3ff919e2bead07021c'
Cloning into 'assets/vendor/bootstrap'...
remote: Enumerating objects: 154371, done.
remote: Total 154371 (delta 0), reused 0 (delta 0), pack-reused 154371
Receiving objects: 100% (154371/154371), 156.67 MiB | 9.41 MiB/s, done.
Resolving deltas: 100% (101521/101521), done.
Submodule path 'themes/docsy/assets/vendor/bootstrap': checked out '3b558734382ce58b51e5fc676453bfd53bba9201'
[zaki@cloud-dev website]$ 

この状態で再度make container-buildを実行

[zaki@cloud-dev website]$ sudo make container-build
docker run --rm --interactive --tty --volume /home/zaki/src/tmp/website:/src kubernetes-hugo hugo
Total in 23356 ms
Error: Error building site: POSTCSS: failed to transform "scss/main.css" (text/css): resource "scss/scss/main.scss_4853eb546e7a6c0898ed71feae7357c0" not found in file cache
make: *** [container-build] エラー 255

エラーは変化したが成功しない。

Hugo利用

netlify.toml記載のHUGO_VERSION = "0.70.0"のバージョンをインストール(.tar.gzバイナリを/usr/local/binへ配置)

[zaki@cloud-dev website]$ hugo version
Hugo Static Site Generator v0.70.0-7F47B99E linux/amd64 BuildDate: 2020-05-06T11:18:50Z
[zaki@cloud-dev website]$ hugo server --buildFuture
Building sites … ERROR 2020/07/19 19:13:27 Failed to read Git log: Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

ERROR 2020/07/19 19:13:45 TOCSS: failed to transform "scss/_case-studies.scss" (text/x-scss): resource "scss/scss/_case-studies.scss_f300667da4f5b5f84e1a9e0702b2fdde" not found in file cache
Built in 18047 ms
Error: Error building site: TOCSS: failed to transform "scss/main.scss" (text/x-scss): resource "scss/scss/main.scss_9fadf33d895a46083cdd64396b57ef68" not found in file cache

gitバージョンが古いようだが、エラーの傾向は値とファイル名は異なるが同じ。


環境

[zaki@cloud-dev website]$ git branch 
* dev-1.17-ja.3
[zaki@cloud-dev website]$ cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)
[zaki@cloud-dev website]$ git --version 
git version 1.8.3.1
[zaki@cloud-dev website]$ sudo docker version
Client: Docker Engine - Community
 Version:           19.03.11
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        42e35e61f3
 Built:             Mon Jun  1 09:13:48 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.11
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       42e35e61f3
  Built:            Mon Jun  1 09:12:26 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
[zaki@cloud-dev website]$ 
[zaki@cloud-dev website]$ make --version
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

masterブランチの場合…

状況はかわらず。。

  1. git clone https://github.com/zaki-lknr/website.git
  2. cd website/
  3. git submodule update --init --recursive # --depth 1はエラーになった(Gitバージョンによると思われ)
  4. sudo make container-image
  5. sudo make container-image
[zaki@cloud-dev website]$ sudo make container-build
docker run --rm --interactive --tty --volume /home/zaki/src/work/website:/src kubernetes-hugo hugo --minify
Total in 25275 ms
Error: Error building site: POSTCSS: failed to transform "scss/main.css" (text/css): resource "scss/scss/main.scss_4853eb546e7a6c0898ed71feae7357c0" not found in file cache
make: *** [container-build] エラー 255
[zaki@cloud-dev website]$

同じだ。。(ハッシュ値も同じ)


make container-serve

コマンドが違っていたらしい。
make container-serveを実行

[zaki@cloud-dev website]$ sudo make container-serve
docker run --rm --interactive --tty --volume /home/zaki/src/tmp/website:/src --mount type=tmpfs,destination=/src/resources,tmpfs-mode=0755 -p 1313:1313 kubernetes-hugo hugo server --buildFuture --bind 0.0.0.0

                   |  EN  |  ZH  |  KO  |  JA  |  FR  |  IT  |  DE  |  ES  |  PT  |  ID  |  RU  |  VI  |  PL  |  UK   
-------------------+------+------+------+------+------+------+------+------+------+------+------+------+------+-------
  Pages            | 1105 |  762 |  368 |  250 |  237 |   53 |  104 |  160 |   51 |  183 |  109 |   63 |   54 |   64  
  Paginator pages  |   33 |    4 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0  
  Non-page files   |  432 |  354 |  215 |  236 |   59 |   25 |   21 |   27 |   25 |   75 |   24 |   13 |    9 |   28  
  Static files     | 1098 | 1098 | 1098 | 1098 | 1098 | 1098 | 1098 | 1098 | 1098 | 1098 | 1098 | 1098 | 1098 | 1098  
  Processed images |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0  
  Aliases          |    8 |    4 |    1 |    0 |    0 |    0 |    0 |    0 |    0 |    1 |    0 |    0 |    0 |    0  
  Sitemaps         |    2 |    1 |    1 |    1 |    1 |    1 |    1 |    1 |    1 |    1 |    1 |    1 |    1 |    1  
  Cleaned          |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0  

Built in 19560 ms
Watching for changes in /src/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in /src/config.toml, /src/themes/docsy/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 0.0.0.0)
Press Ctrl+C to stop

うごいた!

container-buildは

動作がおかしかったらしい。
The command "make container-build" fails · Issue #22586 · kubernetes/website

inductorさんがIssue立ててくれました。

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