From 8c2dc1e1380e545e8f04e754291d69d8b1c53de4 Mon Sep 17 00:00:00 2001 From: Benjamin Reed Date: Thu, 15 Feb 2024 10:24:47 -0500 Subject: [PATCH] update to add merge support from release-2.x to master --- .circleci/config.yml | 89 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca31a2d..746551e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,6 +12,47 @@ executors: orbs: sign-packages: opennms/sign-packages@2.1.3 + branch-management: opennms/branch-management@2.3.0 + +commands: + shallow-clone: + description: "Quick shallow checkout (if possible)" + steps: + - run: + name: git clone + command: | + install -d -m 700 ~/.ssh + ssh-keyscan github.com >> ~/.ssh/known_hosts + ssh-keyscan -p 443 ssh.github.com >> ~/.ssh/known_hosts + chmod 600 ~/.ssh/known_hosts + git clone --no-checkout --filter=tree:0 "${CIRCLE_REPOSITORY_URL}" . + if [ -n "${CIRCLE_TAG}" ]; then + git checkout --force "${CIRCLE_TAG}" + git reset --hard "${CIRCLE_SHA1}" + else + git checkout --force -B "${CIRCLE_BRANCH}" "${CIRCLE_SHA1}" + fi + build: + description: "Build Cortex Plugin" + steps: + - restore_cache: + keys: + - v1-dependencies-{{ checksum "pom.xml" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + - run: + name: Compile source without tests + command: | + mvn -DskipITs=true -DskipTests=true clean install + - save_cache: + paths: + - ~/.m2 + key: v1-dependencies-{{ checksum "pom.xml" }} + - persist_to_workspace: + root: ~/ + paths: + - .m2 + - project workflows: build-deploy: @@ -20,6 +61,13 @@ workflows: - tests: requires: - build + - merge: + requires: + - tests + filters: + branches: + only: + - /^release-.*/ - deploy: context: - OSSRH Principal @@ -37,24 +85,7 @@ jobs: executor: build-executor steps: - checkout - - restore_cache: - keys: - - v1-dependencies-{{ checksum "pom.xml" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - run: - name: Compile source without tests - command: | - mvn -DskipITs=true -DskipTests=true clean install - - save_cache: - paths: - - ~/.m2 - key: v1-dependencies-{{ checksum "pom.xml" }} - - persist_to_workspace: - root: ~/ - paths: - - .m2 - - project + - build tests: executor: system-test-executor @@ -76,6 +107,28 @@ jobs: - store_test_results: path: ~/junit + merge: + executor: build-executor + + steps: + - add_ssh_keys: + fingerprints: + - "27:c8:b4:c2:27:cf:78:ae:5f:1f:3a:ee:d7:bb:e8:ca" + + - shallow-clone + - branch-management/merge-branch: + committer_email: "cicd-system@opennms.com" + committer_name: "CI/CD System" + from: release-2.x + to: master + + # make sure the build passes after merge + - build + + - run: + name: "Push to Master" + command: git push --no-verify origin master:master + deploy: executor: build-executor steps: