From b965832c41a07fd723e33211182cfa2f1e88bf6c Mon Sep 17 00:00:00 2001 From: Tuomo Tanskanen Date: Thu, 18 Jan 2024 14:41:46 +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 Signed-off-by: Tuomo Tanskanen --- .markdownlint-cli2.yaml | 9 ++ hack/markdownlint.sh | 5 +- prow/README.md | 5 +- prow/manifests/overlays/metal3/config.yaml | 128 +++++++++++++++++++-- 4 files changed, 132 insertions(+), 15 deletions(-) create mode 100644 .markdownlint-cli2.yaml diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 000000000..7811fc663 --- /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 acf827b57..9110b0c67 100755 --- a/hack/markdownlint.sh +++ b/hack/markdownlint.sh @@ -6,14 +6,13 @@ IS_CONTAINER="${IS_CONTAINER:-false}" CONTAINER_RUNTIME="${CONTAINER_RUNTIME:-podman}" 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" "#node_modules" 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 \ /workdir/hack/markdownlint.sh "$@" fi diff --git a/prow/README.md b/prow/README.md index 6d6c5d642..3afee65e6 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 b8c486ee2..049fb21b7 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 + 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 + 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 imagePullPolicy: Always metal3-io/ip-address-manager: @@ -1115,8 +1155,28 @@ 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 + imagePullPolicy: Always + - name: markdownlint + run_if_changed: '(\.md|markdownlint\.sh)$' + branches: + - release-1.6 + - release-1.5 + - release-1.4 + decorate: true spec: containers: - args: @@ -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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 + 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 + 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 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.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 imagePullPolicy: Always metal3-io/utility-images: @@ -1372,5 +1480,5 @@ presubmits: env: - name: IS_CONTAINER value: "TRUE" - image: docker.io/pipelinecomponents/markdownlint:0.13.0@sha256:9c0cdfb64fd3f1d3bdc5181629b39c2e43b6a52fc9fdc146611e1860845bbae0 + image: docker.io/pipelinecomponents/markdownlint-cli2:0.8.1@sha256:7f85faca10c33e9104e0e461c2a1d59a997a52b22358548dd7975498c8311928 imagePullPolicy: Always