From d2c1a79bbffc71f0490cf8354f4ff5febb8efb85 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 7 Nov 2023 16:36:15 +0100 Subject: [PATCH 1/5] refactor: migrate to woodpecker ci --- .drone.yml | 161 -------------------------- .gitsv/config.yml | 47 ++++++++ .prettierignore | 1 - .woodpecker/build-container.yml | 70 +++++++++++ .woodpecker/build-package.yml | 27 +++++ .woodpecker/docs.yml | 61 ++++++++++ .woodpecker/notify.yml | 26 +++++ Dockerfile => Containerfile.multiarch | 28 +++-- README.md | 20 +++- 9 files changed, 261 insertions(+), 180 deletions(-) delete mode 100644 .drone.yml create mode 100644 .gitsv/config.yml create mode 100644 .woodpecker/build-container.yml create mode 100644 .woodpecker/build-package.yml create mode 100644 .woodpecker/docs.yml create mode 100644 .woodpecker/notify.yml rename Dockerfile => Containerfile.multiarch (70%) diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 4e87ae0..0000000 --- a/.drone.yml +++ /dev/null @@ -1,161 +0,0 @@ ---- -kind: pipeline -name: test - -platform: - os: linux - arch: amd64 - -steps: - - name: markdownlint - image: thegeeklab/markdownlint-cli - commands: - - markdownlint 'README.md' - -trigger: - ref: - - refs/heads/main - - refs/tags/** - - refs/pull/** - ---- -kind: pipeline -name: build-container - -platform: - os: linux - arch: amd64 - -steps: - - name: tags - image: thegeeklab/docker-autotag - environment: - DOCKER_AUTOTAG_FORCE_LATEST: True - DOCKER_AUTOTAG_IGNORE_PRERELEASE: True - DOCKER_AUTOTAG_OUTPUT_FILE: .tags - DOCKER_AUTOTAG_VERSION: ${DRONE_TAG} - - - name: dryrun - image: thegeeklab/drone-docker-buildx:23 - settings: - dockerfile: Dockerfile - dry_run: true - provenance: false - repo: thegeeklab/${DRONE_REPO_NAME} - when: - ref: - - refs/pull/** - depends_on: - - tags - - - name: publish-dockerhub - image: thegeeklab/drone-docker-buildx:23 - settings: - dockerfile: Dockerfile - password: - from_secret: docker_password - provenance: false - repo: thegeeklab/${DRONE_REPO_NAME} - username: - from_secret: docker_username - when: - ref: - - refs/heads/main - - refs/tags/** - depends_on: - - tags - - - name: publish-quay - image: thegeeklab/drone-docker-buildx:23 - settings: - dockerfile: Dockerfile - password: - from_secret: quay_password - provenance: false - registry: quay.io - repo: quay.io/thegeeklab/${DRONE_REPO_NAME} - username: - from_secret: quay_username - when: - ref: - - refs/heads/main - - refs/tags/** - depends_on: - - tags - -trigger: - ref: - - refs/heads/main - - refs/tags/** - - refs/pull/** - -depends_on: - - test - ---- -kind: pipeline -name: notifications - -platform: - os: linux - arch: amd64 - -steps: - - name: pushrm-dockerhub - image: chko/docker-pushrm:1 - environment: - DOCKER_PASS: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - PUSHRM_FILE: README.md - PUSHRM_SHORT: Custom Alpine image including a Kubernetes toolset - PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME} - when: - status: - - success - - - name: pushrm-quay - image: chko/docker-pushrm:1 - environment: - APIKEY__QUAY_IO: - from_secret: quay_token - PUSHRM_FILE: README.md - PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME} - when: - status: - - success - - - name: matrix - image: thegeeklab/drone-matrix - settings: - homeserver: - from_secret: matrix_homeserver - password: - from_secret: matrix_password - roomid: - from_secret: matrix_roomid - template: "Status: **{{ .Build.Status }}**
Build: [{{ .Repo.Owner }}/{{ .Repo.Name }}]({{ .Build.Link }}){{ if .Build.Branch }} ({{ .Build.Branch }}){{ end }} by {{ .Commit.Author }}
Message: {{ .Commit.Message.Title }}" - username: - from_secret: matrix_username - when: - status: - - success - - failure - -trigger: - ref: - - refs/heads/main - - refs/tags/** - status: - - success - - failure - -depends_on: - - build-container - ---- -kind: signature -hmac: d6faa59061de84a714b22c369b785c8722fdb65c6f6f6a1ade9ca6d8caec726a - -... diff --git a/.gitsv/config.yml b/.gitsv/config.yml new file mode 100644 index 0000000..acaf506 --- /dev/null +++ b/.gitsv/config.yml @@ -0,0 +1,47 @@ +--- +version: "1.1" + +versioning: + update-major: [] + update-minor: [feat] + update-patch: [fix, perf, refactor, chore, test, ci, docs] + +tag: + pattern: "v%d.%d.%d" + +release-notes: + sections: + - name: Features + commit-types: [feat] + section-type: commits + - name: Bug Fixes + commit-types: [fix] + section-type: commits + - name: Performance Improvements + commit-types: [perf] + section-type: commits + - name: Code Refactoring + commit-types: [refactor] + section-type: commits + - name: Others + commit-types: [chore] + section-type: commits + - name: Testing + commit-types: [test] + section-type: commits + - name: CI Pipeline + commit-types: [ci] + section-type: commits + - name: Documentation + commit-types: [docs] + section-type: commits + - name: BREAKING CHANGES + section-type: breaking-changes + +commit-message: + footer: + issue: + key: issue + add-value-prefix: "#" + issue: + regex: "#?[0-9]+" diff --git a/.prettierignore b/.prettierignore index 23a4f05..135c35d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,2 @@ -.drone.yml *.tpl.md LICENSE diff --git a/.woodpecker/build-container.yml b/.woodpecker/build-container.yml new file mode 100644 index 0000000..90cbce6 --- /dev/null +++ b/.woodpecker/build-container.yml @@ -0,0 +1,70 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + security-build: + image: quay.io/thegeeklab/wp-docker-buildx:1 + settings: + containerfile: Containerfile.multiarch + output: type=oci,dest=oci/${CI_REPO_NAME},tar=false + repo: thegeeklab/${CI_REPO_NAME} + + security-scan: + image: ghcr.io/aquasecurity/trivy + commands: + - trivy -v + - trivy image --input oci/${CI_REPO_NAME} + environment: + TRIVY_EXIT_CODE: "1" + TRIVY_IGNORE_UNFIXED: "true" + TRIVY_NO_PROGRESS: "true" + TRIVY_SEVERITY: HIGH,CRITICAL + TRIVY_TIMEOUT: 1m + TRIVY_SKIP_FILES: /usr/local/bin/gomplate + + publish-dockerhub: + group: container + image: quay.io/thegeeklab/wp-docker-buildx:1 + settings: + auto_tag: true + containerfile: Containerfile.multiarch + password: + from_secret: docker_password + platforms: + - linux/amd64 + - linux/arm64 + provenance: false + repo: thegeeklab/${CI_REPO_NAME} + username: + from_secret: docker_username + when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + + publish-quay: + group: container + image: quay.io/thegeeklab/wp-docker-buildx:1 + settings: + auto_tag: true + containerfile: Containerfile.multiarch + password: + from_secret: quay_password + platforms: + - linux/amd64 + - linux/arm64 + provenance: false + registry: quay.io + repo: quay.io/thegeeklab/${CI_REPO_NAME} + username: + from_secret: quay_username + when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} diff --git a/.woodpecker/build-package.yml b/.woodpecker/build-package.yml new file mode 100644 index 0000000..34a8589 --- /dev/null +++ b/.woodpecker/build-package.yml @@ -0,0 +1,27 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + changelog: + image: quay.io/thegeeklab/git-sv + commands: + - git fetch --depth=2147483647 + - git sv current-version + - git sv release-notes -t ${CI_COMMIT_TAG:-next} -o CHANGELOG.md + - cat CHANGELOG.md + + publish-gitea: + image: plugins/gitea-release + settings: + api_key: + from_secret: gitea_token + base_url: https://gitea.rknet.org + note: CHANGELOG.md + overwrite: true + title: ${CI_COMMIT_TAG} + when: + - event: [tag] diff --git a/.woodpecker/docs.yml b/.woodpecker/docs.yml new file mode 100644 index 0000000..0a46235 --- /dev/null +++ b/.woodpecker/docs.yml @@ -0,0 +1,61 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + markdownlint: + image: quay.io/thegeeklab/markdownlint-cli + commands: + - markdownlint 'README.md' + + spellcheck: + image: quay.io/thegeeklab/alpine-tools + commands: + - spellchecker --files '_docs/**/*.md' 'README.md' -d .dictionary -p spell indefinite-article syntax-urls + environment: + FORCE_COLOR: "true" + NPM_CONFIG_LOGLEVEL: "error" + + link-validation: + image: docker.io/lycheeverse/lychee + group: test + commands: + - lychee --no-progress --format detailed README.md + + pushrm-dockerhub: + image: docker.io/chko/docker-pushrm:1 + secrets: + - source: docker_password + target: DOCKER_PASS + - source: docker_username + target: DOCKER_USER + environment: + PUSHRM_FILE: README.md + PUSHRM_SHORT: Custom Alpine image including a Kubernetes toolkit + PUSHRM_TARGET: thegeeklab/${CI_REPO_NAME} + when: + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + status: [success] + + pushrm-quay: + image: docker.io/chko/docker-pushrm:1 + secrets: + - source: quay_token + target: APIKEY__QUAY_IO + environment: + PUSHRM_FILE: README.md + PUSHRM_TARGET: quay.io/thegeeklab/${CI_REPO_NAME} + when: + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + status: [success] + +depends_on: + - build-package + - build-container diff --git a/.woodpecker/notify.yml b/.woodpecker/notify.yml new file mode 100644 index 0000000..a851904 --- /dev/null +++ b/.woodpecker/notify.yml @@ -0,0 +1,26 @@ +--- +when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +runs_on: [success, failure] + +steps: + matrix: + image: quay.io/thegeeklab/wp-matrix + settings: + homeserver: + from_secret: matrix_homeserver + password: + from_secret: matrix_password + roomid: + from_secret: matrix_roomid + username: + from_secret: matrix_username + when: + - status: [success, failure] + +depends_on: + - docs diff --git a/Dockerfile b/Containerfile.multiarch similarity index 70% rename from Dockerfile rename to Containerfile.multiarch index e86d806..7670baf 100644 --- a/Dockerfile +++ b/Containerfile.multiarch @@ -1,11 +1,15 @@ -FROM alpine:3.18@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978 +FROM docker.io/alpine:3.18@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978 LABEL maintainer="Robert Kaussow " LABEL org.opencontainers.image.authors="Robert Kaussow " LABEL org.opencontainers.image.title="kube-tools" -LABEL org.opencontainers.image.url="https://gitea.rknet.org/docker/kube-tools" -LABEL org.opencontainers.image.source="https://gitea.rknet.org/docker/kube-tools" -LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/docker/kube-tools" +LABEL org.opencontainers.image.url="https://gitea.rknet.org/container/kube-tools" +LABEL org.opencontainers.image.source="https://gitea.rknet.org/container/kube-tools" +LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/container/kube-tools" + +ARG TARGETOS +ARG TARGETARCH +ARG TARGETVARIANT ARG KUBECTL_VERSION ARG YQ_VERSION @@ -31,16 +35,16 @@ ENV FLUX_LOCAL_VERSION="${FLUX_LOCAL_VERSION:-3.1.1}" RUN apk --update add curl tar bash python3 py3-yaml py3-pip findutils git && \ pip install -qq --no-cache-dir flux-local=="$FLUX_LOCAL_VERSION" && \ - curl -SsfL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \ - curl -SsfL -o /usr/local/bin/kubectl-convert "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl-convert" && \ - curl -SsfL -o /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" && \ - curl -SsfL "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" \ - | tar xz --strip-components=1 -C /usr/local/bin linux-amd64/helm && \ - curl -SsfL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz" \ + curl -SsfL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl" && \ + curl -SsfL -o /usr/local/bin/kubectl-convert "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl-convert" && \ + curl -SsfL -o /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_${TARGETOS}_${TARGETARCH}" && \ + curl -SsfL "https://get.helm.sh/helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz" \ + | tar xz --strip-components=1 -C /usr/local/bin "${TARGETOS}-${TARGETARCH}/helm" && \ + curl -SsfL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz" \ | tar xz -C /usr/local/bin kustomize && \ - curl -SsfL "https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" \ + curl -SsfL "https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-${TARGETOS}-${TARGETARCH}.tar.gz" \ | tar xz -C /usr/local/bin kubeconform && \ - curl -SsfL "https://github.com/FairwindsOps/polaris/releases/download/${POLARIS_VERSION}/polaris_linux_amd64.tar.gz" \ + curl -SsfL "https://github.com/FairwindsOps/polaris/releases/download/${POLARIS_VERSION}/polaris_${TARGETOS}_${TARGETARCH}.tar.gz" \ | tar xz -C /usr/local/bin polaris && \ chmod 755 /usr/local/bin/kubectl && \ chmod 755 /usr/local/bin/kubectl-convert && \ diff --git a/README.md b/README.md index 866ca8a..a26bd7a 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,23 @@ # kube-tools -Custom Alpine image including a Kubernetes toolset +Custom Alpine image including a Kubernetes toolkit -[![Build Status](https://img.shields.io/drone/build/docker/kube-tools?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/docker/kube-tools) + + +[![Build Status](https://ci.rknet.org/api/badges/container/kube-tools/status.svg)](https://ci.rknet.org/repos/container/kube-tools) [![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/alpine) [![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/alpine) -[![Source: Gitea](https://img.shields.io/badge/source-gitea-blue.svg?logo=gitea&logoColor=white)](https://gitea.rknet.org/docker/kube-tools) -[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/docker/kube-tools/src/branch/main/LICENSE) +[![Source: Gitea](https://img.shields.io/badge/source-gitea-blue.svg?logo=gitea&logoColor=white)](https://gitea.rknet.org/container/kube-tools) +[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/container/kube-tools/src/branch/main/LICENSE) -Custom Alpine image including a Kubernetes toolset. + + +Custom Alpine image including a Kubernetes toolkit. **Included software:** + + - yq - helm - kubectl @@ -20,6 +26,8 @@ Custom Alpine image including a Kubernetes toolset. - flux-local - Fairwinds Polaris + + ## License -This project is licensed under the MIT License - see the [LICENSE](https://gitea.rknet.org/docker/kube-tools/src/branch/main/LICENSE) file for details. +This project is licensed under the MIT License - see the [LICENSE](https://gitea.rknet.org/container/kube-tools/src/branch/main/LICENSE) file for details. -- 2.45.2 From 3266d59c2be0d130f62c8d7193b28ff13627358c Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 7 Nov 2023 16:42:10 +0100 Subject: [PATCH 2/5] add dictionary --- .dictionary | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .dictionary diff --git a/.dictionary b/.dictionary new file mode 100644 index 0000000..e69de29 -- 2.45.2 From c68286d06169e6c3c12ffffe214d082db30b4a4b Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 7 Nov 2023 21:37:11 +0100 Subject: [PATCH 3/5] fix ci --- .woodpecker/build-container.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.woodpecker/build-container.yml b/.woodpecker/build-container.yml index 90cbce6..8b99b9f 100644 --- a/.woodpecker/build-container.yml +++ b/.woodpecker/build-container.yml @@ -24,7 +24,11 @@ steps: TRIVY_NO_PROGRESS: "true" TRIVY_SEVERITY: HIGH,CRITICAL TRIVY_TIMEOUT: 1m - TRIVY_SKIP_FILES: /usr/local/bin/gomplate + TRIVY_SKIP_FILES: >- + /usr/local/bin/gomplate, + /usr/local/bin/helm, + /usr/local/bin/polaris, + /usr/local/bin/yq publish-dockerhub: group: container -- 2.45.2 From 7b14af42fb2b4f897e9b96595b3abf8f75ec0c23 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 7 Nov 2023 21:56:39 +0100 Subject: [PATCH 4/5] fix ci --- .woodpecker/build-container.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.woodpecker/build-container.yml b/.woodpecker/build-container.yml index 8b99b9f..b969cd3 100644 --- a/.woodpecker/build-container.yml +++ b/.woodpecker/build-container.yml @@ -24,11 +24,7 @@ steps: TRIVY_NO_PROGRESS: "true" TRIVY_SEVERITY: HIGH,CRITICAL TRIVY_TIMEOUT: 1m - TRIVY_SKIP_FILES: >- - /usr/local/bin/gomplate, - /usr/local/bin/helm, - /usr/local/bin/polaris, - /usr/local/bin/yq + TRIVY_SKIP_FILES: /usr/local/bin/gomplate,/usr/local/bin/helm,/usr/local/bin/polaris,/usr/local/bin/yq publish-dockerhub: group: container -- 2.45.2 From 75c7a60db3e4be27891668430a93c91008f51022 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 7 Nov 2023 22:07:13 +0100 Subject: [PATCH 5/5] fix ci --- .dictionary | 2 ++ .woodpecker/docs.yml | 2 +- README.md | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.dictionary b/.dictionary index e69de29..7d94058 100644 --- a/.dictionary +++ b/.dictionary @@ -0,0 +1,2 @@ +kube-tools +Kubernetes diff --git a/.woodpecker/docs.yml b/.woodpecker/docs.yml index 0a46235..8ce8d32 100644 --- a/.woodpecker/docs.yml +++ b/.woodpecker/docs.yml @@ -34,7 +34,7 @@ steps: target: DOCKER_USER environment: PUSHRM_FILE: README.md - PUSHRM_SHORT: Custom Alpine image including a Kubernetes toolkit + PUSHRM_SHORT: Custom Kubernetes toolkit container based on Alpine PUSHRM_TARGET: thegeeklab/${CI_REPO_NAME} when: - event: [push, manual] diff --git a/README.md b/README.md index a26bd7a..2f77ee5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # kube-tools -Custom Alpine image including a Kubernetes toolkit +Custom Kubernetes toolkit container based on Alpine @@ -12,7 +12,7 @@ Custom Alpine image including a Kubernetes toolkit -Custom Alpine image including a Kubernetes toolkit. +Custom Kubernetes toolkit container based on Alpine. **Included software:** -- 2.45.2