Skip to content

Commit 3983714

Browse files
committed
Initial Commit
0 parents  commit 3983714

File tree

7 files changed

+326
-0
lines changed

7 files changed

+326
-0
lines changed

.citd/Jenkinsfilek8s

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
pipeline {
2+
agent {
3+
kubernetes {
4+
label 'github_deployment'
5+
defaultContainer 'xc16-mplabx-sonar-fmpp-python'
6+
yamlFile '.citd/cloudprovider.yml'
7+
}
8+
}
9+
10+
11+
environment {
12+
NOTIFICATION_EMAIL = '1f1319de.microchip.com@amer.teams.ms'
13+
//Update this URL based on where(which organization) it needs to be deployed
14+
GITHUB_URL ='https://github.com/mchpTestArea'
15+
//This is the BitBucket repo URL which we want to deploy
16+
BITBUCKET_URL = 'https://bitbucket.microchip.com/scm/mcu16ce/dspic33c-power-pwm-complementary.git'
17+
//Branch to be deployed, if multiple branches use comma separated string
18+
DEPLOY_BRANCH = 'master'
19+
GITHUB_CREDENTIAL_ID = 'GITHUB_PIC_AVR_TEST_TOKEN'
20+
CHANGE_LOG_PATH = 'deploy_sandbox/changelog.md'
21+
SOURCE_PROJECT_META_DATA = '.main-meta/main.json'
22+
DEPLOY_TOOL_URL = 'https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
23+
}
24+
25+
options {
26+
timestamps()
27+
timeout(time: 20, unit: 'MINUTES')
28+
}
29+
30+
stages {
31+
32+
stage('Checkout') {
33+
steps {
34+
checkout scm
35+
}
36+
}
37+
38+
stage('Build') {
39+
steps {
40+
script {
41+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-mplabx-c-build.git")
42+
execute("cd ./tool-mplabx-c-build && node buildLauncher.js sp=../ rp=./output genMK=true")
43+
}
44+
}
45+
}
46+
47+
// Cloning the tool used for GitHub deployment
48+
stage('GitHub tool clone'){
49+
steps{
50+
script{
51+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git")
52+
execute("chmod +x ./tool-github-deploy/tool-github-deploy/tool-github-deploy.py")
53+
}
54+
}
55+
}
56+
57+
// GitHub repo creation
58+
stage('GitHub Repo Creation'){
59+
when {
60+
anyOf {
61+
expression { !env.GITHUB_URL.contains('microchip-pic-avr-examples') }
62+
allOf {
63+
not { changeRequest() }
64+
branch 'master'
65+
}
66+
}
67+
}
68+
steps{
69+
script{
70+
def jsonObj = readJsonObject();
71+
72+
String [] topics = jsonObj.content.keywords
73+
def asString = topics.join(", ")
74+
asString = asString.replace("\n", "").replace(" ", "").replace("\t", "").replace("\r", "")
75+
Boolean visibility = true
76+
if(env.GITHUB_URL.contains('microchip-pic-avr-examples'))
77+
{
78+
visibility = false
79+
}
80+
81+
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
82+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rpo=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=${jsonObj.content.projectName} -rpd=\"${jsonObj.content.shortDescription}\" -rpt=${asString} -rpp=${visibility}")
83+
}
84+
}
85+
}
86+
}
87+
88+
// Deploying the code to GitHub
89+
stage('GitHub Deploy Source'){
90+
when {
91+
anyOf {
92+
expression { !env.GITHUB_URL.contains('microchip-pic-avr-examples') }
93+
allOf {
94+
not { changeRequest() }
95+
branch 'master'
96+
}
97+
}
98+
}
99+
steps{
100+
script{
101+
def jsonObj = readJsonObject();
102+
def gitHubUrl = "${env.GITHUB_URL}" + "/" + jsonObj.content.projectName
103+
gitHubUrl = gitHubUrl.replace(" ", "").replace("\n", "")
104+
Boolean visibility = true
105+
if(env.GITHUB_URL.contains('microchip-pic-avr-examples'))
106+
{
107+
visibility = false
108+
}
109+
110+
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
111+
// If the organization is "mchpTestArea" change the visibility to public before deploy
112+
if(visibility == true)
113+
{
114+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rpu=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=${jsonObj.content.projectName} -rpp=false")
115+
}
116+
117+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -deploy=true -gpat=$PASS -dgid=$USER_NAME -dburl=${env.BITBUCKET_URL} -dgurl=${gitHubUrl} -dbranch=${env.DEPLOY_BRANCH}")
118+
119+
// If the organization is "mchpTestArea" change the visibility to private after deploy
120+
if(visibility == true)
121+
{
122+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rpu=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=${jsonObj.content.projectName} -rpp=true")
123+
}
124+
}
125+
}
126+
}
127+
}
128+
129+
// Creating GitHub release
130+
stage('GitHub release'){
131+
when {
132+
anyOf {
133+
expression { !env.GITHUB_URL.contains('microchip-pic-avr-examples') }
134+
allOf {
135+
not { changeRequest() }
136+
branch 'master'
137+
}
138+
}
139+
}
140+
steps{
141+
script{
142+
def jsonObj = readJsonObject();
143+
144+
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
145+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rlo=true -gpat=$PASS -rpn=\"${jsonObj.content.projectName}\" -rltv=\"v${jsonObj.content.version}\" -rltt=\"${jsonObj.content.version}\" -rlnp=${env.CHANGE_LOG_PATH}")
146+
}
147+
}
148+
}
149+
}
150+
151+
}
152+
153+
post {
154+
success{
155+
script {
156+
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
157+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
158+
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${env.NOTIFICATION_EMAIL}",
159+
subject: "Successful Pipeline: ${currentBuild.fullDisplayName}",
160+
body: "Something is right with ${env.BUILD_URL}"
161+
} else {
162+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
163+
mail to: "${env.NOTIFICATION_EMAIL}",
164+
subject: "Successful Pipeline: ${currentBuild.fullDisplayName}",
165+
body: "Something is right with ${env.BUILD_URL}"
166+
}
167+
}
168+
}
169+
failure {
170+
script {
171+
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
172+
//archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
173+
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${env.NOTIFICATION_EMAIL}",
174+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
175+
body: "Pipeline failure. ${env.BUILD_URL}"
176+
} else {
177+
//archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
178+
mail to: "${env.NOTIFICATION_EMAIL}",
179+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
180+
body: "Pipeline failure. ${env.BUILD_URL}"
181+
}
182+
}
183+
}
184+
}
185+
}
186+
187+
def execute(String command) {
188+
if (isUnix()) {
189+
sh command
190+
} else {
191+
bat command
192+
}
193+
}
194+
195+
String readJsonObject() {
196+
def jsonObj = readJSON interpolate: true, file: "${env.SOURCE_PROJECT_META_DATA}"
197+
return jsonObj
198+
}

