-
Notifications
You must be signed in to change notification settings - Fork 9
/
Jenkinsfile.Tonka
114 lines (94 loc) · 5.11 KB
/
Jenkinsfile.Tonka
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
111
112
113
114
pipeline {
agent none
options {
buildDiscarder(logRotator(numToKeepStr: '1000', artifactNumToKeepStr: '3'))
timeout(time: 2, unit: 'HOURS')
}
stages {
stage('Build') {
agent {
node {
label 'tonka-build'
customWorkspace 'c:\\jenkins_tonka_pipeline'
}
}
steps {
checkout scm
script {
releaseId = bat(script: '@git describe --match v*', returnStdout: true).trim()
}
bat("del deploy\\META_*.exe")
bat($/cmd /c register_interpreters.cmd || git clean -xdf
"c:\Program Files\Git\Usr\bin\find.exe" -iname \*UnmanagedRegistration.cache -print -delete
/$)
bat($/Setlocal EnableDelayedExpansion
c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild make.msbuild /t:DownloadNuGetPackages && exit /b 0
c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild make_CAD.msbuild /t:All /fl /flp:diag;PerformanceSummary /m /nodeReuse:false || exit /b !ERRORLEVEL!
pushd src\CADAssembler
cmd /c ..\..\bin\Python27\Scripts\Python.exe CADCreoParametricCreateAssembly\build_nuget_package.py pack_nuget || exit /b !ERRORLEVEL!
cmd /c ..\..\bin\Python27\Scripts\Python.exe ExtractACM-XMLfromCreoModels\build_nuget_package.py pack_nuget || exit /b !ERRORLEVEL!
cmd /c ..\..\bin\Python27\Scripts\Python.exe CADCreoParametricMetaLink\build_nuget_package.py pack_nuget || exit /b !ERRORLEVEL!
popd
run_cadunittests.cmd/$)
bat($/jenkins_build.cmd/$)
bat("move /y deploy\\META_bundle_x64.exe deploy\\META_${releaseId}.exe")
bat("move /y deploy\\META_bundle_x64_offline.exe deploy\\META_${releaseId}_offline.exe")
bat($/echo TONKA_BUILD_NUMBER=%BUILD_NUMBER% > build.properties/$)
}
post {
always {
junit keepLongStdio: true, testResults: 'test/junit_results.xml'
archiveArtifacts artifacts: "deploy/META*.msi,deploy/META_x64.wixpdb,deploy/*.msp,deploy/META_${releaseId}.exe,deploy/META_${releaseId}_offline.exe"
publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'docs\\_build\\html', reportFiles: 'index.html', reportName: 'OpenMETA Documentation', reportTitles: ''])
}
}
}
stage("Deploy") {
agent {
node {
label 'tonka-build'
customWorkspace 'c:\\jenkins_tonka_pipeline'
}
}
when {
branch 'release'
}
steps {
script {
releaseId = bat(script: '@git describe --match v*', returnStdout: true).trim()
}
//Need to grab the build artifacts that we want to upload, because
//Jenkins might switch nodes on us
unarchive(mapping: ["deploy/META_${releaseId}.exe": "deploy/META_${releaseId}.exe"])
unarchive(mapping: ["deploy/META_${releaseId}_offline.exe": "deploy/META_${releaseId}_offline.exe"])
//Build our release webpage
bat("bin\\Python27\\Scripts\\Python.exe dist\\web\\generate_web.py ${releaseId}")
echo("This is our release ID: '${releaseId}'")
withCredentials([sshUserPrivateKey(credentialsId: 'fc1479fa-af84-4b86-a723-cd6ae1c9fb2c', keyFileVariable: 'SSH_KEY')]) {
bat("""rmdir /s /q openmeta-site
git clone git@bitbucket.org:metamorphsoftwareinc/openmeta-site.git""")
dir("openmeta-site") {
bat("""copy "..\\${releaseId}.html" ".\\_releases\\" """)
bat("""git add ".\\_releases\\${releaseId}.html" """)
bat("""git commit -m "Add release page for ${releaseId}" """)
bat("""git push origin master""")
}
}
withAWS(credentials:'AWS-jenkins-tonka-release-uploader', region:'us-east-2') {
s3Upload(file: "deploy/META_${releaseId}.exe", bucket: 'releases.metamorphsoftware.com', path: "releases/${releaseId}/META_${releaseId}.exe")
s3Upload(file: "deploy/META_${releaseId}_offline.exe", bucket: 'releases.metamorphsoftware.com', path: "releases/${releaseId}/META_${releaseId}_offline.exe")
}
//Build our updated docs
dir('docs') {
bat('preparepublish.bat')
}
withAWS(credentials:'AWS-jenkins-tonka-release-uploader', region:'us-east-1') {
//aws s3 sync publish_html/ s3://docs.metamorphsoftware.com/doc/ --delete
s3Delete(bucket: 'docs.metamorphsoftware.com', path: 'doc/')
s3Upload(file: 'docs/publish_html', bucket: 'docs.metamorphsoftware.com', path: 'doc/', cacheControl:'public,max-age=3600')
}
}
}
}
}
// set GIT_ALTERNATE_OBJECT_DIRECTORIES=c:\meta-core\.git\objects