forked from MyRobotLab/ProgramAB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
69 lines (56 loc) · 2.64 KB
/
Jenkinsfile
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
/**********************************************************************************
* JenkinsFile for ProgramAB
*
* for adjusting build number for specific branch build
* Jenkins.instance.getItemByFullName("ProgramAB-multibranch/develop").updateNextBuildNumber(185)
*
* CHANGE build.properties TO BUILD AND DEPLOY A NEW BUILD
*
***********************************************************************************/
// [$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/MyRobotLab/ProgramAB/']
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '3')), [$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/MyRobotLab/ProgramAB/'], pipelineTriggers([pollSCM('* * * * *')])])
// node ('ubuntu') { // use any node
node ('master') { // use any node
def version = "1.3.${env.BUILD_NUMBER}"
def groupId = "program-ab"
def artifactId = "program-ab-data"
def serviceName = "ProgramAB"
// deployment variables
def path = groupId.replace(".","/") + "/" + artifactId.replace(".","/")
def repo = "/repo/artifactory/myrobotlab/" + path + "/"
stage('clean') {
echo 'clean the workspace'
// deleteDir()
cleanWs()
}
stage('check out') {
// checkout scm - apparently below "polls" what is the rate?
git "https://github.com/MyRobotLab/${serviceName}.git"
}
stage('build') {
sh 'echo \"' + version + '\" > resource/${serviceName}/version.txt'
}
stage('zip') {
sh "zip -r ${artifactId}-${version}.zip resource"
// archiveArtifacts artifacts: 'test.zip', fingerprint: true
}
/**
* deployment locally by installing into maven like repo with nginx serving the repo directory
*/
stage('install') {
sh "mkdir -p ${repo}${version}"
sh "cp ${artifactId}-${version}.zip ${repo}${version}"
// inmoov2-{version}.pom
def depFileName = repo + version + "/" + artifactId + "-" + version + ".pom"
echo "writing pom " + depFileName
File file = new File(depFileName)
file.write("<project>")
file.append("<modelVersion>4.0.0</modelVersion>")
file.append("<groupId>"+groupId+"</groupId>")
file.append("<artifactId>"+artifactId+"</artifactId>")
file.append("<version>"+version+"</version>")
file.append("<description>Bots main service module for ${serviceName} compatible with Nixie release of myrobotlab</description>")
file.append("<url>http://myrobotlab.org</url>")
file.append("</project>")
}
}