diff --git a/Jenkinsfile b/Jenkinsfile index 3ff16f59ff..7a74923645 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent { dockerfile { - dir 'conf/docker/jenkins-build-image' + dir 'conf/docker/jenkins-build-dockercli-image' additionalBuildArgs '-t drodb-jenkins-build' } } @@ -12,6 +12,7 @@ pipeline { booleanParam(name: 'skipUnitTests', defaultValue: true, description: 'Set to true to skip the unit tests') booleanParam(name: 'skipIntegrationTests', defaultValue: true, description: 'Set to true to skip the integration tests') booleanParam(name: 'deployOverride', defaultValue: false, description: 'Set to true to perform the deployment') + choice(name: 'doRelease', choices: ['skip', 'patch', 'minor', 'major'], description: 'Perform a release of new version') } triggers { @@ -25,7 +26,9 @@ pipeline { } environment { - ARTIFACTORY_DEPLOY=credentials('ICM_ARTIFACTORY_JENKINSCI') + /*ARTIFACTORY_DEPLOY=credentials('ICM_ARTIFACTORY_JENKINSCI')*/ + ARTIFACTORY_DEPLOY=credentials('ICM_ARTIFACTORY_USER') + GITHUB_DEPLOY=credentials('DATAVERSE_GORGONA_GITHUB_DEPLOY_KEY') DOCKER_HOST_EXT = sh(script: 'docker context ls --format "{{- if .Current -}} {{- .DockerEndpoint -}} {{- end -}}"', returnStdout: true) .trim().replaceAll('tcp', 'https') DOCKER_CERT_EXT = '/home/jenkins/.docker' @@ -36,12 +39,10 @@ pipeline { stage('Build') { when { expression { params.skipBuild != true } } - agent { - docker { - image 'openjdk:8u342-jdk' - reuseNode true - } - } + agent { dockerfile { + dir 'conf/docker/jenkins-build-image' + reuseNode true + } } steps { echo 'Building dataverse.' sh './mvnw package -DskipTests' @@ -56,12 +57,11 @@ pipeline { stage('Unit tests') { when { expression { params.skipUnitTests != true } } - agent { - docker { - image 'openjdk:8u342-jdk' - reuseNode true - } - } + agent { dockerfile { + dir 'conf/docker/jenkins-build-image' + reuseNode true + } } + steps { echo 'Executing unit tests.' sh './mvnw test' @@ -108,18 +108,42 @@ pipeline { expression { params.deployOverride == true } } } - agent { - docker { - image 'openjdk:8u342-jdk' - reuseNode true - } - } + agent { dockerfile { + dir 'conf/docker/jenkins-build-image' + reuseNode true + } } + steps { echo 'Deploying artifacts.' - sh 'env' - sh './mvnw -X deploy:deploy -s settings.xml' + sh './mvnw deploy -Pdeploy -s settings.xml' + } + } + + stage('Release') { + when { + triggeredBy 'UserIdCause' + expression { params.doRelease != 'skip' } + } + agent { dockerfile { + dir 'conf/docker/jenkins-build-image' + reuseNode true + } } + + environment { + GIT_SSH_COMMAND = "ssh -o StrictHostKeyChecking=no" + } + steps { + script { + sshagent(['DATAVERSE_GORGONA_GITHUB_DEPLOY_KEY']) { + echo "Creating release artifacts: ${params.doRelease}" + sh 'git config user.email "jenkinsci@icm.edu.pl"' + sh 'git config user.name "jenkinsci"' + sh "./release.sh ${params.doRelease}" + } + } } } + } } diff --git a/conf/docker/jenkins-build-dockercli-image/Dockerfile b/conf/docker/jenkins-build-dockercli-image/Dockerfile new file mode 100644 index 0000000000..156e014aab --- /dev/null +++ b/conf/docker/jenkins-build-dockercli-image/Dockerfile @@ -0,0 +1,11 @@ +FROM docker:27.3.1-alpine3.20 + +RUN apk add openjdk8 + +RUN addgroup -g 1000 jenkins && \ + adduser --uid 1000 --ingroup jenkins --no-create-home --disabled-password jenkins + +RUN addgroup jenkins root +RUN addgroup jenkins docker + +ENTRYPOINT [] diff --git a/conf/docker/jenkins-build-image/Dockerfile b/conf/docker/jenkins-build-image/Dockerfile index 156e014aab..82f556e0ac 100644 --- a/conf/docker/jenkins-build-image/Dockerfile +++ b/conf/docker/jenkins-build-image/Dockerfile @@ -1,11 +1,8 @@ -FROM docker:27.3.1-alpine3.20 +FROM openjdk:8u342-jdk -RUN apk add openjdk8 - -RUN addgroup -g 1000 jenkins && \ +RUN addgroup --gid 1000 jenkins && \ adduser --uid 1000 --ingroup jenkins --no-create-home --disabled-password jenkins RUN addgroup jenkins root -RUN addgroup jenkins docker ENTRYPOINT [] diff --git a/dataverse-dist/pom.xml b/dataverse-dist/pom.xml index 73eb81eb09..c95cff8a78 100644 --- a/dataverse-dist/pom.xml +++ b/dataverse-dist/pom.xml @@ -1,13 +1,11 @@ - + 4.0.0 edu.harvard.iq dataverse-parent - 1.0.0-SNAPSHOT + 1.0.2-SNAPSHOT dataverse-dist diff --git a/dataverse-persistence/pom.xml b/dataverse-persistence/pom.xml index bc1bdd2da3..8931488009 100644 --- a/dataverse-persistence/pom.xml +++ b/dataverse-persistence/pom.xml @@ -1,12 +1,11 @@ - + 4.0.0 edu.harvard.iq dataverse-parent - 1.0.0-SNAPSHOT + 1.0.2-SNAPSHOT dataverse-persistence diff --git a/dataverse-test-common/pom.xml b/dataverse-test-common/pom.xml index 22b33e7bfb..6127061026 100644 --- a/dataverse-test-common/pom.xml +++ b/dataverse-test-common/pom.xml @@ -1,12 +1,11 @@ - + 4.0.0 edu.harvard.iq dataverse-parent - 1.0.0-SNAPSHOT + 1.0.2-SNAPSHOT dataverse-test-common diff --git a/dataverse-webapp/pom.xml b/dataverse-webapp/pom.xml index 06c5267de0..00ab2bf15b 100644 --- a/dataverse-webapp/pom.xml +++ b/dataverse-webapp/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 dataverse-webapp @@ -9,7 +8,7 @@ edu.harvard.iq dataverse-parent - 1.0.0-SNAPSHOT + 1.0.2-SNAPSHOT dataverse-webapp diff --git a/pom.xml b/pom.xml index cadfc93c16..06a1dffd45 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 edu.harvard.iq dataverse-parent - 1.0.0-SNAPSHOT + 1.0.2-SNAPSHOT pom dataverse-parent @@ -19,7 +18,7 @@ UTF-8 -Xdoclint:none - + UTC en US @@ -1018,6 +1017,13 @@ true + + deploy + + true + true + + diff --git a/release.sh b/release.sh index b6813975d8..4c2042bc1b 100755 --- a/release.sh +++ b/release.sh @@ -39,7 +39,7 @@ fi echo "Version to be released: ${RELEASE_FULL_VERSION}. Next development version will be set to: ${DEVELOPMENT_FULL_VERSION}." -./mvnw --batch-mode release:prepare release:perform \ +./mvnw --batch-mode release:prepare release:perform -s settings.xml \ -Darguments="-DskipTests -Ddocker.skip" \ -DignoreSnapshots=true -DautoVersionSubmodules=true \ -DreleaseVersion=${RELEASE_FULL_VERSION} \