Skip to content

Commit

Permalink
Make maven sonatype plugin work also with Java 17, and publish for 17…
Browse files Browse the repository at this point in the history
… only (#58)

* Make maven sonatype plugin work also with Java 17

Signed-off-by: see-quick <[email protected]>

* remove flakiness of test cases

Signed-off-by: see-quick <[email protected]>

* add conditional to push only in Java 17

Signed-off-by: see-quick <[email protected]>

---------

Signed-off-by: see-quick <[email protected]>
  • Loading branch information
see-quick committed Jun 28, 2023
1 parent 53b2903 commit ba1d6d1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
27 changes: 13 additions & 14 deletions .azure/build-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions .azure/templates/steps/push_artifacts.yaml
Original file line number Diff line number Diff line change
@@ -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'))
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<maven.source-plugin.version>3.0.1</maven.source-plugin.version>
<maven.checkstyle.version>3.1.1</maven.checkstyle.version>
<maven.gpg.version>1.6</maven.gpg.version>
<sonatype.nexus.staging>1.6.3</sonatype.nexus.staging>
<sonatype.nexus.staging>1.6.13</sonatype.nexus.staging>

<!-- FIX VULNERABILITY VERSIONS -->
<commons-compress.version>1.21</commons-compress.version>
Expand Down

0 comments on commit ba1d6d1

Please sign in to comment.