Skip to content

Commit

Permalink
parameterize java version and fix environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Mar 19, 2024
1 parent 48997d3 commit 65dfaca
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ version: 2.1
executors:
build-executor:
machine:
image: ubuntu-2004:current
image: ubuntu-2204:current

parameters:
cache_version:
description: the current version of the cache
type: string
default: v4
default: "v4"
java_version:
description: the base java version
type: string
default: "8"

orbs:
branch-management: opennms/[email protected]
Expand All @@ -32,14 +36,22 @@ commands:
paths:
- ".git"

pre-build:
description: Set Up the Build Environment
steps:
- run:
name: Install (Or Upgrade) Java << pipeline.parameters.java_version >>
command: sudo apt update && sudo apt -y install openjdk-<< pipeline.parameters.java_version >>-jdk-headless

build:
description: Check Out and Build Code
steps:
- fetch_maven_cache
- run:
name: Run the build
no_output_timeout: 20m
command: mvn -DskipTests=true install
command: |
mvn -DskipTests=true install
generate_megapom:
steps:
Expand Down Expand Up @@ -99,11 +111,12 @@ jobs:
resource_class: xlarge

environment:
JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64
JAVA_HOME: /usr/lib/jvm/java-<< pipeline.parameters.java_version >>-openjdk-amd64
MAVEN_OPTS: -Xmx4096m -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseGCOverheadLimit

steps:
- cached_checkout
- pre-build
- build
- store_maven_cache

Expand Down Expand Up @@ -136,7 +149,7 @@ jobs:
executor: build-executor

environment:
JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64
JAVA_HOME: /usr/lib/jvm/java-<< pipeline.parameters.java_version >>-openjdk-amd64
MAVEN_OPTS: -Xmx4096m -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseGCOverheadLimit
GIT_MERGE_AUTOEDIT: no

Expand All @@ -151,6 +164,7 @@ jobs:
to: main

# make sure the build passes after merge
- pre-build
- build

- run:
Expand All @@ -161,18 +175,18 @@ jobs:
executor: build-executor

environment:
JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64
JAVA_HOME: /usr/lib/jvm/java-<< pipeline.parameters.java_version >>-openjdk-amd64

steps:
- attach_workspace:
at: .

- fetch_maven_cache

- pre-build
- run:
name: Deploy the artifacts
command: |
mvn -s .circleci.settings.xml -DskipTests deploy
command: mvn -s .circleci.settings.xml -DskipTests deploy

workflows:
build-deploy:
Expand Down

0 comments on commit 65dfaca

Please sign in to comment.