MCU8QA-467 added new CICD files

master
Aman Hebbale 2021-03-31 14:12:13 +05:30
rodzic b29ad8e18c
commit 9de78016c7
2 zmienionych plików z 26 dodań i 137 usunięć

Wyświetl plik

@ -1,14 +1,12 @@
// Jenkinsfilek8s v1.2.0
// Jenkinsfile v2.0.0
pipeline {
agent {
kubernetes {
label 'avr128da48-cnano-ws2812-mplab-mcc'
defaultContainer 'xc8-mplabx'
yamlFile '.citd/cloudprovider.yml'
}
}
parameters {
string( name: 'NOTIFICATION_EMAIL',
defaultValue: 'PICAVR_Examples_GateKeepers@microchip.com',
@ -17,126 +15,36 @@ pipeline {
environment {
GITHUB_OWNER = 'microchip-pic-avr-examples'
GITHUB_URL ='https://github.com/microchip-pic-avr-examples/avr128da48-cnano-ws2812-mplab-mcc.git'
GITHUB_URL ='https://github.com/microchip-pic-avr-examples/avr128da48-cnano-ws2812-mplab-mcc'
BITBUCKET_URL = 'https://bitbucket.microchip.com/scm/ebe/avr128da48-cnano-ws2812-mplab-mcc.git'
DEPLOY_TOOL_URL = 'https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
DEPLOY_SCRIPT_DIR = 'tool-github-deploy'
DEPLOY_SCRIPT_FILE = 'deploy-source-as-is.sh'
SEMVER_REGEX = '^(0|[1-9]\\d*)+\\.(0|[1-9]\\d*)+\\.(0|[1-9]\\d*)+$'
ARTIFACTORY_SERVER = 'https://artifacts.microchip.com:7999/artifactory'
}
options {
timestamps()
timeout(time: 30, unit: 'MINUTES')
}
options {
timestamps()
timeout(time: 30, unit: 'MINUTES')
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('metadata') {
steps {
stages {
stage('setup') {
steps {
script {
execute("pip install jsonschema")
execute("git clone https://bitbucket.microchip.com/scm/citd/metadata-schema.git")
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-metadata-validator.git")
execute("cd tool-metadata-validator && python metadata-validator.py -data '../.main-meta/main.json' -schema '../metadata-schema/main-schema.json'")
execute("git clone https://bitbucket.microchip.com/scm/citd/mpae-buildpipeline-groovy-scripts.git")
def buildPipeline = load ('mpae-buildpipeline-groovy-scripts/xc8mplabx-buildpipeline.groovy')
buildPipeline.runStages()
}
}
}
stage('Pre-build') {
steps {
script {
MPLABX_PATH= sh (script: 'update-alternatives --list MPLABX_PATH',returnStdout: true).trim()
COMPILER_PATH= sh (script: 'update-alternatives --list XC8_PATH',returnStdout: true).trim()
def pDir = "${MPLABX_PATH}/packs"
def ver = COMPILER_PATH.split('/')[4].substring(1)
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-mplabx-c-project-generator.git")
execute("cd tool-mplabx-c-project-generator && node configGenerator.js sp=../ v8=${ver} packs=${pDir}")
}
}
}
stage('Build') {
steps {
script {
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-mplabx-c-build.git")
execute("cd tool-mplabx-c-build && node buildLauncher.js sp=../ rp=./output genMK=true")
}
}
}
stage('GitHub-Deploy') {
when {
not {
changeRequest()
}
anyOf {
tag ''
}
}
steps {
script {
execute("git clone ${env.DEPLOY_TOOL_URL}")
withCredentials([usernamePassword(credentialsId: '8bit-examples.github.com', usernameVariable: 'USER_NAME', passwordVariable:'USER_PASS' )]) {
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}'")
}
sendSuccessfulGithubDeploymentEmail()
}
}
}
stage('Portal-Deploy') {
when {
not {
changeRequest()
}
tag ''
}
steps {
script {
def metadata = readJSON file:".main-meta/main.json"
def version = metadata.content.version
def project = metadata.content.projectName
if(version == env.TAG_NAME) {
def cmdArgs = "'{\"repoOwnerName\":\"$env.GITHUB_OWNER\",\"repoName\":\"$project\",\"tagName\":\"$version\"}'"
cmdArgs = cmdArgs.replaceAll("\"","\\\\\"")
execute("git clone https://bitbucket.microchip.com/scm/portal/bundles.git")
execute("cd bundles && chmod 755 ./portal-client-cli-linux")
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-portal-client-launcher.git")
execute("cd tool-portal-client-launcher && node portalLauncher.js -app=../bundles/portal-client-cli-linux -cmd=\"uploadGitHub ${cmdArgs}\"")
sendSuccessfulPortalDeploymentEmail()
} else {
echo "Tag name is not equal to metadata content version."
execute("exit 1")
}
}
}
}
}
post {
post {
failure {
script {
sendPipelineFailureEmail()
}
}
always {
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", allowEmptyArchive: true, fingerprint: true
}
}
}
}
}
def execute(String cmd) {
if(isUnix()) {
sh cmd
@ -144,27 +52,8 @@ def execute(String cmd) {
bat cmd
}
}
def sendPipelineFailureEmail () {
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${params.NOTIFICATION_EMAIL}",
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Pipeline failure. ${env.BUILD_URL}"
} else {
mail to: "${params.NOTIFICATION_EMAIL}",
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Pipeline failure. ${env.BUILD_URL}"
}
}
def sendSuccessfulGithubDeploymentEmail () {
mail to: "${params.NOTIFICATION_EMAIL}",
subject: "Successful Github Deployment: ${currentBuild.fullDisplayName}",
body: "The changes have been successfully deployed to GitHub. ${env.GITHUB_URL}"
}
def sendSuccessfulPortalDeploymentEmail () {
mail to: "${params.NOTIFICATION_EMAIL}",
subject: "Successful Portal Deployment: ${currentBuild.fullDisplayName}",
body: "The changes have been successfully deployed to Discover Portal."
def sendPipelineFailureEmail() {
mail to: "${env.EMAILLIST},${params.NOTIFICATION_EMAIL}",
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Pipeline failure. ${env.BUILD_URL}"
}

Wyświetl plik

@ -11,8 +11,8 @@ spec:
tty: true
resources:
requests:
cpu: 1
memory: 4Gi
cpu: 0.25
memory: 500Mi
limits:
cpu: 2
memory: 8Gi
cpu: 0.5
memory: 750Mi