commit e8c5dcb8b6a6850ddb6184030b9fe461820f82d8 Author: Michael Grote Date: Tue Jul 9 22:35:14 2024 +0200 first commit diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml new file mode 100644 index 0000000..511755b --- /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="0" + 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, cron] + 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:27.0.3" + 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, cron] + evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' +... diff --git a/.woodpecker/lint.yml b/.woodpecker/lint.yml new file mode 100644 index 0000000..bf7074c --- /dev/null +++ b/.woodpecker/lint.yml @@ -0,0 +1,32 @@ +--- +steps: + gitleaks: + image: zricethezav/gitleaks:v8.18.4 + commands: + - gitleaks detect --no-git --verbose --source $CI_WORKSPACE + when: + - event: [push, pull_request, cron] + evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' + + hadolint: + image: pipelinecomponents/hadolint:0.26.4 + commands: + - hadolint Dockerfile + when: + - event: [push, pull_request, cron] + 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, cron] + evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' +... diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7714eab --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR / +COPY requirements.txt . + +# hadolint ignore=DL3008,DL3028 +RUN apt-get update \ + && apt-get -y --no-install-recommends install \ + python3-full \ + python3-pip \ + wget\ + && pip install --no-cache-dir --break-system-packages -r requirements.txt \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* + +RUN wget https://git.mgrote.net/mg/homeserver/raw/branch/master/requirements.yaml \ + && ansible-galaxy install -r requirements.yaml diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..eb38182 --- /dev/null +++ b/renovate.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + ":dependencyDashboard", + ":semanticPrefixFixDepsChoreOthers", + ":ignoreModulesAndTests", + "group:monorepos", + "group:recommended", + "replacements:all", + "workarounds:all", + "mergeConfidence:all-badges" + ] +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5013d0c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +pylint==3.2.5 +pykeepass==4.0.3 +Jinja2==2.11.2 +markupsafe==2.1.5 +jmespath==1.0.1 +ansible==10.1.0 +docker-compose==1.29.2