-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
99 lines (85 loc) · 3.24 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
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
pipeline {
agent { label 'master' }
triggers{
pollSCM('* * * * *')
}
options {
disableConcurrentBuilds()
lock resource: 'dashboard-build'
}
environment{
deployment_package_feed = credentials('Deployment_Package_Feed_Raw')
}
stages {
stage('Build'){
steps {
bat 'yarn'
bat 'yarn build'
}
}
stage('Test'){
steps {
bat 'yarn test-output'
}
post {
always{
junit 'junit.xml'
}
}
}
stage('Deploy'){
when {
branch 'master'
}
steps {
powershell '''
Add-Type -Assembly "System.IO.Compression.FileSystem";
[System.IO.Compression.ZipFile]::CreateFromDirectory("dist\\docs", "Dashboard.Docs.0.1.$env:BUILD_NUMBER.zip") ;
$wc = new-object System.Net.WebClient
$wc.UploadFile("$env:DEPLOYMENT_PACKAGE_FEED", "Dashboard.Docs.0.1.$env:BUILD_NUMBER.zip")
'''
powershell '''
Add-Type -Assembly "System.IO.Compression.FileSystem";
[System.IO.Compression.ZipFile]::CreateFromDirectory("dist", "Dashboard.0.1.$env:BUILD_NUMBER.zip") ;
$wc = new-object System.Net.WebClient
$wc.UploadFile("$env:DEPLOYMENT_PACKAGE_FEED", "Dashboard.0.1.$env:BUILD_NUMBER.zip")
'''
}
}
stage ('Deploy Pre-release'){
when {
not {
branch 'master'
}
}
steps {
powershell '''
Add-Type -Assembly "System.IO.Compression.FileSystem";
[System.IO.Compression.ZipFile]::CreateFromDirectory("dist\\docs", "Dashboard.Docs.0.1.$env:BUILD_NUMBER-$env:BRANCH_NAME.zip") ;
$wc = new-object System.Net.WebClient
$wc.UploadFile("$env:DEPLOYMENT_PACKAGE_FEED", "Dashboard.Docs.0.1.$env:BUILD_NUMBER-$env:BRANCH_NAME.zip")
'''
powershell '''
Add-Type -Assembly "System.IO.Compression.FileSystem";
[System.IO.Compression.ZipFile]::CreateFromDirectory("dist", "Dashboard.0.1.$env:BUILD_NUMBER-$env:BRANCH_NAME.zip") ;
$wc = new-object System.Net.WebClient
$wc.UploadFile("$env:DEPLOYMENT_PACKAGE_FEED", "Dashboard.0.1.$env:BUILD_NUMBER-$env:BRANCH_NAME.zip")
'''
}
}
}
post {
always {
step ([$class: 'WsCleanup'])
}
success {
slackSend color:"good", message: "Build Completed - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
unstable {
slackSend color:"warning", message: "Build Partially Completed - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
failure {
slackSend color:"danger", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
}
}