forked from galasa-dev-archives/build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile_Snapshot
89 lines (79 loc) · 4.68 KB
/
Jenkinsfile_Snapshot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
pipeline {
// Initially run on any agent
agent any
environment {
//Configure Maven from the maven tooling in Jenkins
def mvnHome = tool 'Default'
PATH = "${mvnHome}/bin:${env.PATH}"
//Set some defaults
def workspace = pwd()
}
stages {
// Set up the workspace, clear the git directories and setup the manve settings.xml files
stage('prep-workspace') {
steps {
configFileProvider([configFile(fileId: '86dde059-684b-4300-b595-64e83c2dd217', targetLocation: 'settings.xml')]) {
}
dir('repository/dev.galasa') {
deleteDir()
}
dir('repository/dev/galasa') {
deleteDir()
}
}
}
// Snap the docker images
stage('snap-docker') {
steps {
withFolderProperties {
sh "docker pull ${env.DOCKER_REPO}/galasa-boot-embedded-amd64:${env.DOCKER_SOURCE_VERSION}"
sh "docker pull ${env.DOCKER_REPO}/galasa-ibm-boot-embedded-amd64:${env.DOCKER_SOURCE_VERSION}"
sh "docker pull ${env.DOCKER_REPO}/galasa-resources-amd64:${env.DOCKER_SOURCE_VERSION}"
sh "docker pull ${env.DOCKER_REPO}/galasa-p2-amd64:${env.DOCKER_SOURCE_VERSION}"
sh "docker pull ${env.DOCKER_REPO}/galasa-javadoc-amd64:${env.DOCKER_SOURCE_VERSION}"
sh "docker pull ${env.DOCKER_REPO}/galasa-webui-amd64:${env.DOCKER_SOURCE_VERSION}"
sh "docker pull ${env.DOCKER_REPO}/galasa-githashes:${env.DOCKER_SOURCE_VERSION}"
sh "docker tag ${env.DOCKER_REPO}/galasa-boot-embedded-amd64:${env.DOCKER_SOURCE_VERSION} ${env.DOCKER_REPO}/galasa-boot-embedded-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker tag ${env.DOCKER_REPO}/galasa-ibm-boot-embedded-amd64:${env.DOCKER_SOURCE_VERSION} ${env.DOCKER_REPO}/galasa-ibm-boot-embedded-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker tag ${env.DOCKER_REPO}/galasa-resources-amd64:${env.DOCKER_SOURCE_VERSION} ${env.DOCKER_REPO}/galasa-resources-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker tag ${env.DOCKER_REPO}/galasa-p2-amd64:${env.DOCKER_SOURCE_VERSION} ${env.DOCKER_REPO}/galasa-p2-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker tag ${env.DOCKER_REPO}/galasa-javadoc-amd64:${env.DOCKER_SOURCE_VERSION} ${env.DOCKER_REPO}/galasa-javadoc-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker tag ${env.DOCKER_REPO}/galasa-webui-amd64:${env.DOCKER_SOURCE_VERSION} ${env.DOCKER_REPO}/galasa-webui-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker tag ${env.DOCKER_REPO}/galasa-githashes:${env.DOCKER_SOURCE_VERSION} ${env.DOCKER_REPO}/galasa-githashes:${env.DOCKER_TARGET_VERSION}"
sh "docker push ${env.DOCKER_REPO}/galasa-boot-embedded-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker push ${env.DOCKER_REPO}/galasa-ibm-boot-embedded-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker push ${env.DOCKER_REPO}/galasa-resources-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker push ${env.DOCKER_REPO}/galasa-p2-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker push ${env.DOCKER_REPO}/galasa-javadoc-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker push ${env.DOCKER_REPO}/galasa-webui-amd64:${env.DOCKER_TARGET_VERSION}"
sh "docker push ${env.DOCKER_REPO}/galasa-githashes:${env.DOCKER_TARGET_VERSION}"
}
}
}
// Clean the target
stage('clean-repository') {
when {
environment name: 'GIT_BRANCH', value: 'origin/master'
}
steps {
withFolderProperties {
sh "mvn --settings ${workspace}/settings.xml -Dmaven.repo.local=${workspace}/repository -B -e -P ${env.MAVEN_PROFILE} dev.galasa:galasastaging-maven-plugin:cleannexusrepo -Dgalasa.source.repo.nexus=${env.NEXUS_SERVER}/service/rest -Dgalasa.source.repo.id=galasa.snapshot.repo -Dgalasa.source.repo.name=${env.MAVEN_REPO}"
}
}
}
// Deploy the maven artifacts
stage('deploy-repository') {
steps {
dir('integrationTesting/staging') {
withFolderProperties {
sh "mvn --settings ${workspace}/settings.xml -Dmaven.repo.local=${workspace}/repository -B -e -P ${env.MAVEN_PROFILE} clean dev.galasa:galasastaging-maven-plugin:deployartifacts -Dgalasa.target.repo=${env.NEXUS_SERVER}/repository/${env.MAVEN_REPO} -Dgalasa.target.repo.id=galasa.snapshot.repo -Dgalasa.settings.file=${workspace}/settings.xml"
dir('target') {
sh "chmod +x deploy.sh"
sh "./deploy.sh"
}
}
}
}
}
}
}