ci: replace BUILD_URL with BUILD_SOURCE parameter

This parameter can take both URL or a path to Jenkins job.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-10-19 20:12:14 +02:00
parent ebf0f819ac
commit df6c0a3b9a
1 changed files with 45 additions and 39 deletions

View File

@ -9,11 +9,11 @@ pipeline {
parameters { parameters {
gitParameter( gitParameter(
branch: '',
branchFilter: 'origin/(.*)',
defaultValue: 'master',
description: 'Git branch to checkout.',
name: 'GIT_REF', name: 'GIT_REF',
description: 'Git branch to checkout.',
branchFilter: 'origin/(.*)',
branch: '',
defaultValue: 'master',
quickFilterEnabled: false, quickFilterEnabled: false,
selectedValue: 'DEFAULT', selectedValue: 'DEFAULT',
sortMode: 'ASCENDING_SMART', sortMode: 'ASCENDING_SMART',
@ -21,8 +21,8 @@ pipeline {
type: 'PT_BRANCH' type: 'PT_BRANCH'
) )
string( string(
name: 'BUILD_URL', name: 'BUILD_SOURCE',
description: 'Link to tar.gz file.', description: 'URL to tar.gz file OR path to Jenkins build.',
defaultValue: '' defaultValue: ''
) )
string( string(
@ -73,38 +73,44 @@ pipeline {
} }
stages { stages {
stage('Setup') {
steps { script {
sh 'pip3 install --user -r requirements.txt'
} }
}
stage('Download') { stage('Download') {
steps { when { expression { params.BUILD_SOURCE.startsWith('http') } }
script { steps { script {
sh 'mkdir -p ./tmp/pkg/' sh 'mkdir -p ./tmp/pkg/'
if (params.BUILD_URL != '') {
fileOperations([ fileOperations([
fileDownloadOperation( fileDownloadOperation(
url: params.BUILD_URL, url: params.BUILD_SOURCE,
targetFileName: 'StatusIm-Desktop.tar.gz',
targetLocation: './tmp/pkg/',
userName: '', userName: '',
password: '', password: '',
targetLocation: './tmp/pkg/',
targetFileName: 'StatusIm-Desktop.tar.gz',
) )
]) ])
} else { } }
}
stage('Copy') {
when { expression { ! params.BUILD_SOURCE.startsWith('http') } }
steps { script {
copyArtifacts( copyArtifacts(
projectName: 'status-desktop/systems/linux/x86_64/package/', projectName: params.BUILD_SOURCE,
filter: 'pkg/*-x86_64.tar.gz', filter: 'pkg/*-x86_64.tar.gz',
selector: lastWithArtifacts(), selector: lastWithArtifacts(),
target: './tmp' target: './tmp'
) )
} } }
def pkg_path = "./${utils.findFile('tmp/pkg/*tar.gz')}"
sh "tar -zxvf '${pkg_path}' -C './tmp'"
env.APP_DIR = "./${utils.findFile('tmp/*.AppImage')}"
}
}
} }
stage('Setup') { stage('Unpack') {
steps { script { steps { script {
sh 'pip3 install --user -r requirements.txt' sh "tar -zxvf '${utils.findFile('tmp/pkg/*tar.gz')}' -C './tmp'"
env.APP_DIR = utils.findFile('tmp/*.AppImage')
} } } }
} }
@ -142,10 +148,10 @@ pipeline {
post { post {
always { script { always { script {
allure([ allure([
jdk: '',
properties: [],
results: [[path: 'allure-results']], results: [[path: 'allure-results']],
reportBuildPolicy: 'ALWAYS', reportBuildPolicy: 'ALWAYS',
properties: [],
jdk: '',
]) ])
} } } }
cleanup { cleanWs() } cleanup { cleanWs() }