From ba1d6d1fa1a22970ea75b3500582b87c8c3b8851 Mon Sep 17 00:00:00 2001 From: Maros Orsak Date: Wed, 28 Jun 2023 15:39:55 +0200 Subject: [PATCH] Make maven sonatype plugin work also with Java 17, and publish for 17 only (#58) * Make maven sonatype plugin work also with Java 17 Signed-off-by: see-quick * remove flakiness of test cases Signed-off-by: see-quick * add conditional to push only in Java 17 Signed-off-by: see-quick --------- Signed-off-by: see-quick --- .azure/build-pipeline.yaml | 27 +++++++++++----------- .azure/templates/steps/push_artifacts.yaml | 13 +++++++++++ pom.xml | 2 +- 3 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 .azure/templates/steps/push_artifacts.yaml diff --git a/.azure/build-pipeline.yaml b/.azure/build-pipeline.yaml index 18b2824..6d641e3 100644 --- a/.azure/build-pipeline.yaml +++ b/.azure/build-pipeline.yaml @@ -13,6 +13,10 @@ pr: include: - '*' +variables: + isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')] + isTagBranch: $[startsWith(variables['build.sourceBranch'], 'refs/tags/')] + jobs: - job: 'main_branch_build' displayName: 'Build' @@ -21,9 +25,9 @@ jobs: strategy: matrix: 'java-11': - jdk_version: '11' + JDK_VERSION: '11' 'java-17': - jdk_version: '17' + JDK_VERSION: '17' # Base system pool: vmImage: 'Ubuntu-22.04' @@ -33,30 +37,25 @@ jobs: inputs: key: 'maven-cache | $(System.JobName) | **/pom.xml' restoreKeys: | - maven-cache | $(System.JobName) - maven-cache + maven-cache | $(System.JobName) + maven-cache path: $(HOME)/.m2/repository displayName: Maven cache - template: 'templates/steps/setup_docker.yaml' - template: 'templates/steps/setup_java.yaml' parameters: - JDK_VERSION: $(jdk_version) + JDK_VERSION: $(JDK_VERSION) - - bash: mvn clean verify + - bash: mvn -Dfailsafe.rerunFailingTestsCount=3 clean verify env: # Test container optimization TESTCONTAINERS_RYUK_DISABLED: TRUE TESTCONTAINERS_CHECKS_DISABLE: TRUE displayName: "Strimzi test container build & verify" - - bash: ".azure/scripts/push_to_nexus.sh" - env: - GPG_PASSPHRASE: $(GPG_PASSPHRASE) - GPG_SIGNING_KEY: $(GPG_SIGNING_KEY) - NEXUS_USERNAME: $(NEXUS_USERNAME) - NEXUS_PASSWORD: $(NEXUS_PASSWORD) - displayName: "Push artifacts to Nexus repository" - condition: and(succeeded(), or(eq(variables['build.sourceBranch'], 'refs/heads/main'), startsWith(variables['build.sourceBranch'], 'refs/tags/'))) + - template: 'templates/steps/push_artifacts.yaml' + parameters: + JDK_VERSION: variables.JDK_VERSION - task: PublishTestResults@2 inputs: diff --git a/.azure/templates/steps/push_artifacts.yaml b/.azure/templates/steps/push_artifacts.yaml new file mode 100644 index 0000000..8d7d891 --- /dev/null +++ b/.azure/templates/steps/push_artifacts.yaml @@ -0,0 +1,13 @@ +parameters: + - name: JDK_VERSION + type: string + default: '17' +steps: + - bash: ".azure/scripts/push_to_nexus.sh" + env: + GPG_PASSPHRASE: $(GPG_PASSPHRASE) + GPG_SIGNING_KEY: $(GPG_SIGNING_KEY) + NEXUS_USERNAME: $(NEXUS_USERNAME) + NEXUS_PASSWORD: $(NEXUS_PASSWORD) + displayName: "Push artifacts to Nexus repository" + condition: and(succeeded(), or(eq(variables.isMain, true), eq(variables.isTagBranch, true)), eq(${{ parameters.JDK_VERSION }}, '17')) \ No newline at end of file diff --git a/pom.xml b/pom.xml index 93fb23d..f61da62 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ 3.0.1 3.1.1 1.6 - 1.6.3 + 1.6.13 1.21