Skip to content

Commit 33a2493

Browse files
authored
Add publishing of the API artifact to Maven repositories (#77)
Signed-off-by: Jakub Scholz <[email protected]>
1 parent a6b3402 commit 33a2493

File tree

8 files changed

+146
-7
lines changed

8 files changed

+146
-7
lines changed

.azure/build-pipeline.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,17 @@ stages:
5959
artifactRunVersion: ''
6060
artifactRunId: ''
6161
architectures: ['amd64', 'arm64', 's390x', 'ppc64le']
62+
- stage: java_deploy
63+
displayName: Deploy Java
64+
dependsOn:
65+
- run_systemtests
66+
condition: and(succeeded(), or(eq(variables['build.sourceBranch'], 'refs/heads/main'), startsWith(variables['build.sourceBranch'], 'refs/heads/release-')))
67+
jobs:
68+
- template: 'templates/jobs/deploy_java.yaml'
69+
parameters:
70+
dockerTag: 'latest'
71+
artifactSource: 'current'
72+
artifactProject: 'strimzi'
73+
artifactPipeline: ''
74+
artifactRunVersion: ''
75+
artifactRunId: ''

.azure/scripts/push-to-nexus.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
echo "Build reason: ${BUILD_REASON}"
6+
echo "Source branch: ${BRANCH}"
7+
8+
function cleanup() {
9+
rm -rf signing.gpg
10+
gpg --delete-keys
11+
gpg --delete-secret-keys
12+
}
13+
14+
# Run the cleanup on failure / exit
15+
trap cleanup EXIT
16+
17+
export GPG_TTY=$(tty)
18+
echo $GPG_SIGNING_KEY | base64 -d > signing.gpg
19+
gpg --batch --import signing.gpg
20+
21+
GPG_EXECUTABLE=gpg mvn $MVN_ARGS -DskipTests -s ./.azure/scripts/settings.xml -pl ./,api -P ossrh deploy
22+
23+
cleanup

.azure/scripts/settings.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
2+
<servers>
3+
<server>
4+
<id>ossrh</id>
5+
<username>${env.NEXUS_USERNAME}</username>
6+
<password>${env.NEXUS_PASSWORD}</password>
7+
</server>
8+
</servers>
9+
</settings>
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
jobs:
2+
- job: 'deploy_java'
3+
displayName: 'Deploy Java'
4+
# Set timeout for jobs
5+
timeoutInMinutes: 60
6+
# Strategy for the job
7+
strategy:
8+
matrix:
9+
'java-17':
10+
image: 'Ubuntu-22.04'
11+
jdk_version: '17'
12+
# Base system
13+
pool:
14+
vmImage: $(image)
15+
# Pipeline steps
16+
steps:
17+
- template: "../steps/maven_cache.yaml"
18+
- template: '../steps/prerequisites/install_java.yaml'
19+
parameters:
20+
JDK_VERSION: $(jdk_version)
21+
- task: DownloadPipelineArtifact@2
22+
inputs:
23+
source: '${{ parameters.artifactSource }}'
24+
artifact: Binary
25+
path: $(System.DefaultWorkingDirectory)/
26+
project: '${{ parameters.artifactProject }}'
27+
pipeline: '${{ parameters.artifactPipeline }}'
28+
runVersion: '${{ parameters.artifactRunVersion }}'
29+
runId: '${{ parameters.artifactRunId }}'
30+
- bash: tar -xvf target.tar
31+
displayName: "Untar the target directory"
32+
- bash: "./.azure/scripts/push-to-nexus.sh"
33+
env:
34+
MVN_ARGS: "-e -V -B"
35+
BUILD_REASON: $(Build.Reason)
36+
BRANCH: $(Build.SourceBranch)
37+
GPG_PASSPHRASE: $(GPG_PASSPHRASE)
38+
GPG_SIGNING_KEY: $(GPG_SIGNING_KEY)
39+
NEXUS_USERNAME: $(NEXUS_USERNAME)
40+
NEXUS_PASSWORD: $(NEXUS_PASSWORD)
41+
displayName: "Deploy Java artifacts"

api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<parent>
8-
<groupId>io.strimzi.kafka.access</groupId>
8+
<groupId>io.strimzi.access-operator</groupId>
99
<artifactId>kafka-access-operator</artifactId>
1010
<version>0.2.0-SNAPSHOT</version>
1111
</parent>

operator/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66
<parent>
7-
<groupId>io.strimzi.kafka.access</groupId>
7+
<groupId>io.strimzi.access-operator</groupId>
88
<artifactId>kafka-access-operator</artifactId>
99
<version>0.2.0-SNAPSHOT</version>
1010
</parent>
@@ -107,7 +107,7 @@
107107
<scope>test</scope>
108108
</dependency>
109109
<dependency>
110-
<groupId>io.strimzi.kafka.access</groupId>
110+
<groupId>io.strimzi.access-operator</groupId>
111111
<artifactId>api</artifactId>
112112
</dependency>
113113
</dependencies>

pom.xml

+54-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>io.strimzi.kafka.access</groupId>
7+
<groupId>io.strimzi.access-operator</groupId>
88
<artifactId>kafka-access-operator</artifactId>
99
<version>0.2.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
@@ -118,6 +118,8 @@
118118
<maven.shade.version>3.1.0</maven.shade.version>
119119
<maven.dependency.version>3.3.0</maven.dependency.version>
120120
<maven.assembly.version>3.3.0</maven.assembly.version>
121+
<maven.gpg.version>3.0.1</maven.gpg.version>
122+
<sonatype.nexus.staging>1.7.0</sonatype.nexus.staging>
121123

122124
<!-- Runtime dependencies -->
123125
<javaoperatorsdk.version>4.4.2</javaoperatorsdk.version>
@@ -283,7 +285,7 @@
283285
<scope>test</scope>
284286
</dependency>
285287
<dependency>
286-
<groupId>io.strimzi.kafka.access</groupId>
288+
<groupId>io.strimzi.access-operator</groupId>
287289
<artifactId>api</artifactId>
288290
<version>${project.version}</version>
289291
</dependency>
@@ -434,4 +436,54 @@
434436
</plugins>
435437
</build>
436438

439+
<profiles>
440+
<profile>
441+
<id>ossrh</id>
442+
<activation>
443+
<activeByDefault>false</activeByDefault>
444+
</activation>
445+
<properties>
446+
<!--suppress UnresolvedMavenProperty -->
447+
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
448+
<!--suppress UnresolvedMavenProperty -->
449+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
450+
</properties>
451+
<build>
452+
<plugins>
453+
<plugin>
454+
<groupId>org.apache.maven.plugins</groupId>
455+
<artifactId>maven-gpg-plugin</artifactId>
456+
<version>${maven.gpg.version}</version>
457+
<executions>
458+
<execution>
459+
<id>sign-artifacts</id>
460+
<phase>verify</phase>
461+
<goals>
462+
<goal>sign</goal>
463+
</goals>
464+
<configuration>
465+
<gpgArguments>
466+
<arg>--batch</arg>
467+
<arg>--pinentry-mode</arg>
468+
<arg>loopback</arg>
469+
</gpgArguments>
470+
</configuration>
471+
</execution>
472+
</executions>
473+
</plugin>
474+
<plugin>
475+
<groupId>org.sonatype.plugins</groupId>
476+
<artifactId>nexus-staging-maven-plugin</artifactId>
477+
<version>${sonatype.nexus.staging}</version>
478+
<extensions>true</extensions>
479+
<configuration>
480+
<serverId>ossrh</serverId>
481+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
482+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
483+
</configuration>
484+
</plugin>
485+
</plugins>
486+
</build>
487+
</profile>
488+
</profiles>
437489
</project>

systemtest/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66
<parent>
7-
<groupId>io.strimzi.kafka.access</groupId>
7+
<groupId>io.strimzi.access-operator</groupId>
88
<artifactId>kafka-access-operator</artifactId>
99
<version>0.2.0-SNAPSHOT</version>
1010
</parent>
@@ -61,7 +61,7 @@
6161
<scope>test</scope>
6262
</dependency>
6363
<dependency>
64-
<groupId>io.strimzi.kafka.access</groupId>
64+
<groupId>io.strimzi.access-operator</groupId>
6565
<artifactId>api</artifactId>
6666
</dependency>
6767
<dependency>

0 commit comments

Comments
 (0)