diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95e8e0fad6..92b0d5397c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: fail-fast: false matrix: target: - - htmlproofer + - htmltest - mdl steps: - @@ -70,7 +70,7 @@ jobs: // construct annotations by parsing output switch ("${{ matrix.target }}") { - case "htmlproofer": + case "htmltest": const re = /^- (.+)\n \* (.+) \(line (\d+)\)\n(.+)$/gm; while (true) { const result = re.exec(results); @@ -79,7 +79,7 @@ jobs: } core.error(`${result[2]}\n${result[4]}`, { - title: 'Link check failed', + title: 'HTML test failed', // file: result[1], // startLine: result[3], }); diff --git a/.gitignore b/.gitignore index 8d50e221ac..50b0001ac6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ CNAME _kbase/** /vendor /lint +tmp/.htmltest/** diff --git a/.htmltest.yml b/.htmltest.yml new file mode 100644 index 0000000000..4ff92d23cf --- /dev/null +++ b/.htmltest.yml @@ -0,0 +1,16 @@ +DirectoryPath: "_site" +EnforceHTTPS: false +CheckDoctype: false +CheckExternal: false +IgnoreAltMissing: true +IgnoreAltEmpty: true +IgnoreEmptyHref: true +IgnoreDirectoryMissingTrailingSlash: true +IgnoreURLs: +- "^/docker-hub/api/latest/.*$" +- "^/engine/api/v.+/#.*$" +- "^/glossary/.*$" +IgnoreDirs: +- "engine/api" +- "registry/configuration" +CacheExpires: "6h" diff --git a/Dockerfile b/Dockerfile index 53e669da52..6453ea8d69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,28 +63,27 @@ RUN --mount=type=bind,target=.,rw \ bundle exec jekyll build --profile -d ${TARGET} --config ${CONFIG_FILES} EOT -# htmlproofer checks for broken links -FROM gem AS htmlproofer-base -RUN --mount=type=bind,from=generate,source=/out,target=_site < /results 2>&1 - rc=$? - if [[ $rc -eq 0 ]]; then - echo -n > /results - fi +# htmltest checks for broken links +FROM wjdp/htmltest:v0.17.0 as htmltest-base +RUN --mount=type=bind,from=generate,source=/out,target=_site \ + --mount=type=bind,source=.htmltest.yml,target=.htmltest.yml \ + < /results 2>&1 + rc=$? + if [[ $rc -eq 0 ]]; then + echo -n > /results + fi EOF -FROM htmlproofer-base as htmlproofer +FROM base as htmltest +COPY --from=htmltest-base /results /results RUN <= 0.12.9) http_parser.rb (~> 0) - ethon (0.15.0) - ffi (>= 1.15.0) eventmachine (1.2.7) ffi (1.15.5) forwardable-extended (2.6.0) @@ -19,14 +17,6 @@ GEM git (1.13.0) addressable (~> 2.8) rchardet (~> 1.8) - html-proofer (3.19.4) - addressable (~> 2.3) - mercenary (~> 0.3) - nokogiri (~> 1.13) - parallel (~> 1.10) - rainbow (~> 3.0) - typhoeus (~> 1.3) - yell (~> 2.0) http_parser.rb (0.8.0) i18n (1.12.0) concurrent-ruby (~> 1.0) @@ -75,20 +65,11 @@ GEM tomlrb mixlib-shellout (3.2.7) chef-utils - nokogiri (1.14.3-aarch64-linux) - racc (~> 1.4) - nokogiri (1.14.3-arm-linux) - racc (~> 1.4) - nokogiri (1.14.3-x86_64-linux) - racc (~> 1.4) octopress-hooks (2.6.2) jekyll (>= 2.0) - parallel (1.22.1) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (5.0.1) - racc (1.6.2) - rainbow (3.1.1) rake (13.0.6) rb-fsevent (0.11.2) rb-inotify (0.10.1) @@ -102,10 +83,7 @@ GEM terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) tomlrb (2.0.3) - typhoeus (1.4.0) - ethon (>= 0.9.0) unicode-display_width (1.8.0) - yell (2.2.2) PLATFORMS aarch64-linux @@ -115,7 +93,6 @@ PLATFORMS DEPENDENCIES front_matter_parser (= 1.0.1) git (= 1.13.0) - html-proofer (= 3.19.4) jekyll (= 4.2.2) jekyll-redirect-from jekyll-relative-links diff --git a/docker-bake.hcl b/docker-bake.hcl index eb6843bfb3..d4f8de3b69 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -36,18 +36,18 @@ target "vendor" { } group "validate" { - targets = ["htmlproofer", "mdl"] + targets = ["htmltest", "mdl"] } -target "htmlproofer" { +target "htmltest" { inherits = ["_common"] - target = "htmlproofer" + target = "htmltest" output = ["type=cacheonly"] } -target "htmlproofer-output" { +target "htmltest-output" { inherits = ["_common"] - target = "htmlproofer-output" + target = "htmltest-output" output = ["./lint"] }