From 470c2661572e59cf99552122db299726e866afe0 Mon Sep 17 00:00:00 2001 From: "Michael N. Lipp" Date: Mon, 11 Aug 2025 12:50:28 +0200 Subject: [PATCH] Build with woodpecker (#1) Reviewed-on: https://forgejo.mnl.de/mnl/VM-Operator/pulls/1 Co-authored-by: Michael N. Lipp Co-committed-by: Michael N. Lipp --- .gitlab-ci.yml | 78 ------------------------------------------ .woodpecker/build.yaml | 38 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 78 deletions(-) delete mode 100644 .gitlab-ci.yml create mode 100644 .woodpecker/build.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index b7b04f0..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,78 +0,0 @@ -stages: - - build - - test - - publish - - deploy - -.any-job: - rules: - - if: $CI_SERVER_HOST == "gitlab.mnl.de" - -.gradle-job: - extends: .any-job - image: registry.mnl.de/org/jgrapes/jdk21-builder:v2 - cache: - - key: dependencies-${CI_COMMIT_BRANCH} - policy: pull-push - paths: - - .gradle - - node_modules - - key: "$CI_COMMIT_SHA" - policy: pull-push - paths: - - build - - "*/build" - before_script: - - echo -n $CI_REGISTRY_PASSWORD | podman login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY - - git switch $(git branch -r --sort="authordate" --contains $CI_COMMIT_SHA | head -1 | sed -e 's#.*/##') - - git pull - - git reset --hard $CI_COMMIT_SHA - -build-jars: - stage: build - extends: .gradle-job - script: - - ./gradlew -Pdocker.registry=$CI_REGISTRY_IMAGE build apidocs - -publish-images: - stage: publish - extends: .gradle-job - dependencies: - - build-jars - script: - - ./gradlew -Pdocker.registry=$CI_REGISTRY_IMAGE publishImage - -.pages-job: - extends: .any-job - image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/ruby:3.2 - variables: - JEKYLL_ENV: production - LC_ALL: C.UTF-8 - before_script: - - git fetch origin gh-pages - - git checkout gh-pages - - gem install bundler - - bundle install - -test-pages: - stage: test - extends: .pages-job - rules: - - if: $CI_COMMIT_BRANCH == "gh-pages" - script: - - bundle exec jekyll build -d test - artifacts: - paths: - - test - -#publish-pages: -# stage: publish -# extends: .pages-job -# rules: -# - if: $CI_COMMIT_BRANCH == "gh-pages" -# script: -# - bundle exec jekyll build -d public -# artifacts: -# paths: -# - public -# environment: production diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..56a575c --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,38 @@ +when: +- event: push + evaluate: 'CI_SYSTEM_HOST == "woodpecker.mnl.de"' + +clone: +- name: git + image: woodpeckerci/plugin-git + settings: + partial: false + tags: true + depth: 0 + +steps: +- name: prepare + image: alpine + commands: + # Because we run the next step as user 1000 to make podman work: + - mkdir /woodpecker/workflow + - chown 1000:1000 /woodpecker/workflow + - chown -R 1000:1000 $CI_WORKSPACE + +- name: build-jars + image: registry.mnl.de/mnl/jdk21-builder:v4 + environment: + HOME: /woodpecker/workflow + REGISTRY: registry.mnl.de + REGISTRY_USER: mnl + REGISTRY_TOKEN: + from_secret: REGISTRY_TOKEN + commands: + - echo $REGISTRY_TOKEN | podman login -u $REGISTRY_USER --password-stdin $REGISTRY + - ./gradlew -Pdocker.registry=$REGISTRY/$REGISTRY_USER build apidocs publishImage + backend_options: + kubernetes: + securityContext: + privileged: true + runAsUser: 1000 + runAsGroup: 1000