Skip to content

Commit 7ff14ae

Browse files
committed
MCU8QA-162 added new CICD files
1 parent 4efc45f commit 7ff14ae

File tree

3 files changed

+135
-10
lines changed

3 files changed

+135
-10
lines changed

.gitignore

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
[Dd]ebug/
2-
[Rr]elease/
3-
*.atsuo
4-
.vs
1+
# Untracked files in Studio projects
2+
/**/.vs
3+
/**/*.atsuo
4+
/**/[Dd]ebug/*
5+
/**/[Rr]elease/*
6+
7+
# Uncomment these to include hex/elf files
8+
#!/**/[Dd]ebug/*.hex
9+
#!/**/[Dd]ebug/*.elf
10+
#!/**/[Rr]elease/*.hex
11+
#!/**/[Rr]elease/*.elf

.main-meta/main.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"metaDataVersion": "1.0.0",
3+
"category": "com.microchip.ide.project",
4+
"content": {
5+
"metaDataVersion": "1.1.0",
6+
"name": "com.microchip.mcu8.studio.project.",
7+
"version": " ",
8+
"displayName": " ",
9+
"projectName": "",
10+
"shortDescription": "",
11+
"ide": {
12+
"name": "",
13+
"semverRange": ""
14+
},
15+
"compiler": [
16+
{
17+
"name": "",
18+
"semverRange": ""
19+
}
20+
],
21+
"dfp": {
22+
"name": "",
23+
"semverRange": ""
24+
},
25+
"configurator": {
26+
"name": "",
27+
"semverRange": ""
28+
},
29+
"device": {
30+
"metaDataVersion": "1.0.0",
31+
"category": "com.microchip.portal.contentRef",
32+
"content": {
33+
"metaDataVersion": "1.0.0",
34+
"category": "com.microchip.device",
35+
"name": "",
36+
"versionRange": "*"
37+
}
38+
},
39+
"author": "",
40+
"subcategories": [
41+
"",
42+
[
43+
"Peripherals", ""
44+
],
45+
[
46+
"Peripherals", ""
47+
]
48+
],
49+
"peripherals": [
50+
"",""
51+
],
52+
"keywords": [
53+
"",
54+
""
55+
],
56+
"additionalData": {
57+
"longDescription": {
58+
"metaDataVersion": "1.0.0",
59+
"category": "com.microchip.portal.fileRef",
60+
"content": {
61+
"metaDataVersion": "1.0.0",
62+
"fileName": "./README.md",
63+
"mimeType": "text/markdown"
64+
}
65+
}
66+
}
67+
}
68+
}

Jenkinsfile

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Jenkinsfile v1.2.0
2+
13
pipeline {
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/avr128db48-getting-started-with-mvio.git'
1417
BITBUCKET_URL = 'https://bitbucket.microchip.com/scm/ebe/avr128db48-getting-started-with-mvio.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

100144
def 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

Comments
 (0)