forked from redhat-developer/vscode-knative
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
75 lines (65 loc) · 2.03 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env groovy
node('rhel8'){
stage('Checkout repo') {
deleteDir()
git url: "https://github.com/${params.FORK}/vscode-knative.git", branch: params.BRANCH
}
stage('Install requirements') {
def nodeHome = tool 'nodejs-lts'
env.PATH="${env.PATH}:${nodeHome}/bin"
sh "npm install -g typescript vsce"
}
stage('Build') {
sh "npm install"
sh "npm run vscode:prepublish"
}
withEnv(['JUNIT_REPORT_PATH=report.xml']) {
stage('Unit Tests') {
wrap([$class: 'Xvnc']) {
sh "npm test"
junit 'report.xml'
}
}
}
stage('UI Tests') {
wrap([$class: 'Xvnc']) {
try {
sh """
if [ -f \$HOME/.vs-kn/kn ]; then
rm \$HOME/.vs-kn/kn
fi
"""
sh "npm run base-ui-test"
}
finally {
archiveArtifacts artifacts: 'test-resources/*.log,test-resources/**/*.png'
}
}
}
stage('Package') {
def packageJson = readJSON file: 'package.json'
packageJson.extensionDependencies = ["ms-kubernetes-tools.vscode-kubernetes-tools"]
writeJSON file: 'package.json', json: packageJson, pretty: 4
sh "vsce package -o knative-${packageJson.version}-${env.BUILD_NUMBER}.vsix"
sh "sha256sum *.vsix > knative-${packageJson.version}-${env.BUILD_NUMBER}.vsix.sha256"
}
if(params.UPLOAD_LOCATION) {
stage('Snapshot') {
sh "sftp -C ${UPLOAD_LOCATION}/snapshots/vscode-knative/ <<< \$'put -p *.vsix*'"
}
}
if(publishToMarketPlace.equals('true')){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'sverma'
}
stage("Publish to Marketplace") {
withCredentials([[$class: 'StringBinding', credentialsId: 'vscode_java_marketplace', variable: 'TOKEN']]) {
def vsix = findFiles(glob: '**.vsix')
sh 'vsce publish -p ${TOKEN} --packagePath' + " ${vsix[0].path}"
}
stage "Promote the build to stable"
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-knative/ <<< \$'put -p *.vsix*'"
archive includes:"**.vsix*"
}
}
}