|
| 1 | +pipeline |
| 2 | +{ |
| 3 | + agent |
| 4 | + { |
| 5 | + kubernetes |
| 6 | + { |
| 7 | + containerTemplate |
| 8 | + { |
| 9 | + name 'kiso-build-env' |
| 10 | + image 'eclipse/kiso-build-env:v0.1.1' |
| 11 | + alwaysPullImage 'true' |
| 12 | + ttyEnabled true |
| 13 | + resourceRequestCpu '2' |
| 14 | + resourceLimitCpu '2' |
| 15 | + resourceRequestMemory '8Gi' |
| 16 | + resourceLimitMemory '8Gi' |
| 17 | + } |
| 18 | + } |
| 19 | + } |
| 20 | + stages |
| 21 | + { |
| 22 | + stage('Setup Env') |
| 23 | + { |
| 24 | + steps |
| 25 | + { |
| 26 | + // Clean workspace |
| 27 | + cleanWs() |
| 28 | + checkout scm |
| 29 | + } |
| 30 | + } |
| 31 | + |
| 32 | + stage('Run unittests') |
| 33 | + { |
| 34 | + steps |
| 35 | + { |
| 36 | + sh """ |
| 37 | + npm install |
| 38 | + xvfb-run -a npm run test |
| 39 | + """ |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + stage('build plugin') |
| 44 | + { |
| 45 | + steps |
| 46 | + { |
| 47 | + sh """ |
| 48 | + npm install |
| 49 | + vsce package --baseContentUrl https://github.com/eclipse/kiso-testing-vscode.git |
| 50 | + """ |
| 51 | + |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + stage('publish') |
| 56 | + { |
| 57 | + when |
| 58 | + { |
| 59 | + buildingTag() |
| 60 | + } |
| 61 | + steps |
| 62 | + { |
| 63 | + withCredentials([string( |
| 64 | + credentialsId: 'vscode-marketplace-token', |
| 65 | + variable: 'token')]) { |
| 66 | + |
| 67 | + sh """ |
| 68 | + export VSCE_PAT=${token} |
| 69 | + vsce publish --baseContentUrl https://github.com/eclipse/kiso-testing-vscode.git |
| 70 | + """ |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + |
| 76 | + } // stages |
| 77 | + |
| 78 | + post // Called at very end of the script to notify developer and github about the result of the build |
| 79 | + { |
| 80 | + // always |
| 81 | + // { |
| 82 | + // // pass |
| 83 | + // } |
| 84 | + success |
| 85 | + { |
| 86 | + cleanWs() |
| 87 | + } |
| 88 | + unstable |
| 89 | + { |
| 90 | + notifyFailed() |
| 91 | + } |
| 92 | + failure |
| 93 | + { |
| 94 | + notifyFailed() |
| 95 | + } |
| 96 | + aborted |
| 97 | + { |
| 98 | + notifyAbort() |
| 99 | + } |
| 100 | + } |
| 101 | +} // pipeline |
| 102 | + |
| 103 | + |
| 104 | +def notifyFailed() |
| 105 | +{ |
| 106 | + emailext (subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) is failing", |
| 107 | + body: "Oups, something went wrong with ${env.BUILD_URL}... We are looking forward for your fix!", |
| 108 | + recipientProviders: [[$class: 'CulpritsRecipientProvider'], |
| 109 | + [$class: 'DevelopersRecipientProvider'], |
| 110 | + [$class: 'RequesterRecipientProvider']]) |
| 111 | +} |
| 112 | + |
| 113 | +def notifyAbort() |
| 114 | +{ |
| 115 | + emailext (subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) was aborted", |
| 116 | + body: "Oups, something went wrong with ${env.BUILD_URL}... We are looking forward for your fix!", |
| 117 | + recipientProviders: [[$class: 'CulpritsRecipientProvider'], |
| 118 | + [$class: 'DevelopersRecipientProvider'], |
| 119 | + [$class: 'RequesterRecipientProvider']]) |
| 120 | +} |
0 commit comments