1
+ // Jenkinsfile v1.2.0
2
+
1
3
pipeline {
2
4
agent {
3
5
label ' idc-dk-i14545.microchip.com'
@@ -9,7 +11,8 @@ pipeline {
9
11
description : " Email to send build failure, fixed and successful deployment notifications." )
10
12
}
11
13
12
- environment {
14
+ environment {
15
+ GITHUB_OWNER = ' microchip-pic-avr-examples'
13
16
GITHUB_URL = ' https://github.com/microchip-pic-avr-examples/avr128db48-getting-started-with-mvio.git'
14
17
BITBUCKET_URL = ' https://bitbucket.microchip.com/scm/ebe/avr128db48-getting-started-with-mvio.git'
15
18
DEPLOY_TOOL_URL = ' https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
@@ -19,7 +22,7 @@ pipeline {
19
22
20
23
options {
21
24
timestamps()
22
- timeout(time : 20 , unit : ' MINUTES' )
25
+ timeout(time : 30 , unit : ' MINUTES' )
23
26
}
24
27
25
28
stages {
@@ -28,18 +31,29 @@ pipeline {
28
31
checkout scm
29
32
}
30
33
}
34
+
35
+ stage(' metadata' ) {
36
+ steps {
37
+ script {
38
+ execute(" pip install jsonschema" )
39
+ execute(" git clone https://bitbucket.microchip.com/scm/citd/metadata-schema.git" )
40
+ execute(" git clone https://bitbucket.microchip.com/scm/citd/tool-metadata-validator.git" )
41
+ execute(" cd tool-metadata-validator && python metadata-validator.py -data ../.main-meta/main.json -schema ../metadata-schema/main-schema.json" )
42
+ }
43
+ }
44
+ }
31
45
32
46
stage(' Build' ) {
33
47
steps {
34
48
script {
35
- execute(" git clone https://bitbucket.microchip.com/scm/~i20936 /tool-studio-c-build.git" )
49
+ execute(" git clone https://bitbucket.microchip.com/scm/citd /tool-studio-c-build.git" )
36
50
execute(" cd tool-studio-c-build && python studiobuildtool.py" )
37
51
38
52
}
39
53
}
40
54
}
41
55
42
- stage(' Deploy' ) {
56
+ stage(' GitHub- Deploy' ) {
43
57
when {
44
58
not {
45
59
changeRequest()
@@ -59,7 +73,37 @@ pipeline {
59
73
sendSuccessfulGithubDeploymentEmail()
60
74
}
61
75
}
62
- }
76
+ }
77
+
78
+ stage(' Portal-Deploy' ) {
79
+ when {
80
+ not {
81
+ changeRequest()
82
+ }
83
+ tag ' '
84
+ }
85
+ steps {
86
+ script {
87
+ def metadata = readJSON file :" .main-meta/main.json"
88
+ def version = metadata. content. version
89
+ def project = metadata. content. projectName
90
+
91
+ if (version == env. TAG_NAME ) {
92
+ def cmdArgs = " '{\" repoOwnerName\" :\" $env . GITHUB_OWNER \" ,\" repoName\" :\" $project \" ,\" tagName\" :\" $version \" }'"
93
+ cmdArgs = cmdArgs. replaceAll(" \" " ," \\\\\" " )
94
+
95
+ execute(" git clone https://bitbucket.microchip.com/scm/portal/bundles.git" )
96
+ execute(" git clone https://bitbucket.microchip.com/scm/citd/tool-portal-client-launcher.git" )
97
+ execute(" cd tool-portal-client-launcher && node portalLauncher.js -app=../bundles/portal-client-cli-win.exe -cmd=\" uploadGitHub ${ cmdArgs} \" " )
98
+ sendSuccessfulPortalDeploymentEmail()
99
+ } else {
100
+ echo " Tag name is not equal to metadata content version."
101
+ execute(" exit 1" )
102
+ }
103
+
104
+ }
105
+ }
106
+ }
63
107
}
64
108
65
109
post {
@@ -99,6 +143,12 @@ def sendPipelineFailureEmail () {
99
143
100
144
def sendSuccessfulGithubDeploymentEmail () {
101
145
mail to : " ${ params.NOTIFICATION_EMAIL} " ,
102
- subject : " Successful Deployment: ${ currentBuild.fullDisplayName} " ,
146
+ subject : " Successful Github Deployment: ${ currentBuild.fullDisplayName} " ,
103
147
body : " The changes have been successfully deployed to GitHub. ${ env.GITHUB_URL} "
148
+ }
149
+
150
+ def sendSuccessfulPortalDeploymentEmail () {
151
+ mail to : " ${ params.NOTIFICATION_EMAIL} " ,
152
+ subject : " Successful Portal Deployment: ${ currentBuild.fullDisplayName} " ,
153
+ body : " The changes have been successfully deployed to Discover Portal."
104
154
}
0 commit comments