Skip to content

Commit 95bb5fd

Browse files
Akashkumar Natavarlal JivaniAkashkumar Natavarlal Jivani
authored andcommitted
MCU8QA-467 added new CICD files
1 parent c580ba3 commit 95bb5fd

File tree

2 files changed

+26
-137
lines changed

2 files changed

+26
-137
lines changed

.citd/Jenkinsfilek8s

Lines changed: 22 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
// Jenkinsfilek8s v1.2.0
2-
1+
// Jenkinsfile v2.0.0
32
pipeline {
43
agent {
54
kubernetes {
6-
label 'pic18f47q10-adc-computation-modes-mplab'
5+
76
defaultContainer 'xc8-mplabx'
87
yamlFile '.citd/cloudprovider.yml'
98
}
109
}
11-
1210
parameters {
1311
string( name: 'NOTIFICATION_EMAIL',
1412
defaultValue: 'PICAVR_Examples_GateKeepers@microchip.com',
@@ -17,154 +15,45 @@ pipeline {
1715

1816
environment {
1917
GITHUB_OWNER = 'microchip-pic-avr-examples'
20-
GITHUB_URL ='https://github.com/microchip-pic-avr-examples/pic18f47q10-adc-computation-modes-mplab.git'
18+
GITHUB_URL ='https://github.com/microchip-pic-avr-examples/pic18f47q10-adc-computation-modes-mplab'
2119
BITBUCKET_URL = 'https://bitbucket.microchip.com/scm/ebe/pic18f47q10-adc-computation-modes-mplab.git'
22-
DEPLOY_TOOL_URL = 'https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
23-
DEPLOY_SCRIPT_DIR = 'tool-github-deploy'
24-
DEPLOY_SCRIPT_FILE = 'deploy-source-as-is.sh'
20+
SEMVER_REGEX = '^(0|[1-9]\\d*)+\\.(0|[1-9]\\d*)+\\.(0|[1-9]\\d*)+$'
21+
ARTIFACTORY_SERVER = 'https://artifacts.microchip.com:7999/artifactory'
22+
}
23+
options {
24+
timestamps()
25+
timeout(time: 30, unit: 'MINUTES')
2526
}
2627

27-
options {
28-
timestamps()
29-
timeout(time: 30, unit: 'MINUTES')
30-
}
31-
32-
stages {
33-
stage('Checkout') {
34-
steps {
35-
checkout scm
36-
}
37-
}
38-
39-
stage('metadata') {
40-
steps {
28+
stages {
29+
stage('setup') {
30+
steps {
4131
script {
42-
execute("pip install jsonschema")
43-
execute("git clone https://bitbucket.microchip.com/scm/citd/metadata-schema.git")
44-
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-metadata-validator.git")
45-
execute("cd tool-metadata-validator && python metadata-validator.py -data '../.main-meta/main.json' -schema '../metadata-schema/main-schema.json'")
32+
execute("git clone https://bitbucket.microchip.com/scm/citd/mpae-buildpipeline-groovy-scripts.git")
33+
def buildPipeline = load ('mpae-buildpipeline-groovy-scripts/xc8mplabx-buildpipeline.groovy')
34+
buildPipeline.runStages()
4635
}
4736
}
48-
}
49-
50-
stage('Pre-build') {
51-
steps {
52-
script {
53-
MPLABX_PATH= sh (script: 'update-alternatives --list MPLABX_PATH',returnStdout: true).trim()
54-
COMPILER_PATH= sh (script: 'update-alternatives --list XC8_PATH',returnStdout: true).trim()
55-
def pDir = "${MPLABX_PATH}/packs"
56-
def ver = COMPILER_PATH.split('/')[4].substring(1)
57-
58-
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-mplabx-c-project-generator.git")
59-
execute("cd tool-mplabx-c-project-generator && node configGenerator.js sp=../ v8=${ver} packs=${pDir}")
60-
}
61-
}
62-
}
63-
64-
stage('Build') {
65-
steps {
66-
script {
67-
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-mplabx-c-build.git")
68-
execute("cd tool-mplabx-c-build && node buildLauncher.js sp=../ rp=./output genMK=true")
69-
}
70-
}
71-
}
72-
73-
stage('GitHub-Deploy') {
74-
when {
75-
not {
76-
changeRequest()
77-
}
78-
anyOf {
79-
tag ''
80-
}
81-
}
82-
steps {
83-
script {
84-
execute("git clone ${env.DEPLOY_TOOL_URL}")
85-
86-
withCredentials([usernamePassword(credentialsId: '8bit-examples.github.com', usernameVariable: 'USER_NAME', passwordVariable:'USER_PASS' )]) {
87-
execute("cd ${env.DEPLOY_SCRIPT_DIR} && bash ${env.DEPLOY_SCRIPT_FILE} ${env.BITBUCKET_URL} ${env.GITHUB_URL} ${USER_NAME} ${USER_PASS} '--tag ${env.TAG_NAME}'")
88-
}
89-
90-
sendSuccessfulGithubDeploymentEmail()
91-
}
92-
}
93-
}
94-
95-
stage('Portal-Deploy') {
96-
when {
97-
not {
98-
changeRequest()
99-
}
100-
tag ''
101-
}
102-
steps {
103-
script {
104-
def metadata = readJSON file:".main-meta/main.json"
105-
def version = metadata.content.version
106-
def project = metadata.content.projectName
107-
108-
if(version == env.TAG_NAME) {
109-
def cmdArgs = "'{\"repoOwnerName\":\"$env.GITHUB_OWNER\",\"repoName\":\"$project\",\"tagName\":\"$version\"}'"
110-
cmdArgs = cmdArgs.replaceAll("\"","\\\\\"")
111-
112-
execute("git clone https://bitbucket.microchip.com/scm/portal/bundles.git")
113-
execute("cd bundles && chmod 755 ./portal-client-cli-linux")
114-
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-portal-client-launcher.git")
115-
execute("cd tool-portal-client-launcher && node portalLauncher.js -app=../bundles/portal-client-cli-linux -cmd=\"uploadGitHub ${cmdArgs}\"")
116-
sendSuccessfulPortalDeploymentEmail()
117-
} else {
118-
echo "Tag name is not equal to metadata content version."
119-
execute("exit 1")
120-
}
121-
122-
}
123-
}
12437
}
12538
}
12639

127-
128-
post {
40+
post {
12941
failure {
13042
script {
13143
sendPipelineFailureEmail()
13244
}
133-
}
134-
always {
135-
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", allowEmptyArchive: true, fingerprint: true
136-
}
137-
}
45+
}
46+
}
13847
}
139-
14048
def execute(String cmd) {
14149
if(isUnix()) {
14250
sh cmd
14351
} else {
14452
bat cmd
14553
}
14654
}
147-
148-
def sendPipelineFailureEmail () {
149-
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
150-
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${params.NOTIFICATION_EMAIL}",
151-
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
152-
body: "Pipeline failure. ${env.BUILD_URL}"
153-
} else {
154-
mail to: "${params.NOTIFICATION_EMAIL}",
155-
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
156-
body: "Pipeline failure. ${env.BUILD_URL}"
157-
}
158-
}
159-
160-
def sendSuccessfulGithubDeploymentEmail () {
161-
mail to: "${params.NOTIFICATION_EMAIL}",
162-
subject: "Successful Github Deployment: ${currentBuild.fullDisplayName}",
163-
body: "The changes have been successfully deployed to GitHub. ${env.GITHUB_URL}"
164-
}
165-
166-
def sendSuccessfulPortalDeploymentEmail () {
167-
mail to: "${params.NOTIFICATION_EMAIL}",
168-
subject: "Successful Portal Deployment: ${currentBuild.fullDisplayName}",
169-
body: "The changes have been successfully deployed to Discover Portal."
55+
def sendPipelineFailureEmail() {
56+
mail to: "${env.EMAILLIST},${params.NOTIFICATION_EMAIL}",
57+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
58+
body: "Pipeline failure. ${env.BUILD_URL}"
17059
}

.citd/cloudprovider.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ spec:
1111
tty: true
1212
resources:
1313
requests:
14-
cpu: 1
15-
memory: 4Gi
14+
cpu: 0.25
15+
memory: 500Mi
1616
limits:
17-
cpu: 2
18-
memory: 8Gi
17+
cpu: 0.5
18+
memory: 750Mi

0 commit comments

Comments
 (0)