diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd22234 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/*/dist/ +/*/build/ +/*/nbproject/private/ +/*/nbproject/*.properties +/*/nbproject/*.mk +/*/nbproject/*.bash \ No newline at end of file diff --git a/.main-meta/main.json b/.main-meta/main.json new file mode 100644 index 0000000..ecf0f32 --- /dev/null +++ b/.main-meta/main.json @@ -0,0 +1,68 @@ +{ + "metaDataVersion": "1.0.0", + "category": "com.microchip.ide.project", + "content": { + "metaDataVersion": "1.1.0", + "name": "com.microchip.mcu8.mplabx.project.", + "version": " ", + "displayName": " ", + "projectName": "", + "shortDescription": "", + "ide": { + "name": "", + "semverRange": "" + }, + "compiler": [ + { + "name": "", + "semverRange": "" + } + ], + "dfp": { + "name": "", + "semverRange": "" + }, + "configurator": { + "name": "", + "semverRange": "" + }, + "device": { + "metaDataVersion": "1.0.0", + "category": "com.microchip.portal.contentRef", + "content": { + "metaDataVersion": "1.0.0", + "category": "com.microchip.device", + "name": "", + "versionRange": "*" + } + }, + "author": "", + "subcategories": [ + "", + [ + "Peripherals", "" + ], + [ + "Peripherals", "" + ] + ], + "peripherals": [ + "","" + ], + "keywords": [ + "", + "" + ], + "additionalData": { + "longDescription": { + "metaDataVersion": "1.0.0", + "category": "com.microchip.portal.fileRef", + "content": { + "metaDataVersion": "1.0.0", + "fileName": "./README.md", + "mimeType": "text/markdown" + } + } + } + } +} \ No newline at end of file diff --git a/Jenkinsfilek8s b/Jenkinsfilek8s new file mode 100644 index 0000000..514da84 --- /dev/null +++ b/Jenkinsfilek8s @@ -0,0 +1,118 @@ +pipeline { + agent { + kubernetes { + label 'avr128da48-cnano-led-blink-pwm-mcc' + defaultContainer 'xc8-mplabx' + yamlFile 'cloudprovider.yml' + } + } + + parameters { + string( name: 'NOTIFICATION_EMAIL', + defaultValue: 'PICAVR_Examples_GateKeepers@microchip.com', + description: "Email to send build failure and fixed notifications.") + } + + environment { + GITHUB_URL ='https://github.com/microchip-pic-avr-examples/avr128da48-cnano-led-blink-pwm-mcc.git' + BITBUCKET_URL = 'https://bitbucket.microchip.com/scm/ebe/avr128da48-cnano-led-blink-pwm-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' + } + + options { + timestamps() + timeout(time: 20, unit: 'MINUTES') + } + + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + 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('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() + } + } + } + } + + post { + failure { + script { + sendPipelineFailureEmail() + } + } + always { + archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", allowEmptyArchive: true, fingerprint: true + } + } +} + +def execute(String cmd) { + if(isUnix()) { + sh cmd + } else { + 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 Deployment: ${currentBuild.fullDisplayName}", + body: "The changes have been successfully deployed to GitHub. ${env.GITHUB_URL}" +} \ No newline at end of file diff --git a/cloudprovider.yml b/cloudprovider.yml new file mode 100644 index 0000000..9de8fa9 --- /dev/null +++ b/cloudprovider.yml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Pod +metadata: + name: xc8-mplabx +spec: + containers: + - name: xc8-mplabx + image: artifacts.microchip.com:7999/microchip/citd/bundles/xc8-mplabx:2.20-5.40 + imagePullPolicy: Always + command: ['cat'] + tty: true + resources: + requests: + cpu: 1 + memory: 4Gi + limits: + cpu: 2 + memory: 8Gi \ No newline at end of file