Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update jenkins #714

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 24 additions & 27 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

node('rhel8'){

stage ('Checkout vscode-tekton code') {
deleteDir()
git url: 'https://github.com/redhat-developer/vscode-tekton.git',
branch: "${BRANCH}"
}
stage('Checkout repo') {
deleteDir()
git url: "https://github.com/${params.FORK}/vscode-tekton.git", branch: params.BRANCH
}

stage ('Install vscode-tekton build requirements') {
def nodeHome = tool 'nodejs-lts'
Expand All @@ -28,44 +27,42 @@ node('rhel8'){
}
}

stage ("Package vscode-tekton") {
stage('Package') {
def packageJson = readJSON file: 'package.json'
writeJSON file: 'package.json', json: packageJson, pretty: 4
sh "vsce package -o tekton-pipelines-${packageJson.version}-${env.BUILD_NUMBER}.vsix"
sh "sha256sum *.vsix > tekton-pipelines-${packageJson.version}-${env.BUILD_NUMBER}.vsix.sha256"
}

if(params.UPLOAD_LOCATION) {
stage('Snapshot') {
def filesToPush = findFiles(glob: '**.vsix')
sh "rsync -Pzrlt --rsh=ssh --protocol=28 *.vsix* ${UPLOAD_LOCATION}/snapshots/vscode-tekton/"
stash name:'vsix', includes:filesToPush[0].path
sh "sftp -C ${UPLOAD_LOCATION}/snapshots/vscode-tekton/ <<< \$'put -p *.vsix*'"
}
}
}

node('rhel8'){
if(publishToMarketPlace.equals('true')){
if(publishToMarketPlace.equals('true') || publishToOVSX.equals('true')){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'degolovi,yvydolob,msuman'
input message:'Approve deployment?', submitter: 'degolovi, msuman'
}

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 ("Publish to Marketplace") {
unstash 'vsix';
def vsix = findFiles(glob: '**.vsix')
withCredentials([[$class: 'StringBinding', credentialsId: 'vscode_java_marketplace', variable: 'TOKEN']]) {
sh 'vsce publish -p ${TOKEN} --packagePath' + " ${vsix[0].path}"
}
stage "Promote the build to stable"
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-tekton/ <<< \$'put -p *.vsix*'"
archive includes:"**.vsix*"
}
}

// Open-vsx Marketplace
if (publishToOVSX.equals('true')) {
stage("Publish to OVSX") {
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") {
sh "rsync -Pzrlt --rsh=ssh --protocol=28 *.vsix* ${UPLOAD_LOCATION}/stable/vscode-tekton/"
}
sh "ovsx publish -p ${OVSX_TOKEN} vscode-tekton-${packageJson.version}-${env.BUILD_NUMBER}-ovsx.vsix"
}
}
}
}