From 26c8aecff701f1c07158726b8b3a6714f4f0426f Mon Sep 17 00:00:00 2001 From: Jiri Pechanec Date: Fri, 2 Oct 2020 11:29:56 +0200 Subject: [PATCH] DBZ-2618 Deploy snapshots for Vitess connector --- jenkins-jobs/deploy-snapshots.yml | 10 ++--- jenkins-jobs/scripts/deploy-snapshots.groovy | 41 +++++++++++--------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/jenkins-jobs/deploy-snapshots.yml b/jenkins-jobs/deploy-snapshots.yml index 891cef848..1c8344c45 100644 --- a/jenkins-jobs/deploy-snapshots.yml +++ b/jenkins-jobs/deploy-snapshots.yml @@ -21,13 +21,9 @@ description: "A branch from which Debezium is built" default: "master" - string: - name: DEBEZIUM_INCUBATOR_REPOSITORY - description: "Repository from which Debezium incubating components are built" - default: "github.com/debezium/debezium-incubator.git" - - string: - name: DEBEZIUM_INCUBATOR_BRANCH - description: "A branch from which Debezium incubating components are built" - default: "master" + name: DEBEZIUM_ADDITIONAL_REPOSITORIES + description: "A space separated list of additional repositories from which Debezium incubating components are built (id#repo#branch)" + default: "incubator#github.com/debezium/debezium-incubator.git#master vitess#github.com/debezium/debezium-connector-vitess#master" dsl: !include-raw: - "scripts/deploy-snapshots.groovy" diff --git a/jenkins-jobs/scripts/deploy-snapshots.groovy b/jenkins-jobs/scripts/deploy-snapshots.groovy index ba68191b3..2f04f9680 100644 --- a/jenkins-jobs/scripts/deploy-snapshots.groovy +++ b/jenkins-jobs/scripts/deploy-snapshots.groovy @@ -4,8 +4,7 @@ import java.util.stream.* if ( !DEBEZIUM_REPOSITORY || !DEBEZIUM_BRANCH || - !DEBEZIUM_INCUBATOR_REPOSITORY || - !DEBEZIUM_INCUBATOR_BRANCH + !DEBEZIUM_ADDITIONAL_REPOSITORIES ) { error 'Input parameters not provided' } @@ -13,12 +12,12 @@ if ( GIT_CREDENTIALS_ID = 'debezium-github' DEBEZIUM_DIR = 'debezium' -INCUBATOR_DIR = 'debezium-incubator' HOME_DIR = '/home/cloud-user' ORACLE_ARTIFACT_DIR = "$HOME_DIR/oracle-libs/12.2.0.1.0" ORACLE_ARTIFACT_VERSION = '12.2.0.1' +def additionalDirs = [] node('Slave') { stage ('Initialize') { @@ -33,14 +32,22 @@ node('Slave') { userRemoteConfigs: [[url: "https://$DEBEZIUM_REPOSITORY", credentialsId: GIT_CREDENTIALS_ID]] ] ) - checkout([$class: 'GitSCM', - branches: [[name: "*/$DEBEZIUM_INCUBATOR_BRANCH"]], - doGenerateSubmoduleConfigurations: false, - extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: INCUBATOR_DIR]], - submoduleCfg: [], - userRemoteConfigs: [[url: "https://$DEBEZIUM_INCUBATOR_REPOSITORY", credentialsId: GIT_CREDENTIALS_ID]] - ] - ) + DEBEZIUM_ADDITIONAL_REPOSITORIES.split().each { + def (id, repository, branch) = it.split('#') + checkout([$class: 'GitSCM', + branches: [[name: "*/$branch"]], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: id]], + submoduleCfg: [], + userRemoteConfigs: [[url: "https://$repository", credentialsId: GIT_CREDENTIALS_ID]] + ] + ) + additionalDirs << id + } + dir(ORACLE_ARTIFACT_DIR) { + sh "mvn install:install-file -DgroupId=com.oracle.instantclient -DartifactId=ojdbc8 -Dversion=$ORACLE_ARTIFACT_VERSION -Dpackaging=jar -Dfile=ojdbc8.jar" + sh "mvn install:install-file -DgroupId=com.oracle.instantclient -DartifactId=xstreams -Dversion=$ORACLE_ARTIFACT_VERSION -Dpackaging=jar -Dfile=xstreams.jar" + } } stage ('Build and deploy Debezium') { @@ -49,13 +56,11 @@ node('Slave') { } } - stage ('Build and deploy Debezium Incubator') { - dir(ORACLE_ARTIFACT_DIR) { - sh "mvn install:install-file -DgroupId=com.oracle.instantclient -DartifactId=ojdbc8 -Dversion=$ORACLE_ARTIFACT_VERSION -Dpackaging=jar -Dfile=ojdbc8.jar" - sh "mvn install:install-file -DgroupId=com.oracle.instantclient -DartifactId=xstreams -Dversion=$ORACLE_ARTIFACT_VERSION -Dpackaging=jar -Dfile=xstreams.jar" - } - dir(INCUBATOR_DIR) { - sh "mvn clean deploy -U -s $HOME/.m2/settings-snapshots.xml -DdeployAtEnd=true -DskipITs -DskipTests -Passembly,oracle" + additionalDirs.each { id -> + stage ("Build and deploy Debezium ${id.capitalize()}") { + dir(id) { + sh "mvn clean deploy -U -s $HOME/.m2/settings-snapshots.xml -DdeployAtEnd=true -DskipITs -DskipTests -P${id == 'incubator' ? 'assembly,oracle' : 'assembly'}" + } } } }