Skip to content

Commit 23d8871

Browse files
committed
Initial plugin source.
1 parent 1f1b0f0 commit 23d8871

File tree

16 files changed

+723
-0
lines changed

16 files changed

+723
-0
lines changed

.github/workflows/lint.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Lint
2+
3+
on: push
4+
5+
jobs:
6+
7+
renovate:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@main
11+
- uses: docker://kokuwaio/renovate-config-validator
12+
13+
markdownlint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@main
17+
- uses: docker://kokuwaio/markdownlint
18+
19+
yamllint:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@main
23+
- uses: docker://kokuwaio/yamllint
24+
25+
hadolint:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@main
29+
- uses: docker://kokuwaio/hadolint
30+
31+
shellcheck:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@main
35+
- uses: docker://kokuwaio/shellcheck

.hadolint.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://github.com/hadolint/hadolint#configure
2+
failure-threshold: style
3+
strict-labels: true
4+
disable-ignore-pragma: true
5+
ignored:
6+
- DL3008 # Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
7+
trustedRegistries: [docker.io]

.justfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# https://just.systems/man/en/
2+
set fallback := true
3+
set unstable := true
4+
set script-interpreter := ["bash", "-eu"]
5+
6+
REGISTRY_IMAGE := "docker.io/library/registry:2.8.3"
7+
REGISTRY_NAME := "kaniko-registry"
8+
REGISTRY_PORT := "5001"
9+
IMAGE := replace("localhost:_/shellcheck", '_', REGISTRY_PORT)
10+
11+
[private]
12+
@default:
13+
just --list --unsorted
14+
15+
# Run linter.
16+
@lint:
17+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/shellcheck
18+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/hadolint
19+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/yamllint
20+
docker run --rm --read-only --volume=$(pwd):$(pwd):rw --workdir=$(pwd) kokuwaio/markdownlint --fix
21+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/renovate-config-validator
22+
23+
# Build using local repository as cache.
24+
@build: registry-up
25+
docker run --rm --net=host --volume=$(pwd):/workspace:ro gcr.io/kaniko-project/executor:v1.23.2 --context=/workspace --destination={{IMAGE}}
26+
27+
# Run image against local repository.
28+
run: registry-up
29+
docker pull {{IMAGE}} >/dev/null
30+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) {{IMAGE}}
31+
32+
# Inspect image layers with `dive`.
33+
@dive: registry-up
34+
docker pull {{IMAGE}} >/dev/null
35+
docker run --rm -it --volume=/var/run/docker.sock:/var/run/docker.sock:ro wagoodman/dive:latest {{IMAGE}}
36+
37+
# Build with local docker daemon.
38+
docker: registry-up
39+
docker buildx build . --load --quiet --tag={{IMAGE}}:amd64 --platform=linux/amd64
40+
docker buildx build . --load --quiet --tag={{IMAGE}}:arm64 --platform=linux/arm64
41+
docker push {{IMAGE}} --all-tags --quiet
42+
docker manifest rm {{IMAGE}} || true
43+
docker manifest create {{IMAGE}} --insecure --amend {{IMAGE}}:amd64 --amend {{IMAGE}}:arm64
44+
docker manifest inspect {{IMAGE}} --verbose
45+
docker manifest push {{IMAGE}} --purge
46+
docker pull {{IMAGE}}
47+
docker image inspect {{IMAGE}}
48+
docker run --rm --read-only --env=CI=1 --volume=$(pwd):$(pwd):ro --workdir=$(pwd) {{IMAGE}}
49+
50+
# Start local image registry at `http://localhost:{{REGISTRY_PORT}}`.
51+
@registry-up:
52+
docker volume create {{REGISTRY_NAME}} >/dev/null
53+
docker ps --format '{{{{.Names}}' | grep {{REGISTRY_NAME}} >/dev/null || docker run --quiet --detach --volume={{REGISTRY_NAME}}:/var/lib/registry --publish={{REGISTRY_PORT}}:5000 --name={{REGISTRY_NAME}} {{REGISTRY_IMAGE}} >/dev/null
54+
55+
# Shutdown local image registry.
56+
@registry-down:
57+
docker rm {{REGISTRY_NAME}} --force >/dev/null 2>&1

.markdownlint.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Default state for all rules
2+
default: true
3+
4+
# MD009 - Trailing spaces
5+
MD009:
6+
strict: true
7+
8+
# MD013 - Line length
9+
MD013: false

.woodpecker/build.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
when:
2+
event: [manual, push, pull_request]
3+
branch: main
4+
path: [.woodpecker/build.yaml, .woodpecker/push.yaml, Dockerfile, Dockerfile.dockerignore, entrypoint.sh]
5+
6+
matrix:
7+
PLATFORM: [amd64, arm64]
8+
labels:
9+
platform: linux/${PLATFORM}
10+
11+
steps:
12+
13+
build:
14+
image: gcr.io/kaniko-project/executor:v1.23.2-debug
15+
commands: /kaniko/executor
16+
--context=$CI_WORKSPACE
17+
--destination=ci-registry.schnabel.org/kokuwaio/shellcheck:$CI_PIPELINE_NUMBER-$PLATFORM
18+
--reproducible
19+
--cache
20+
--cache-copy-layers
21+
--cache-run-layers
22+
--cache-repo=$DOCKER_CACHE/cache/kokuwaio/shellcheck
23+
--insecure-registry=$DOCKER_CACHE
24+
--insecure-registry=$DOCKER_MIRROR
25+
--registry-mirror=$DOCKER_MIRROR
26+
--skip-default-registry-fallback
27+
--label=org.opencontainers.image.title="Shellcheck Plugin"
28+
--label=org.opencontainers.image.description="A Woodpecker CI plugin for Renovate configuration validation."
29+
--label=org.opencontainers.image.url=$CI_REPO_URL
30+
--label=org.opencontainers.image.documentation=$CI_REPO_URL
31+
--label=org.opencontainers.image.source=$CI_REPO_CLONE_URL
32+
--label=org.opencontainers.image.vendor=kokuwa.io
33+
--label=org.opencontainers.image.licenses=GPL-3.0-or-later
34+
--label=org.opencontainers.image.version=v0.10.0
35+
36+
test:
37+
image: ci-registry.schnabel.org/kokuwaio/shellcheck:${CI_PIPELINE_NUMBER}-${PLATFORM}
38+
pull: true

