commit 8ed6286d2b0dcc3576c51f3074dad529f7e1faa3 Author: Michael Grote Date: Wed May 8 14:38:53 2024 +0200 first commit diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml new file mode 100644 index 0000000..714219c --- /dev/null +++ b/.woodpecker/build.yml @@ -0,0 +1,61 @@ +--- +depends_on: + - lint + +clone: + git: + image: "woodpeckerci/plugin-git:2.5.0" + settings: + depth: 9999 # wird benötigt um die Commits zählen zu können + lfs: false + partial: false + +steps: + set_variables: + image: "registry.mgrote.net/allzweckcontainer:latest" + commands: + # set version + - | + MAJOR="1" + MINOR="1" + PATCH="$(git rev-list --count "$CI_COMMIT_BRANCH")" + VERSION="v$MAJOR.$MINOR.$PATCH" + if [ "$CI_COMMIT_BRANCH" != "main" ] && [ "$CI_COMMIT_BRANCH" != "master" ]; then + VERSION=$VERSION-dev + fi + echo "VERSION=$VERSION" >> .variables + # set date + - | + DATE=$(date --iso-8601=seconds) + echo "DATE=$DATE" >> .variables + when: + - event: [push, pull_request] + evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' + + build_and_push: # damit dieser Step laufen kann muss das Repo in der Woodpecker-GUI "privilegiert" sein + image: "docker:26.1.1" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + commands: + - cat .variables + - source .variables + # https://unix.stackexchange.com/questions/748633/error-multiple-platforms-feature-is-currently-not-supported-for-docker-driver + - docker buildx create --use --platform=linux/amd64 --name multi-platform-builder + - docker buildx inspect --bootstrap + - | + docker buildx build \ + --platform=linux/amd64 \ + --push \ + --tag registry.mgrote.net/${CI_REPO_NAME}:${CI_COMMIT_SHA:0:8} \ + --tag registry.mgrote.net/${CI_REPO_NAME}:${CI_COMMIT_BRANCH} \ + --tag registry.mgrote.net/${CI_REPO_NAME}:latest \ + --tag registry.mgrote.net/${CI_REPO_NAME}:$VERSION \ + --label org.opencontainers.image.url=$CI_REPO_URL \ + --label org.opencontainers.image.source=$CI_REPO_URL \ + --label org.opencontainers.image.revision=$CI_COMMIT_SHA \ + --label org.opencontainers.image.created=$DATE \ + --file Dockerfile . + when: + - event: [push, pull_request] + evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' +... diff --git a/.woodpecker/lint.yml b/.woodpecker/lint.yml new file mode 100644 index 0000000..8d2307b --- /dev/null +++ b/.woodpecker/lint.yml @@ -0,0 +1,32 @@ +--- +steps: + gitleaks: + image: zricethezav/gitleaks:v8.18.2 + commands: + - gitleaks detect --no-git --verbose --source $CI_WORKSPACE + when: + - event: [push, pull_request] + evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' + + hadolint: + image: pipelinecomponents/hadolint:0.26.1 + commands: + - hadolint Dockerfile + when: + - event: [push, pull_request] + evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' + + shellcheck: + image: "koalaman/shellcheck-alpine:v0.10.0" + commands: + - | + find . -type f -not -path './.git/*' -not -path './collections/*' -exec file {} \; | while IFS= read -r line; do + if echo "$line" | grep -q "shell script"; then + file_path=$(echo "$line" | awk -F':' '{print $1}') + shellcheck "$file_path" + fi + done + when: + - event: [push, pull_request] + evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' +... diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..912f24f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive + +# hadolint ignore=DL3008,DL3028 +RUN apt-get update \ + && apt-get -y --no-install-recommends install \ + python3-full \ + && pip3 install --no-cache-dir --break-system-packages pylint==3.1.0 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..8b7515a --- /dev/null +++ b/renovate.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base", + "default:pinDigestsDisabled" + ] +}