This repository has been archived by the owner on May 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathJenkinsfile_cc
110 lines (101 loc) · 3.44 KB
/
Jenkinsfile_cc
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
pipeline {
// Initially run on any agent
agent {
label 'docker-amd64'
}
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')]) {
}
configFileProvider([configFile(fileId: '647688a9-d178-475b-ae65-80fca764a8c2', targetLocation: 'cit-settings.xml')]) {
}
dir('repository/dev.galasa') {
deleteDir()
}
dir('repository/dev/galasa') {
deleteDir()
}
dir('repository/codecoverage') {
deleteDir()
}
}
}
// clone the git repos for templating
stage('clone-repos') {
steps {
dir('codecoverage/framework') {
git branch: 'main',
url: 'https://github.com/galasa-dev/framework.git'
}
dir('codecoverage/extensions') {
git branch: 'main',
url: 'https://github.com/galasa-dev/extensions.git'
}
dir('codecoverage/managers') {
git branch: 'main',
url: 'https://github.com/galasa-dev/managers.git'
}
dir('codecoverage/obr') {
git branch: 'main',
url: 'https://github.com/galasa-dev/obr.git'
}
}
}
// Build the runtime repository
stage('fetch-maven') {
steps {
withFolderProperties {
dir('codecoverage') {
sh "galasabld template --codecoverage --template pomfetch.template --output pomfetch.xml -r obr/release.yaml -r framework/release.yaml -r extensions/release.yaml -r managers/release.yaml"
sh "mvn --settings ${workspace}/settings.xml -Dmaven.repo.local=${workspace}/repository -P ${MAVEN_PROFILE} -B -e -f pomfetch.xml clean process-sources"
}
}
}
}
stage('fetch-files') {
steps {
withFolderProperties {
dir('codecoverage') {
sh "sh fetch.sh"
}
}
}
}
stage('build-reports') {
steps {
withFolderProperties {
dir('codecoverage') {
sh "sh buildunit.sh"
sh "sh buildint.sh"
sh "sh buildcombined.sh"
}
}
}
}
stage('docker') {
steps {
withFolderProperties {
dir('codecoverage') {
sh "docker build --build-arg dockerRepository=${env.DOCKER_REPO} -t ${env.DOCKER_REPO}/galasa-code-coverage:${env.DOCKER_VERSION} ."
sh "docker push ${env.DOCKER_REPO}/galasa-code-coverage:${env.DOCKER_VERSION}"
}
}
}
}
}
post {
// triggered when red sign
failure {
slackSend (channel: '#galasa-devs', color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}