.woodpecker/dockerhub.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
when:
2+
instance: ci.schnabel.org
3+
repo: kokuwaio/shellcheck
4+
event: push
5+
branch: main
6+
path: README.md
7+
8+
steps:
9+
10+
metadata:
11+
image: kokuwaio/dockerhub-metadata
12+
settings:
13+
repository: kokuwaio/shellcheck
14+
description-short: A Woodpecker CI plugin for Renovate configuration validation.
15+
categories: [developer-tools, integration-and-delivery]
16+
username: {from_secret: DOCKERHUB_USERNAME}
17+
password: {from_secret: DOCKERHUB_PASSWORD}

.woodpecker/lint.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
when:
2+
event: [cron, manual, push, pull_request]
3+
branch: main
4+
path: [.woodpecker/lint.yaml, renovate.json, "**/*.yaml", "**/*.md", "**/*.sh", "**/Dockerfile"]
5+
6+
steps:
7+
8+
renovate:
9+
image: kokuwaio/renovate-config-validator
10+
depends_on: []
11+
when: [path: [.woodpecker/lint.yaml, renovate.json]]
12+
13+
yaml:
14+
image: kokuwaio/yamllint
15+
depends_on: []
16+
when: [path: [.woodpecker/lint.yaml, .yamllint.yaml, "**/*.yaml"]]
17+
18+
markdown:
19+
image: kokuwaio/markdownlint
20+
depends_on: []
21+
when: [path: [.woodpecker/lint.yaml, .markdownlint.yaml, "**/*.md"]]
22+
23+
dockerfile:
24+
image: kokuwaio/hadolint
25+
depends_on: []
26+
when: [path: [.woodpecker/lint.yaml, .hadolint.yaml, "**/Dockerfile"]]
27+
28+
shellcheck:
29+
image: kokuwaio/shellcheck
30+
depends_on: []
31+
when: [path: [.woodpecker/lint.yaml, "**/*.sh"]]

.woodpecker/push.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
when:
2+
instance: ci.schnabel.org
3+
repo: kokuwaio/shellcheck
4+
event: push
5+
branch: main
6+
path: [.woodpecker/build.yaml, .woodpecker/push.yaml, Dockerfile, Dockerfile.dockerignore, entrypoint.sh]
7+
8+
depends_on: [build]
9+
skip_clone: true
10+
11+
steps:
12+
13+
manifest:
14+
image: mplatform/manifest-tool:alpine-v2.1.9
15+
commands: manifest-tool push from-args
16+
--platforms=linux/amd64,linux/arm64
17+
--template=ci-registry.schnabel.org/kokuwaio/shellcheck:$CI_PIPELINE_NUMBER-ARCH
18+
--target=ci-registry.schnabel.org/kokuwaio/shellcheck:$CI_PIPELINE_NUMBER
19+
20+
docker.io: &push
21+
image: quay.io/skopeo/stable:v1.17.0
22+
depends_on: [manifest]
23+
commands:
24+
- echo "$AUTH" > /tmp/auth.json
25+
- skopeo copy --all --preserve-digests --dest-precompute-digests
26+
docker://ci-registry.schnabel.org/kokuwaio/shellcheck:$CI_PIPELINE_NUMBER
27+
docker://$URL/kokuwaio/shellcheck:v0.10.0
28+
- skopeo copy --all --preserve-digests --dest-precompute-digests
29+
docker://ci-registry.schnabel.org/kokuwaio/shellcheck:$CI_PIPELINE_NUMBER
30+
docker://$URL/kokuwaio/shellcheck:latest
31+
environment:
32+
URL: docker.io
33+
AUTH: {from_secret: DOCKER_IO_AUTH}
34+
35+
ghcr.io:
36+
<<: *push
37+
environment:
38+
URL: ghcr.io
39+
AUTH: {from_secret: GHCR_IO_AUTH}

.woodpecker/test.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
when:
2+
instance: ci.schnabel.org
3+
repo: kokuwaio/shellcheck
4+
event: push
5+
branch: main
6+
path: [.woodpecker/build.yaml, .woodpecker/push.yaml, .woodpecker/test.yaml, Dockerfile, Dockerfile.dockerignore, entrypoint.sh]
7+
8+
depends_on: [push]
9+
matrix:
10+
PLATFORM: [amd64, arm64]
11+
labels:
12+
platform: linux/${PLATFORM}
13+
14+
steps:
15+
16+
test:
17+
image: kokuwaio/shellcheck
18+
pull: true

.yamllint.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
extends: default
2+
3+
## see https://yamllint.readthedocs.io/en/stable/rules.html
4+
rules:
5+
6+
# no need for document start
7+
document-start: disable
8+
9+
# line length is not important
10+
line-length: disable
11+
12+
# reduce space from 2
13+
comments:
14+
min-spaces-from-content: 1
15+
16+
# force double quotes everywhere
17+
quoted-strings:
18+
quote-type: double
19+
required: only-when-needed
20+
21+
# allow everything on keys
22+
truthy:
23+
check-keys: false

0 commit comments

Comments
 (0)