diff --git a/.azure/build-pipeline.yaml b/.azure/build-pipeline.yaml new file mode 100644 index 00000000..46bbb875 --- /dev/null +++ b/.azure/build-pipeline.yaml @@ -0,0 +1,29 @@ +# Triggers +trigger: + branches: + include: + - 'main' + - 'release-*' +pr: + autoCancel: true + branches: + include: + - '*' + +# Stages +stages: + - stage: java_build + displayName: Java build + jobs: + - template: 'templates/jobs/build_java.yaml' + - stage: java_deploy + displayName: Deploy Java + 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: + artifactSource: 'current' + artifactProject: 'strimzi' + artifactPipeline: '' + artifactRunVersion: '' + artifactRunId: '' diff --git a/.azure/scripts/push-to-nexus.sh b/.azure/scripts/push-to-nexus.sh new file mode 100755 index 00000000..2c6cced8 --- /dev/null +++ b/.azure/scripts/push-to-nexus.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +echo "Build reason: ${BUILD_REASON}" +echo "Source branch: ${BRANCH}" + +GPG_TTY=$(tty) +export GPG_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 '!examples/producer','!examples/consumer' -P ossrh verify deploy + +rm -rf signing.gpg +gpg --delete-keys +gpg --delete-secret-keys \ No newline at end of file diff --git a/.travis/settings.xml b/.azure/scripts/settings.xml similarity index 100% rename from .travis/settings.xml rename to .azure/scripts/settings.xml diff --git a/.azure/templates/jobs/build_java.yaml b/.azure/templates/jobs/build_java.yaml new file mode 100644 index 00000000..508647d9 --- /dev/null +++ b/.azure/templates/jobs/build_java.yaml @@ -0,0 +1,60 @@ +jobs: + - job: 'build_and_test_java' + displayName: 'Build & Test' + # Strategy for the job + strategy: + matrix: + 'java-8': + image: 'Ubuntu-22.04' + jdk_version: '8' + main_build: 'true' + 'java-11': + image: 'Ubuntu-22.04' + jdk_version: '11' + main_build: 'false' + 'java-17': + image: 'Ubuntu-22.04' + jdk_version: '17' + main_build: 'false' + # Set timeout for jobs + timeoutInMinutes: 60 + # Base system + pool: + vmImage: $(image) + # Variables + variables: + MVN_CACHE_FOLDER: $(HOME)/.m2/repository + MVN_ARGS: '-e -V -B' + # Pipeline steps + steps: + # Get cached Maven repository + - template: "../steps/maven_cache.yaml" + - template: '../steps/prerequisites/install_java.yaml' + parameters: + JDK_VERSION: $(jdk_version) + - bash: "mvn ${MVN_ARGS} install" + displayName: "Build & Test Java" + env: + BUILD_REASON: $(Build.Reason) + BRANCH: $(Build.SourceBranch) + TESTCONTAINERS_RYUK_DISABLED: "TRUE" + TESTCONTAINERS_CHECKS_DISABLE: "TRUE" + MVN_ARGS: "-e -V -B" + - bash: "mvn ${MVN_ARGS} spotbugs:check" + displayName: "Spotbugs" + env: + MVN_ARGS: "-e -V -B" + # We have to TAR the target directory to maintain the permissions of + # the files which would otherwise change when downloading the artifact + - bash: tar -cvpf target.tar ./target + displayName: "Tar the target directory" + condition: and(succeeded(), eq(variables['main_build'], 'true')) + - publish: $(System.DefaultWorkingDirectory)/target.tar + artifact: Binary + condition: and(succeeded(), eq(variables['main_build'], 'true')) + - task: PublishTestResults@2 + inputs: + testResultsFormat: JUnit + testResultsFiles: '**/TEST-*.xml' + testRunTitle: "Unit & Integration tests" + condition: always() \ No newline at end of file diff --git a/.azure/templates/jobs/deploy_java.yaml b/.azure/templates/jobs/deploy_java.yaml new file mode 100644 index 00000000..040fde26 --- /dev/null +++ b/.azure/templates/jobs/deploy_java.yaml @@ -0,0 +1,43 @@ +jobs: + - job: 'deploy_java' + displayName: 'Deploy artifacts' + # Strategy for the job => we deploy the artifacts only from Java 11 + strategy: + matrix: + 'java-8': + image: 'Ubuntu-22.04' + jdk_version: '8' + main_build: 'true' + # Set timeout for jobs + timeoutInMinutes: 60 + # Base system + pool: + vmImage: 'Ubuntu-22.04' + # Pipeline steps + steps: + # Get cached Maven repository + - 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: + 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) + MVN_ARGS: "-e -V -B" + displayName: "Deploy Java artifacts" \ No newline at end of file diff --git a/.azure/templates/steps/maven_cache.yaml b/.azure/templates/steps/maven_cache.yaml new file mode 100644 index 00000000..4dc3b774 --- /dev/null +++ b/.azure/templates/steps/maven_cache.yaml @@ -0,0 +1,9 @@ +steps: + - task: Cache@2 + inputs: + key: 'maven-cache | $(System.JobName) | **/pom.xml' + restoreKeys: | + maven-cache | $(System.JobName) + maven-cache + path: $(HOME)/.m2/repository + displayName: Maven cache diff --git a/.azure/templates/steps/prerequisites/install_java.yaml b/.azure/templates/steps/prerequisites/install_java.yaml new file mode 100644 index 00000000..fad0b09b --- /dev/null +++ b/.azure/templates/steps/prerequisites/install_java.yaml @@ -0,0 +1,11 @@ +# Step to configure JAVA on the agent +parameters: + - name: JDK_VERSION + default: '11' +steps: + - task: JavaToolInstaller@0 + inputs: + versionSpec: $(JDK_VERSION) + jdkArchitectureOption: 'x64' + jdkSourceOption: 'PreInstalled' + displayName: 'Configure Java' diff --git a/.travis.yml b/.travis.yml index a3c3b7c8..1764383a 100644 --- a/.travis.yml +++ b/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uqOloOtFQMZUVQYBTSCK87DlYKKmCOtvUxeRMsrlbQLR9g2k= # GPG_PASSPHRASE script: - "./.travis/build.sh" diff --git a/.travis/build.sh b/.travis/build.sh index 7899bffc..3fc80b21 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -99,18 +99,3 @@ if [ "$arch" != 'ppc64le' ] && [ "$arch" != 's390x' ]; then set -e fi - - -# Only continue if Java 8 and x86_64 platform -if [ "$JAVA_MAJOR_VERSION" == "1" ] && [ "$arch" == "x86_64" ]; then - - # Push only releases - if [ "$PULL_REQUEST" != "false" ] ; then - echo "Building Pull Request - nothing to push" - elif [ "$TAG" = "latest" ] && [ "$BRANCH" != "main" ]; then - echo "Not in main branch and not in release tag - nothing to push" - else - echo "Pushing JARs" - ./.travis/push-to-nexus.sh - fi -fi diff --git a/.travis/push-to-nexus.sh b/.travis/push-to-nexus.sh deleted file mode 100755 index 7be78bc3..00000000 --- a/.travis/push-to-nexus.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -export GPG_TTY=$(tty) - -openssl aes-256-cbc -K $encrypted_a40d2cfb3073_key -iv $encrypted_a40d2cfb3073_iv -in .travis/signing.gpg.enc -out signing.gpg -d -gpg --batch --import signing.gpg - -GPG_EXECUTABLE=gpg mvn -B -DskipTests -s ./.travis/settings.xml -pl '!examples/producer','!examples/consumer' -P ossrh clean verify deploy - -rm -rf signing.gpg -gpg --delete-keys -gpg --delete-secret-keys \ No newline at end of file diff --git a/.travis/signing.gpg.enc b/.travis/signing.gpg.enc deleted file mode 100644 index b44beee4..00000000 Binary files a/.travis/signing.gpg.enc and /dev/null differ