Browse Source

Changing ci pipeline settings

Better isolation of workspaces and repositories
pull/46/head
Martin Stockhammer 5 years ago
parent
commit
d8b6d1ce00
2 changed files with 41 additions and 21 deletions
  1. 36
    16
      Jenkinsfile
  2. 5
    5
      Jenkinsfile-itest

+ 36
- 16
Jenkinsfile View File

@@ -33,6 +33,7 @@ buildJdk9 = 'JDK 1.9 (latest)'
buildJdk10 = 'JDK 10 (latest)'
buildMvn = 'Maven 3.5.2'
deploySettings = 'archiva-uid-jenkins'
localRepository = "../.archiva-master-repository"

INTEGRATION_PIPELINE = "Archiva-IntegrationTests-Gitbox"

@@ -40,22 +41,39 @@ pipeline {
agent {
label "${LABEL}"
}

options {
disableConcurrentBuilds()
}
parameters {
booleanParam(name: 'PRECLEANUP', defaultValue: false, description: 'Clears the local maven repository before build.')
}


stages {

stage('PreCleanup') {
when {
expression {
params.PRECLEANUP
}
}
steps {
sh "rm -rf ${localRepository}"
}
}

stage('BuildAndDeploy') {
environment {
ARCHIVA_USER_CONFIG_FILE='/tmp/archiva-master-jdk-8-${env.JOB_NAME}.xml'
ARCHIVA_USER_CONFIG_FILE = '/tmp/archiva-master-jdk-8-${env.JOB_NAME}.xml'
}

steps {
timeout(120) {
withMaven(maven: buildMvn, jdk: buildJdk,
mavenSettingsConfig: deploySettings,
mavenLocalRepo: ".repository",
mavenLocalRepo: localRepository,
options: [concordionPublisher(disabled: true), dependenciesFingerprintPublisher(disabled: true),
findbugsPublisher(disabled: true), artifactsPublisher(disabled: false),
findbugsPublisher(disabled: true), artifactsPublisher(disabled: true),
invokerPublisher(disabled: true), jgivenPublisher(disabled: true),
junitPublisher(disabled: false, ignoreAttachments: false),
openTasksPublisher(disabled: true), pipelineGraphPublisher(disabled: true)]
@@ -75,7 +93,7 @@ pipeline {
// -Dmaven.compiler.fork=true: Do compile in a separate forked process
// -Dmaven.test.failure.ignore=true: Do not stop, if some tests fail
// -Pci-build: Profile for CI-Server
sh "mvn clean deploy -B -U -e -fae -T1C -Dmaven.compiler.fork=true -Pci-build"
sh "mvn clean deploy -B -U -e -fae -Dmaven.compiler.fork=true -Pci-build"
}
}
}
@@ -86,7 +104,6 @@ pipeline {
}
success {
archiveArtifacts '**/target/*.war,**/target/*-bin.zip'
stash(name:'archiva-master-build-ws')
}
failure {
notifyBuild("Failure in BuildAndDeploy stage")
@@ -100,16 +117,16 @@ pipeline {
parallel {
stage('IntegrationTest') {
steps {
build(job: "${INTEGRATION_PIPELINE}/archiva/${env.BRANCH_NAME}", propagate: false, quietPeriod: 10)
build(job: "${INTEGRATION_PIPELINE}/archiva/${env.BRANCH_NAME}", propagate: false, quietPeriod: 5, wait: false)
}
}
stage('JDK9') {
environment {
ARCHIVA_USER_CONFIG_FILE='/tmp/archiva-master-jdk-9-${env.JOB_NAME}.xml'
ARCHIVA_USER_CONFIG_FILE = '/tmp/archiva-master-jdk-9-${env.JOB_NAME}.xml'
}
steps {
ws("${env.JOB_NAME}-JDK9") {
unstash(name:'archiva-master-build-ws')
checkout scm
timeout(120) {
withMaven(maven: buildMvn, jdk: buildJdk9,
mavenSettingsConfig: deploySettings,
@@ -121,7 +138,7 @@ pipeline {
openTasksPublisher(disabled: true), pipelineGraphPublisher(disabled: true)]
)
{
sh "mvn clean install -B -e -fae -T1C -Dmaven.compiler.fork=true -Pci-build"
sh "mvn clean install -U -B -e -fae -Dmaven.compiler.fork=true -Pci-build"
}
}
}
@@ -130,15 +147,18 @@ pipeline {
always {
sh "rm -f /tmp/archiva-master-jdk-9-${env.JOB_NAME}.xml"
}
success {
cleanWs deleteDirs: true, notFailBuild: true, patterns: [[pattern: '.repository', type: 'EXCLUDE']]
}
}
}
stage('JDK10') {
environment {
ARCHIVA_USER_CONFIG_FILE='/tmp/archiva-master-jdk-10-${env.JOB_NAME}.xml'
ARCHIVA_USER_CONFIG_FILE = '/tmp/archiva-master-jdk-10-${env.JOB_NAME}.xml'
}
steps {
ws("${env.JOB_NAME}-JDK10") {
unstash(name:'archiva-master-build-ws')
checkout scm
timeout(120) {
withMaven(maven: buildMvn, jdk: buildJdk10,
mavenSettingsConfig: deploySettings,
@@ -150,7 +170,7 @@ pipeline {
openTasksPublisher(disabled: true), pipelineGraphPublisher(disabled: true)]
)
{
sh "mvn clean install -B -e -fae -T1C -Dmaven.compiler.fork=true -Pci-build"
sh "mvn clean install -U -B -e -fae -Dmaven.compiler.fork=true -Pci-build"
}
}
}
@@ -159,6 +179,9 @@ pipeline {
always {
sh "rm -f /tmp/archiva-master-jdk-10-${env.JOB_NAME}.xml"
}
success {
cleanWs deleteDirs: true, notFailBuild: true, patterns: [[pattern: '.repository', type: 'EXCLUDE']]
}
}
}
}
@@ -178,9 +201,6 @@ pipeline {
}
}
}
always {
cleanWs()
}
}
}


+ 5
- 5
Jenkinsfile-itest View File

@@ -29,6 +29,7 @@ buildJdk = 'JDK 1.8 (latest)'
buildMvn = 'Maven 3.5.2'
deploySettings = 'archiva-uid-jenkins'
DOCKERHUB_CREDS = '10a5f89e-504b-11e8-945d-7fd7b29cc41c'
localRepository = "../.archiva-master-repository"

pipeline {
agent {
@@ -57,7 +58,7 @@ pipeline {
timeout(120) {
withMaven(maven: buildMvn, jdk: buildJdk,
mavenSettingsConfig: deploySettings,
mavenLocalRepo: ".repository",
mavenLocalRepo: localRepository,
options: [concordionPublisher(disabled: true), dependenciesFingerprintPublisher(disabled: true),
findbugsPublisher(disabled: true), artifactsPublisher(disabled: true),
invokerPublisher(disabled: true), jgivenPublisher(disabled: true),
@@ -79,8 +80,7 @@ pipeline {
// -Dmaven.compiler.fork=true: Compile in a separate forked process
// -Pci-server: Profile for CI-Server
// -Pit-js: Run the selenium test
sh "mvn clean install -B -U -Dmaven.test.skip=true -T2"
sh "mvn clean install -B -V -U -e -fae -Dmaven.compiler.fork=true -DmaxWaitTimeInMs=2000 -Pci-server -Pit-js -DtrimStackTrace=false -Djava.io.tmpdir=.tmp -pl :archiva-webapp-test"
sh "mvn clean verify -B -V -U -e -fae -Dmaven.compiler.fork=true -DmaxWaitTimeInMs=2000 -Pci-server -Pit-js -DtrimStackTrace=false -Djava.io.tmpdir=.tmp -pl :archiva-webapp-test"

}
}
@@ -104,7 +104,7 @@ pipeline {
usernameVariable: 'DOCKER_HUB_USER', passwordVariable: 'DOCKER_HUB_PW']]) {
withMaven(maven: buildMvn, jdk: buildJdk,
mavenSettingsConfig: deploySettings,
mavenLocalRepo: ".repository",
mavenLocalRepo: localRepository,
options: [concordionPublisher(disabled: true), dependenciesFingerprintPublisher(disabled: true),
findbugsPublisher(disabled: true), artifactsPublisher(disabled: true),
invokerPublisher(disabled: true), jgivenPublisher(disabled: true),
@@ -128,7 +128,7 @@ pipeline {
// -Pci-server: Profile for CI Server
// -Pit-js: Runs the Selenium tests
// -Pchrome: Activates the Selenium Chrome Test Agent
sh "mvn clean install -B -V -U -e -fae -Dmaven.compiler.fork=true -DmaxWaitTimeInMs=2000 -DseleniumRemote=true -Pci-server -Pit-js -Pchrome -pl :archiva-webapp-test -DtrimStackTrace=false"
sh "mvn verify -B -V -e -fae -Dmaven.compiler.fork=true -DmaxWaitTimeInMs=2000 -DseleniumRemote=true -Pci-server -Pit-js -Pchrome -pl :archiva-webapp-test -DtrimStackTrace=false"
}
}
}

Loading…
Cancel
Save