Skip to content

Add publishing of the API artifact to Maven repositories #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .azure/build-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,17 @@ stages:
artifactRunVersion: ''
artifactRunId: ''
architectures: ['amd64', 'arm64', 's390x', 'ppc64le']
- stage: java_deploy
displayName: Deploy Java
dependsOn:
- run_systemtests
condition: and(succeeded(), or(eq(variables['build.sourceBranch'], 'refs/heads/main'), startsWith(variables['build.sourceBranch'], 'refs/heads/release-')))
jobs:
- template: 'templates/jobs/deploy_java.yaml'
parameters:
dockerTag: 'latest'
artifactSource: 'current'
artifactProject: 'strimzi'
artifactPipeline: ''
artifactRunVersion: ''
artifactRunId: ''
23 changes: 23 additions & 0 deletions .azure/scripts/push-to-nexus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -e

echo "Build reason: ${BUILD_REASON}"
echo "Source branch: ${BRANCH}"

function cleanup() {
rm -rf signing.gpg
gpg --delete-keys
gpg --delete-secret-keys
}

# Run the cleanup on failure / exit
trap cleanup EXIT

export GPG_TTY=$(tty)
echo $GPG_SIGNING_KEY | base64 -d > signing.gpg
gpg --batch --import signing.gpg

GPG_EXECUTABLE=gpg mvn $MVN_ARGS -DskipTests -s ./.azure/scripts/settings.xml -pl ./,api -P ossrh deploy

cleanup
9 changes: 9 additions & 0 deletions .azure/scripts/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<servers>
<server>
<id>ossrh</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
</servers>
</settings>
41 changes: 41 additions & 0 deletions .azure/templates/jobs/deploy_java.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
jobs:
- job: 'deploy_java'
displayName: 'Deploy Java'
# Set timeout for jobs
timeoutInMinutes: 60
# Strategy for the job
strategy:
matrix:
'java-17':
image: 'Ubuntu-22.04'
jdk_version: '17'
# Base system
pool:
vmImage: $(image)
# Pipeline steps
steps:
- template: "../steps/maven_cache.yaml"
- template: '../steps/prerequisites/install_java.yaml'
parameters:
JDK_VERSION: $(jdk_version)
- task: DownloadPipelineArtifact@2
inputs:
source: '${{ parameters.artifactSource }}'
artifact: Binary
path: $(System.DefaultWorkingDirectory)/
project: '${{ parameters.artifactProject }}'
pipeline: '${{ parameters.artifactPipeline }}'
runVersion: '${{ parameters.artifactRunVersion }}'
runId: '${{ parameters.artifactRunId }}'
- bash: tar -xvf target.tar
displayName: "Untar the target directory"
- bash: "./.azure/scripts/push-to-nexus.sh"
env:
MVN_ARGS: "-e -V -B"
BUILD_REASON: $(Build.Reason)
BRANCH: $(Build.SourceBranch)
GPG_PASSPHRASE: $(GPG_PASSPHRASE)
GPG_SIGNING_KEY: $(GPG_SIGNING_KEY)
NEXUS_USERNAME: $(NEXUS_USERNAME)
NEXUS_PASSWORD: $(NEXUS_PASSWORD)
displayName: "Deploy Java artifacts"
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.strimzi.kafka.access</groupId>
<groupId>io.strimzi.access-operator</groupId>
<artifactId>kafka-access-operator</artifactId>
<version>0.2.0-SNAPSHOT</version>
</parent>
Expand Down
4 changes: 2 additions & 2 deletions operator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.strimzi.kafka.access</groupId>
<groupId>io.strimzi.access-operator</groupId>
<artifactId>kafka-access-operator</artifactId>
<version>0.2.0-SNAPSHOT</version>
</parent>
Expand Down Expand Up @@ -107,7 +107,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.strimzi.kafka.access</groupId>
<groupId>io.strimzi.access-operator</groupId>
<artifactId>api</artifactId>
</dependency>
</dependencies>
Expand Down
56 changes: 54 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.strimzi.kafka.access</groupId>
<groupId>io.strimzi.access-operator</groupId>
<artifactId>kafka-access-operator</artifactId>
<version>0.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
Expand Down Expand Up @@ -118,6 +118,8 @@
<maven.shade.version>3.1.0</maven.shade.version>
<maven.dependency.version>3.3.0</maven.dependency.version>
<maven.assembly.version>3.3.0</maven.assembly.version>
<maven.gpg.version>3.0.1</maven.gpg.version>
<sonatype.nexus.staging>1.7.0</sonatype.nexus.staging>

<!-- Runtime dependencies -->
<javaoperatorsdk.version>4.4.2</javaoperatorsdk.version>
Expand Down Expand Up @@ -283,7 +285,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.strimzi.kafka.access</groupId>
<groupId>io.strimzi.access-operator</groupId>
<artifactId>api</artifactId>
<version>${project.version}</version>
</dependency>
Expand Down Expand Up @@ -434,4 +436,54 @@
</plugins>
</build>

<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<!--suppress UnresolvedMavenProperty -->
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
<!--suppress UnresolvedMavenProperty -->
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven.gpg.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--batch</arg>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${sonatype.nexus.staging}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
4 changes: 2 additions & 2 deletions systemtest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.strimzi.kafka.access</groupId>
<groupId>io.strimzi.access-operator</groupId>
<artifactId>kafka-access-operator</artifactId>
<version>0.2.0-SNAPSHOT</version>
</parent>
Expand Down Expand Up @@ -61,7 +61,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.strimzi.kafka.access</groupId>
<groupId>io.strimzi.access-operator</groupId>
<artifactId>api</artifactId>
</dependency>
<dependency>
Expand Down
Loading