From df6c0a3b9a91eee9de54d005f33387bbe51097bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 19 Oct 2023 20:12:14 +0200 Subject: [PATCH] ci: replace BUILD_URL with BUILD_SOURCE parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This parameter can take both URL or a path to Jenkins job. Signed-off-by: Jakub SokoĊ‚owski --- test/e2e/ci/Jenkinsfile | 84 ++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/test/e2e/ci/Jenkinsfile b/test/e2e/ci/Jenkinsfile index 15adb0144e..ad2ab49b9c 100644 --- a/test/e2e/ci/Jenkinsfile +++ b/test/e2e/ci/Jenkinsfile @@ -9,11 +9,11 @@ pipeline { parameters { gitParameter( - branch: '', - branchFilter: 'origin/(.*)', - defaultValue: 'master', - description: 'Git branch to checkout.', name: 'GIT_REF', + description: 'Git branch to checkout.', + branchFilter: 'origin/(.*)', + branch: '', + defaultValue: 'master', quickFilterEnabled: false, selectedValue: 'DEFAULT', sortMode: 'ASCENDING_SMART', @@ -21,8 +21,8 @@ pipeline { type: 'PT_BRANCH' ) string( - name: 'BUILD_URL', - description: 'Link to tar.gz file.', + name: 'BUILD_SOURCE', + description: 'URL to tar.gz file OR path to Jenkins build.', defaultValue: '' ) string( @@ -73,41 +73,47 @@ pipeline { } stages { - stage('Download') { - steps { - script { - sh 'mkdir -p ./tmp/pkg/' - if (params.BUILD_URL != '') { - fileOperations([ - fileDownloadOperation( - url: params.BUILD_URL, - userName: '', - password: '', - targetLocation: './tmp/pkg/', - targetFileName: 'StatusIm-Desktop.tar.gz', - ) - ]) - } else { - copyArtifacts( - projectName: 'status-desktop/systems/linux/x86_64/package/', - filter: 'pkg/*-x86_64.tar.gz', - selector: lastWithArtifacts(), - 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') { steps { script { sh 'pip3 install --user -r requirements.txt' } } } + stage('Download') { + when { expression { params.BUILD_SOURCE.startsWith('http') } } + steps { script { + sh 'mkdir -p ./tmp/pkg/' + fileOperations([ + fileDownloadOperation( + url: params.BUILD_SOURCE, + targetFileName: 'StatusIm-Desktop.tar.gz', + targetLocation: './tmp/pkg/', + userName: '', + password: '', + ) + ]) + } } + } + + stage('Copy') { + when { expression { ! params.BUILD_SOURCE.startsWith('http') } } + steps { script { + copyArtifacts( + projectName: params.BUILD_SOURCE, + filter: 'pkg/*-x86_64.tar.gz', + selector: lastWithArtifacts(), + target: './tmp' + ) + } } + } + + stage('Unpack') { + steps { script { + sh "tar -zxvf '${utils.findFile('tmp/pkg/*tar.gz')}' -C './tmp'" + env.APP_DIR = utils.findFile('tmp/*.AppImage') + } } + } + stage('Test') { steps { script { def flags = [] @@ -120,7 +126,7 @@ pipeline { parallelBuild: true, screen: '1920x1080x24', additionalOptions: '-dpi 1' - ]){ + ]) { sh 'fluxbox &' withCredentials([ usernamePassword( @@ -142,12 +148,12 @@ pipeline { post { always { script { allure([ - jdk: '', - properties: [], results: [[path: 'allure-results']], reportBuildPolicy: 'ALWAYS', + properties: [], + jdk: '', ]) - }} + } } cleanup { cleanWs() } } }