Skip to content

Commit b64dfba

Browse files
committed
Initial draft of plugin.
1 parent 86c0197 commit b64dfba

File tree

16 files changed

+806
-0
lines changed

16 files changed

+806
-0
lines changed

.github/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Buildctl WoodpeckerCI Plugin
2+
3+
[![pulls](https://img.shields.io/docker/pulls/kokuwaio/buildctl)](https://hub.docker.com/r/kokuwaio/buildctl)
4+
[![size](https://img.shields.io/docker/image-size/kokuwaio/buildctl)](https://hub.docker.com/r/kokuwaio/buildctl)
5+
[![dockerfile](https://img.shields.io/badge/source-Dockerfile%20-blue)](https://git.kokuwa.io/woodpecker/buildctl/src/branch/main/Dockerfile)
6+
[![license](https://img.shields.io/badge/License-EUPL%201.2-blue)](https://git.kokuwa.io/woodpecker/buildctl/src/branch/main/LICENSE)
7+
[![prs](https://img.shields.io/gitea/pull-requests/open/woodpecker/buildctl?gitea_url=https%3A%2F%2Fgit.kokuwa.io)](https://git.kokuwa.io/woodpecker/buildctl/pulls)
8+
[![issues](https://img.shields.io/gitea/issues/open/woodpecker/buildctl?gitea_url=https%3A%2F%2Fgit.kokuwa.io)](https://git.kokuwa.io/woodpecker/buildctl/issues)
9+
10+
A [WoodpeckerCI](https://woodpecker-ci.org) plugin for [buildctl](https://github.com/moby/buildkit) to build container images using a remote buildkit host.
11+
Also usable with Gitlab, Github or locally, see examples for usage.
12+
13+
For more documention see: [git.kokuwa.io/woodpecker/buildctl](https://git.kokuwa.io/woodpecker/buildctl)

.github/workflows/build.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build
2+
3+
on: push
4+
5+
jobs:
6+
7+
buildx:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@main
11+
- uses: docker/setup-qemu-action@master
12+
- uses: docker/setup-buildx-action@master
13+
- uses: docker/build-push-action@master
14+
with:
15+
platforms: linux/amd64,linux/arm64

.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

.justfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# https://just.systems/man/en/
2+
3+
[private]
4+
@default:
5+
just --list --unsorted
6+
7+
# Run linter.
8+
@lint:
9+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/shellcheck
10+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/hadolint
11+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/yamllint
12+
docker run --rm --read-only --volume=$(pwd):$(pwd):rw --workdir=$(pwd) kokuwaio/markdownlint --fix
13+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/renovate
14+
docker run --rm --read-only --volume=$(pwd):$(pwd):ro --workdir=$(pwd) woodpeckerci/woodpecker-cli lint
15+
16+
# Build image with local docker daemon.
17+
@build:
18+
docker build . --tag=kokuwaio/buildctl:dev --load
19+
20+
# Inspect image with docker.
21+
@inspect: build
22+
docker image inspect kokuwaio/buildctl:dev
23+
24+
# Inspect image layers with `dive`.
25+
@dive: build
26+
docker run --rm -it --volume=/var/run/docker.sock:/var/run/docker.sock:ro wagoodman/dive:latest kokuwaio/buildctl:dev

.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: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
when:
2+
instance: ci.kokuwa.io
3+
repo: woodpecker/buildctl
4+
event: [manual, push, pull_request]
5+
branch: main
6+
path: [.woodpecker/build.yaml, Dockerfile, Dockerfile.dockerignore, entrypoint.sh]
7+
8+
steps:
9+
10+
build:
11+
image: kokuwaio/buildctl
12+
settings: &settings
13+
name: registry.kokuwa.io/kokuwaio/buildctl:ci-${CI_PIPELINE_NUMBER}
14+
auth:
15+
registry.kokuwa.io:
16+
username: {from_secret: kokuwa_io_username}
17+
password: {from_secret: kokuwa_io_password}
18+
platform: [linux/amd64, linux/arm64]
19+
annotation:
20+
org.opencontainers.image.title: Buildctl WoodpeckerCI Plugin
21+
org.opencontainers.image.description: A WoodpeckerCI plugin for buildctl to build container images using a remote builtkitd instance.
22+
org.opencontainers.image.url: $CI_REPO_URL
23+
org.opencontainers.image.documentation: $CI_REPO_URL/README.md
24+
org.opencontainers.image.source: $CI_REPO_CLONE_URL
25+
org.opencontainers.image.revision: $CI_COMMIT_SHA
26+
org.opencontainers.image.vendor: kokuwa.io
27+
org.opencontainers.image.licenses: EUPL-1.2
28+
org.opencontainers.image.ref.name: kokuwaio/buildctl
29+
org.opencontainers.image.version: v0.23.1
30+
when:
31+
event: pull_request
32+
33+
push:
34+
image: kokuwaio/buildctl
35+
settings:
36+
<<: *settings
37+
name:
38+
- registry.kokuwa.io/kokuwaio/buildctl:latest
39+
- registry.kokuwa.io/kokuwaio/buildctl:v0.23.1
40+
- docker.io/kokuwaio/buildctl:latest
41+
- docker.io/kokuwaio/buildctl:v0.23.1
42+
- ghcr.io/kokuwaio/buildctl:latest
43+
- ghcr.io/kokuwaio/buildctl:v0.23.1
44+
auth:
45+
"https://index.docker.io/v1/":
46+
username: {from_secret: docker_io_username}
47+
password: {from_secret: docker_io_password}
48+
ghcr.io:
49+
username: {from_secret: ghcr_io_username}
50+
password: {from_secret: ghcr_io_password}
51+
registry.kokuwa.io:
52+
username: {from_secret: kokuwa_io_username}
53+
password: {from_secret: kokuwa_io_password}
54+
when:
55+
event: [manual, push]
56+
branch: main

.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.kokuwa.io
3+
repo: woodpecker/buildctl
4+
event: [manual, push]
5+
branch: main
6+
path: [.woodpecker/dockerhub.yaml, README.md]
7+
8+
steps:
9+
10+
metadata:
11+
image: kokuwaio/dockerhub-metadata
12+
settings:
13+
repository: kokuwaio/buildctl
14+
description-short: A WoodpeckerCI plugin for buildctl to build container images using a remote builtkitd instance.
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: [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, "**/Dockerfile"]]
27+
28+
shellcheck:
29+
image: kokuwaio/shellcheck
30+
depends_on: []
31+
when: [path: [.woodpecker/lint.yaml, "**/*.sh"]]

.woodpecker/test.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
when:
2+
instance: ci.kokuwa.io
3+
repo: woodpecker/buildctl
4+
event: [manual, push, pull_request]
5+
branch: main
6+
path: [.woodpecker/build.yaml, Dockerfile, Dockerfile.dockerignore, entrypoint.sh]
7+
8+
depends_on: [build]
9+
matrix:
10+
PLATFORM: [amd64, arm64]
11+
labels:
12+
platform: linux/${PLATFORM}
13+
14+
steps:
15+
16+
pr:
17+
image: registry.kokuwa.io/kokuwaio/buildctl:ci-${CI_PIPELINE_NUMBER}
18+
commands: buildctl --version
19+
when:
20+
event: pull_request
21+
22+
kokuwa.io: &version
23+
image: registry.kokuwa.io/kokuwaio/buildctl
24+
pull: true
25+
commands: buildctl --version
26+
when:
27+
event: [manual, push]
28+
branch: main
29+
30+
docker.io:
31+
image: docker.io/kokuwaio/buildctl
32+
<<: *version
33+
34+
ghcr.io:
35+
image: ghcr.io/kokuwaio/buildctl
36+
<<: *version

.yamllint.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
# force double quotes everywhere
13+
quoted-strings:
14+
quote-type: double
15+
required: only-when-needed
16+
17+
# allow everything on keys
18+
truthy:
19+
check-keys: false

0 commit comments

Comments
 (0)