1+ // Jenkinsfile v1.2.0
2+
13pipeline {
24 agent {
35 label ' idc-dk-i14545.microchip.com'
@@ -9,7 +11,8 @@ pipeline {
911 description : " Email to send build failure, fixed and successful deployment notifications." )
1012 }
1113
12- environment {
14+ environment {
15+ GITHUB_OWNER = ' microchip-pic-avr-examples'
1316 GITHUB_URL = ' https://github.com/microchip-pic-avr-examples/attiny1627-force-sensitive-resistor-with-12-bit-adc.git'
1417 BITBUCKET_URL = ' https://bitbucket.microchip.com/scm/ebe/attiny1627-force-sensitive-resistor-with-12-bit-adc.git'
1518 DEPLOY_TOOL_URL = ' https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
@@ -19,7 +22,7 @@ pipeline {
1922
2023 options {
2124 timestamps()
22- timeout(time : 20 , unit : ' MINUTES' )
25+ timeout(time : 30 , unit : ' MINUTES' )
2326 }
2427
2528 stages {
@@ -28,18 +31,29 @@ pipeline {
2831 checkout scm
2932 }
3033 }
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+ }
3145
3246 stage(' Build' ) {
3347 steps {
3448 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" )
3650 execute(" cd tool-studio-c-build && python studiobuildtool.py" )
3751
3852 }
3953 }
4054 }
4155
42- stage(' Deploy' ) {
56+ stage(' GitHub- Deploy' ) {
4357 when {
4458 not {
4559 changeRequest()
@@ -59,7 +73,37 @@ pipeline {
5973 sendSuccessfulGithubDeploymentEmail()
6074 }
6175 }
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+ }
63107 }
64108
65109 post {
@@ -99,6 +143,12 @@ def sendPipelineFailureEmail () {
99143
100144def sendSuccessfulGithubDeploymentEmail () {
101145 mail to : " ${ params.NOTIFICATION_EMAIL} " ,
102- subject : " Successful Deployment: ${ currentBuild.fullDisplayName} " ,
146+ subject : " Successful Github Deployment: ${ currentBuild.fullDisplayName} " ,
103147 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."
104154}
0 commit comments