DATACMNS-1536 - Introduce Jenkins.
This commit is contained in:
82
Jenkinsfile
vendored
82
Jenkinsfile
vendored
@@ -1,14 +1,80 @@
|
||||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image 'maven:3.3.3'
|
||||
}
|
||||
}
|
||||
agent none
|
||||
|
||||
triggers {
|
||||
pollSCM 'H/10 * * * *'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('build') {
|
||||
stage("Test") {
|
||||
parallel {
|
||||
stage("test: baseline") {
|
||||
agent {
|
||||
docker {
|
||||
image 'adoptopenjdk/openjdk8:latest'
|
||||
args '-v $HOME/.m2:/root/.m2'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh "PROFILE=none ci/test.sh"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Release to artifactory') {
|
||||
when {
|
||||
branch 'issue/*'
|
||||
}
|
||||
agent {
|
||||
docker {
|
||||
image 'adoptopenjdk/openjdk8:latest'
|
||||
args '-v $HOME/.m2:/root/.m2'
|
||||
}
|
||||
}
|
||||
|
||||
environment {
|
||||
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
|
||||
}
|
||||
|
||||
steps {
|
||||
sh 'mvn clean dependency:list test -Dsort -U'
|
||||
sh "USERNAME=${ARTIFACTORY_USR} PASSWORD=${ARTIFACTORY_PSW} DOC_USERNAME=${DOC_USR} DOC_PASSWORD=${DOC_PSW} PROFILE=ci,snapshot ci/build.sh"
|
||||
}
|
||||
}
|
||||
stage('Release to artifactory with docs') {
|
||||
when {
|
||||
branch 'test'
|
||||
}
|
||||
agent {
|
||||
docker {
|
||||
image 'adoptopenjdk/openjdk8:latest'
|
||||
args '-v $HOME/.m2:/root/.m2'
|
||||
}
|
||||
}
|
||||
|
||||
environment {
|
||||
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
|
||||
DOC = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
|
||||
}
|
||||
|
||||
steps {
|
||||
sh "USERNAME=${ARTIFACTORY_USR} PASSWORD=${ARTIFACTORY_PSW} DOC_USERNAME=${DOC_USR} DOC_PASSWORD=${DOC_PSW} PROFILE=ci,snapshot ci/build.sh"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
changed {
|
||||
script {
|
||||
slackSend(
|
||||
color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger',
|
||||
channel: '#spring-data-dev',
|
||||
message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}")
|
||||
emailext(
|
||||
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
|
||||
mimeType: 'text/html',
|
||||
recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']],
|
||||
body: "<a href=\"${env.BUILD_URL}\">${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}</a>")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
ci/build.sh
11
ci/build.sh
@@ -2,13 +2,4 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2
|
||||
|
||||
spring_data_commons_artifactory=$(pwd)/spring-data-commons-artifactory
|
||||
|
||||
rm -rf $HOME/.m2/repository/org/springframework/data/commons 2> /dev/null || :
|
||||
|
||||
cd spring-data-commons-github
|
||||
|
||||
./mvnw -Dmaven.test.skip=true clean deploy \
|
||||
-DaltDeploymentRepository=distribution::default::file://${spring_data_commons_artifactory}
|
||||
./mvnw -P${PROFILE} -Dmaven.test.skip=true clean deploy -B
|
||||
|
||||
20
ci/build.yml
20
ci/build.yml
@@ -1,20 +0,0 @@
|
||||
---
|
||||
platform: linux
|
||||
|
||||
image_resource:
|
||||
type: docker-image
|
||||
source:
|
||||
repository: openjdk
|
||||
tag: 8-jdk
|
||||
|
||||
inputs:
|
||||
- name: spring-data-commons-github
|
||||
|
||||
outputs:
|
||||
- name: spring-data-commons-artifactory
|
||||
|
||||
caches:
|
||||
- path: maven
|
||||
|
||||
run:
|
||||
path: spring-data-commons-github/ci/build.sh
|
||||
@@ -2,10 +2,4 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2
|
||||
|
||||
rm -rf $HOME/.m2/repository/org/springframework/data/commons 2> /dev/null || :
|
||||
|
||||
cd spring-data-commons-github
|
||||
|
||||
./mvnw clean dependency:list test -P${PROFILE} -Dsort
|
||||
./mvnw -P${PROFILE} clean dependency:list test -Dsort -B
|
||||
|
||||
17
ci/test.yml
17
ci/test.yml
@@ -1,17 +0,0 @@
|
||||
---
|
||||
platform: linux
|
||||
|
||||
image_resource:
|
||||
type: docker-image
|
||||
source:
|
||||
repository: openjdk
|
||||
tag: 8-jdk
|
||||
|
||||
inputs:
|
||||
- name: spring-data-commons-github
|
||||
|
||||
caches:
|
||||
- path: maven
|
||||
|
||||
run:
|
||||
path: spring-data-commons-github/ci/test.sh
|
||||
14
doc-settings.xml
Normal file
14
doc-settings.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
|
||||
https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
|
||||
<servers>
|
||||
<server>
|
||||
<id>static-dot-s2</id>
|
||||
<username>${env.DOC_USERNAME}</username>
|
||||
<password>${env.DOC_PASSWORD}</password>
|
||||
</server>
|
||||
</servers>
|
||||
|
||||
</settings>
|
||||
41
pom.xml
41
pom.xml
@@ -363,6 +363,47 @@
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>snapshot</id>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jfrog.buildinfo</groupId>
|
||||
<artifactId>artifactory-maven-plugin</artifactId>
|
||||
<version>2.6.1</version>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-info</id>
|
||||
<goals>
|
||||
<goal>publish</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<buildInfo>
|
||||
<buildUrl>{{BUILD_URL}}</buildUrl>
|
||||
</buildInfo>
|
||||
<deployProperties>
|
||||
<zip.name>spring-data-commons</zip.name>
|
||||
<zip.displayname>spring-data-commons</zip.displayname>
|
||||
<zip.deployed>false</zip.deployed>
|
||||
<archives>*:*:*:*@zip</archives>
|
||||
</deployProperties>
|
||||
<publisher>
|
||||
<contextUrl>https://repo.spring.io</contextUrl>
|
||||
<username>{{USERNAME}}</username>
|
||||
<password>{{PASSWORD}}</password>
|
||||
<repoKey>libs-snapshot-local</repoKey>
|
||||
<snapshotRepoKey>libs-snapshot-local</snapshotRepoKey>
|
||||
</publisher>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
|
||||
Reference in New Issue
Block a user