.citd/cloudprovider.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: xc16-mplabx-sonar-fmpp-python
5+
spec:
6+
containers:
7+
- name: xc16-mplabx-sonar-fmpp-python
8+
image: artifacts.microchip.com:7999/microchip/citd/bundles/xc16-mplabx-sonar-fmpp-python-yarn-node:1.50-5.40-4.2-0.9.16-3.x-1.17.3-12.x
9+
imagePullPolicy: Always
10+
command: ['cat']
11+
tty: true
12+
resources:
13+
requests:
14+
cpu: 1
15+
memory: 1Gi
16+
limits:
17+
cpu: 2
18+
memory: 2Gi

.main-meta/main.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"metaDataVersion": "1.0.0",
3+
"category": "com.microchip.ide.project",
4+
"content": {
5+
"metaDataVersion": "1.0.0",
6+
"name": "com.microchip.mplabx.project.dspic33c-power-pwm-complementary",
7+
"version": "1.0.0",
8+
"displayName": "xxxxxxxxxxxxxxx",
9+
"projectName": "dspic33c-power-pwm-complementary",
10+
"shortDescription": "xxxxxxxxxxxxxxx",
11+
"ide": {
12+
"name": "MPLABX",
13+
"semverRange": ">=5.40.0"
14+
},
15+
"compiler": {
16+
"name": "XC16",
17+
"semverRange": "^1.50.0"
18+
},
19+
"dfp": {
20+
"name": "PIC24F-GA-GB_DFP",
21+
"semverRange": "^1.0.41"
22+
},
23+
"device": {
24+
"metaDataVersion": "1.0.0",
25+
"category": "com.microchip.portal.contentRef",
26+
"content": {
27+
"metaDataVersion": "1.0.0",
28+
"category": "com.microchip.device",
29+
"name": "xxxxxxxxxxxxxxx",
30+
"versionRange": "*"
31+
}
32+
},
33+
"subcategories":[
34+
"Hello World",
35+
[
36+
"Peripherals",
37+
"GPIO",
38+
"UART"
39+
]
40+
],
41+
"peripherals": [
42+
"GPIO",
43+
"UART"
44+
],
45+
"keywords": [
46+
"GPIO",
47+
"UART"
48+
]
49+
}
50+
}

changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Project Name or repo name release version Ex: pic24f-hello-world-uart release v1.0.0
2+
### Release Highlights
3+
4+
5+
6+
### Features Added\Updated
7+
8+
9+

images/microchip.png

37.2 KB
Loading

license.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(c) 2020 Microchip Technology Inc. and its subsidiaries. You may use this
2+
software and any derivatives exclusively with Microchip products.
3+
4+
5+
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
6+
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
7+
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
8+
PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
9+
WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
10+
11+
12+
13+
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
14+
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
15+
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
16+
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
17+
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
18+
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
19+
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
20+
21+
22+
23+
MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
24+
TERMS.
25+

readme.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<div id="readme" class="Box-body readme blob js-code-block-container">
2+
<article class="markdown-body entry-content p-3 p-md-6" itemprop="This needs to locked down and 'never' changed"><p><a href="https://www.microchip.com" rel="nofollow"><img src="images/microchip.png" alt="MCHP" width="300";"></a></p>
3+
4+
## pic24f-hello-world-uart
5+
6+
Board Image if any.
7+
8+
## Summary
9+
10+
11+
## Related Documentation
12+
13+
14+
## Software Used
15+
16+
17+
## Hardware Used
18+
19+
20+
## Setup
21+
22+
23+
## Operation
24+
25+
26+

0 commit comments

Comments
 (0)