diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index c931ab5..0000000 --- a/.drone.yml +++ /dev/null @@ -1,95 +0,0 @@ ---- -kind: pipeline -type: docker -name: linting - -steps: - - name: gitleaks - image: plugins/gitleaks - settings: - path: . - when: - event: - exclude: - - tag - - - name: hadolint - image: hadolint/hadolint:latest-debian - commands: - - hadolint Dockerfile - ---- -kind: pipeline -type: docker -name: selfhosted -depends_on: # bezieht sich auf linting pipeline - - linting -steps: - - name: docker_build_and_push_selfhosted - image: plugins/docker - settings: - dockerfile: Dockerfile - repo: registry.mgrote.net/munin-server - registry: registry.mgrote.net - tags: - - ${DRONE_COMMIT_SHA:0:8} - - ${DRONE_COMMIT_BRANCH} - - latest - when: - event: - exclude: - - pull_request - - tag - - - name: docker_build_and_push_selfhosted_tag - image: plugins/docker - settings: - dockerfile: Dockerfile - repo: registry.mgrote.net/munin-server - registry: registry.mgrote.net - tags: - - ${DRONE_TAG} - when: - event: - - tag - ---- -kind: pipeline -type: docker -name: dockerhub -depends_on: # bezieht sich auf linting pipeline - - linting -steps: - - name: docker_build_and_push_dockerhub - image: plugins/docker - settings: - username: - from_secret: DOCKERHUB_USER - password: - from_secret: DOCKERHUB_PASS - dockerfile: Dockerfile - repo: quotengrote/munin-server - tags: - - ${DRONE_COMMIT_SHA:0:8} - - ${DRONE_COMMIT_BRANCH} - - latest - when: - event: - exclude: - - pull_request - - tag - - - name: docker_build_and_push_dockerhub_tag - image: plugins/docker - settings: - username: - from_secret: DOCKERHUB_USER - password: - from_secret: DOCKERHUB_PASS - dockerfile: Dockerfile - repo: quotengrote/munin-server - tags: - - ${DRONE_TAG} - when: - event: - - tag diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml new file mode 100644 index 0000000..ddcbe53 --- /dev/null +++ b/.woodpecker/build.yml @@ -0,0 +1,58 @@ +--- +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:v1.1.102" + 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 + + build_and_push: # damit dieser Step laufen kann muss das Repo in der Woodpecker-GUI "privilegiert" sein + image: "docker:25.0.3" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + commands: + - cat .variables + - source .variables + - | + docker buildx build \ + --tag registry.mgrote.net/$CI_REPO_NAME \ + --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 . + - docker push registry.mgrote.net/$CI_REPO_NAME:${CI_COMMIT_SHA:0:8} + - docker push registry.mgrote.net/$CI_REPO_NAME:${CI_COMMIT_BRANCH} + - docker push registry.mgrote.net/$CI_REPO_NAME:latest + - docker push registry.mgrote.net/$CI_REPO_NAME:$VERSION + - docker push registry.mgrote.net/$CI_REPO_NAME + when: + - evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' +... diff --git a/.woodpecker/lint.yml b/.woodpecker/lint.yml new file mode 100644 index 0000000..5360903 --- /dev/null +++ b/.woodpecker/lint.yml @@ -0,0 +1,29 @@ +--- +steps: + gitleaks: + image: zricethezav/gitleaks:v8.18.2 + commands: + - gitleaks detect --no-git --verbose --source $CI_WORKSPACE + when: + - evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' + + hadolint: + image: pipelinecomponents/hadolint:0.26.0 + commands: + - hadolint Dockerfile + when: + - evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' + + shellcheck: + image: "koalaman/shellcheck-alpine:latest" + 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: + - evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"' +...