-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathJenkinsfile
More file actions
83 lines (70 loc) · 2.43 KB
/
Jenkinsfile
File metadata and controls
83 lines (70 loc) · 2.43 KB
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
76
77
78
79
80
81
82
83
#!/usr/bin/env groovy
def installBuildRequirements(){
def nodeHome = tool 'nodejs-lts'
env.PATH="${env.PATH}:${nodeHome}/bin"
sh "npm install --global yarn"
sh "npm install --global @cyclonedx/cdxgen"
}
node('rhel9'){
stage 'Checkout vscode-kaoto code'
deleteDir()
git branch: "${BRANCH}", url: "https://github.com/${FORK}/vscode-kaoto.git"
stage 'install vscode-kaoto build requirements'
installBuildRequirements()
stage 'Build vscode-kaoto'
sh "yarn"
sh "yarn build:dev"
sh "yarn build:prod"
stage('Unit Tests') {
wrap([$class: 'Xvnc']) {
sh "yarn test:unit"
}
}
stage('UI Tests') {
wrap([$class: 'Xvnc']) {
withCredentials([[$class: 'StringBinding', credentialsId: 'oc_developer_token', variable: 'TOKEN']]) {
sh 'oc login --token=${TOKEN} --server=https://api.ft-421-a.fuse.integration-qe.com:6443 --insecure-skip-tls-verify=true'
sh 'oc project kaoto'
}
env.TEST_RESOURCES = 'test-resources'
env.CODE_VERSION = 'max'
sh "yarn build:vsix"
sh "yarn test:it:with-prebuilt-vsix"
sh "rm -rf *.vsix"
}
}
stage 'Package vscode-kaoto'
def packageJson = readJSON file: 'package.json'
sh "yarn build:vsix -o vscode-kaoto-${packageJson.version}-${env.BUILD_NUMBER}.vsix"
stage 'Upload vscode-kaoto to staging'
def vsix = findFiles(glob: '**.vsix')
sh "sftp -C ${UPLOAD_LOCATION}/snapshots/vscode-kaoto/ <<< \$'put -p \"${vsix[0].path}\"'"
stash name:'vsix', includes:vsix[0].path
stage 'Generate SBOM'
sh "cdxgen -o manifest.json"
archive includes:"manifest.json"
}
node('rhel9'){
if(publishToMarketPlace.equals('true')){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'apupier, djelinek, mdinizde, ricmarti, toigaras, mmelko'
}
stage 'Publish to Marketplaces'
unstash 'vsix';
def vsix = findFiles(glob: '**.vsix')
// VS Code Marketplace
withCredentials([[$class: 'StringBinding', credentialsId: 'vscode_java_marketplace', variable: 'TOKEN']]) {
sh 'yarn vsce publish -p ${TOKEN} --packagePath' + " ${vsix[0].path}"
}
// Open-vsx Marketplace
sh "npm install -g ovsx"
withCredentials([[$class: 'StringBinding', credentialsId: 'open-vsx-access-token', variable: 'OVSX_TOKEN']]) {
sh 'ovsx publish -p ${OVSX_TOKEN}' + " ${vsix[0].path}"
}
archive includes:"**.vsix"
stage ('Promote the build to stable') {
vsix = findFiles(glob: '**.vsix')
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-kaoto/ <<< \$'put -p \"${vsix[0].path}\"'"
}
}
}