From 6902cea8820e4a1203fc280c375f82feaecd541d Mon Sep 17 00:00:00 2001 From: Tuomo Tanskanen Date: Wed, 24 Jan 2024 12:38:28 +0200 Subject: [PATCH] switch markdownlint container to markdownlint-cli2 For the repo itself, switch the hack/markdownlint.sh over. For the Prow config: - switch over the main branches of repos with release branches - release branches stay with the old implementation - add config for Ironic-client, adding shellcheck+markdownlint - add shellcheck for metal3-io.github.io as we're replacing prettier+shfmt from pre-commit to this+shellcheck Signed-off-by: Tuomo Tanskanen --- .markdownlint-cli2.yaml | 9 ++ hack/markdownlint.sh | 7 +- prow/README.md | 5 +- prow/manifests/overlays/metal3/config.yaml | 158 +++++++++++++++++++-- 4 files changed, 164 insertions(+), 15 deletions(-) create mode 100644 .markdownlint-cli2.yaml diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 00000000..7811fc66 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,9 @@ +# Reference: https://github.com/DavidAnson/markdownlint-cli2#markdownlint-cli2yaml + +config: + ul-indent: + # Kramdown wanted us to have 3 earlier, tho this CLI recommends 2 or 4 + indent: 3 + +# Don't autofix anything, we're linting here +fix: false diff --git a/hack/markdownlint.sh b/hack/markdownlint.sh index acf827b5..5258d274 100755 --- a/hack/markdownlint.sh +++ b/hack/markdownlint.sh @@ -1,19 +1,20 @@ #!/bin/sh +# markdownlint-cli2 has config file(s) named .markdownlint-cli2.yaml in the repo set -eux IS_CONTAINER="${IS_CONTAINER:-false}" CONTAINER_RUNTIME="${CONTAINER_RUNTIME:-podman}" +# all md files, but ignore .github if [ "${IS_CONTAINER}" != "false" ]; then - TOP_DIR="${1:-.}" - find "${TOP_DIR}" -type d \( -path ./vendor -o -path ./.github \) -prune -o -name '*.md' -exec mdl --style all --warnings {} \+ + markdownlint-cli2 "**/*.md" "#.github" else "${CONTAINER_RUNTIME}" run --rm \ --env IS_CONTAINER=TRUE \ --volume "${PWD}:/workdir:ro,z" \ --entrypoint sh \ --workdir /workdir \ - docker.io/pipelinecomponents/markdownlint:0.12.0@sha256:0b8f9fcf0410257b2f3548f67ffe25934cfc9877a618b9f85afcf345a25804a2 \ + docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c \ /workdir/hack/markdownlint.sh "$@" fi diff --git a/prow/README.md b/prow/README.md index 6d6c5d64..3afee65e 100644 --- a/prow/README.md +++ b/prow/README.md @@ -156,8 +156,9 @@ PACKER_VAR_FILES=var_file.json make build-openstack-ubuntu-2204 It will be referred to as `${HMAC_TOKEN}`. 1. Create a Jenkins token by logging in to Jenkins using the - metal3.bot@gmail.com account and adding an API token in the "Configure" tab - for the user. It will be referred to as `${JENKINS_TOKEN}`. + [metal3.bot@gmail.com](mailto:metal3.bot@gmail.com) account and adding an API + token in the "Configure" tab for the user. It will be referred to as + `${JENKINS_TOKEN}`. ## GitHub configuration diff --git a/prow/manifests/overlays/metal3/config.yaml b/prow/manifests/overlays/metal3/config.yaml index b8c486ee..2cb572d3 100644 --- a/prow/manifests/overlays/metal3/config.yaml +++ b/prow/manifests/overlays/metal3/config.yaml @@ -334,7 +334,7 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always Nordix/metal3-dev-tools: - name: shellcheck @@ -378,7 +378,7 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always metal3-io/baremetal-operator: - name: gofmt @@ -424,6 +424,26 @@ presubmits: image: docker.io/golang:1.20 imagePullPolicy: Always - name: markdownlint + branches: + - main + run_if_changed: '(\.md|markdownlint\.sh)$' + decorate: true + spec: + containers: + - args: + - ./hack/markdownlint.sh + command: + - sh + env: + - name: IS_CONTAINER + value: "TRUE" + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c + imagePullPolicy: Always + - name: markdownlint + branches: + - release-0.5 + - release-0.4 + - release-0.3 run_if_changed: '(\.md|markdownlint\.sh)$' decorate: true spec: @@ -695,6 +715,26 @@ presubmits: image: docker.io/golang:1.19 imagePullPolicy: Always - name: markdownlint + branches: + - main + run_if_changed: '(\.md|markdownlint\.sh)$' + decorate: true + spec: + containers: + - args: + - ./hack/markdownlint.sh + command: + - sh + env: + - name: IS_CONTAINER + value: "TRUE" + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c + imagePullPolicy: Always + - name: markdownlint + branches: + - release-1.6 + - release-1.5 + - release-1.4 run_if_changed: '(\.md|markdownlint\.sh)$' decorate: true spec: @@ -854,7 +894,7 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always - name: shellcheck run_if_changed: '((\.sh)|^Makefile)$' @@ -898,7 +938,7 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always metal3-io/project-infra: @@ -931,7 +971,7 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always - name: shellcheck run_if_changed: '((\.sh)|^Makefile)$' @@ -961,7 +1001,7 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always metal3-io/ip-address-manager: @@ -1114,8 +1154,28 @@ presubmits: value: "TRUE" image: docker.io/golang:1.19 imagePullPolicy: Always + - name: markdownlint + branches: + - main + run_if_changed: '(\.md|markdownlint\.sh)$' + decorate: true + spec: + containers: + - args: + - ./hack/markdownlint.sh + command: + - sh + env: + - name: IS_CONTAINER + value: "TRUE" + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c + imagePullPolicy: Always - name: markdownlint run_if_changed: '(\.md|markdownlint\.sh)$' + branches: + - release-1.6 + - release-1.5 + - release-1.4 decorate: true spec: containers: @@ -1252,7 +1312,37 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c + imagePullPolicy: Always + + metal3-io/ironic-client: + - name: shellcheck + run_if_changed: '((\.sh)|^Makefile)$' + decorate: true + spec: + containers: + - args: + - ./hack/shellcheck.sh + command: + - sh + env: + - name: IS_CONTAINER + value: "TRUE" + image: docker.io/koalaman/shellcheck-alpine:v0.9.0@sha256:e19ed93c22423970d56568e171b4512c9244fc75dd9114045016b4a0073ac4b7 + imagePullPolicy: Always + - name: markdownlint + run_if_changed: '(\.md|markdownlint\.sh)$' + decorate: true + spec: + containers: + - args: + - ./hack/markdownlint.sh + command: + - sh + env: + - name: IS_CONTAINER + value: "TRUE" + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always metal3-io/ironic-image: @@ -1271,6 +1361,24 @@ presubmits: image: docker.io/koalaman/shellcheck-alpine:v0.9.0@sha256:e19ed93c22423970d56568e171b4512c9244fc75dd9114045016b4a0073ac4b7 imagePullPolicy: Always - name: markdownlint + branches: + - main + run_if_changed: '(\.md|markdownlint\.sh)$' + decorate: true + spec: + containers: + - args: + - ./hack/markdownlint.sh + command: + - sh + env: + - name: IS_CONTAINER + value: "TRUE" + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c + imagePullPolicy: Always + - name: markdownlint + branches: + - release-23.1 run_if_changed: '(\.md|markdownlint\.sh)$' decorate: true spec: @@ -1312,7 +1420,7 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always metal3-io/ironic-hardware-inventory-recorder-image: @@ -1342,7 +1450,7 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always metal3-io/utility-images: @@ -1372,5 +1480,35 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c + imagePullPolicy: Always + + metal3-io/metal3-io.github.io: + - name: shellcheck + run_if_changed: '((\.sh)|^Makefile)$' + decorate: true + spec: + containers: + - args: + - ./hack/shellcheck.sh + command: + - sh + env: + - name: IS_CONTAINER + value: "TRUE" + image: docker.io/koalaman/shellcheck-alpine:v0.9.0@sha256:e19ed93c22423970d56568e171b4512c9244fc75dd9114045016b4a0073ac4b7 + imagePullPolicy: Always + - name: markdownlint + run_if_changed: '(\.md|markdownlint\.sh)$' + decorate: true + spec: + containers: + - args: + - ./hack/markdownlint.sh + command: + - sh + env: + - name: IS_CONTAINER + value: "TRUE" + image: docker.io/pipelinecomponents/markdownlint-cli2:0.9.0@sha256:71370df6c967bae548b0bfd0ae313ddf44bfad87da76f88180eff55c6264098c imagePullPolicy: Always