ci: fetch E2E APK from android-e2e jobs

Using `copyArtifacts()` is more reliable and faster then fetching APKs
based on URLs acquired by parsing GitHub comments from Jenkins builds.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-02-06 11:58:22 +01:00
parent b9ac26edd7
commit e61bd769a8
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
4 changed files with 62 additions and 25 deletions

View File

@ -105,7 +105,7 @@ pipeline {
e2eApk = utils.getEnv(apke2e, 'SAUCE_URL') e2eApk = utils.getEnv(apke2e, 'SAUCE_URL')
build( build(
job: 'status-mobile/e2e/status-app-nightly', job: 'status-mobile/e2e/status-app-nightly',
parameters: [string(name: 'APK_NAME', value: e2eApk)], parameters: [string(name: 'APK_URL', value: e2eApk)],
wait: false wait: false
) )
} } } }

View File

@ -4,8 +4,8 @@ pipeline {
parameters { parameters {
string( string(
name: 'APK_NAME', name: 'APK_URL',
description: 'Filename of APK uploaded to SauceLabs.', description: 'URL of APK uploaded to SauceLabs.',
) )
string( string(
name: 'KEYWORD_EXPRESSION', name: 'KEYWORD_EXPRESSION',
@ -20,6 +20,14 @@ pipeline {
stages { stages {
stage('Prep') {
steps { script {
if (params.PR_ID == null) {
error("PR_ID parameter not set!")
}
} }
}
stage('Setup') { stage('Setup') {
steps { script { steps { script {
dir('test/appium') { dir('test/appium') {
@ -27,6 +35,7 @@ pipeline {
} }
} } } }
} }
stage('Test') { stage('Test') {
steps { steps {
withCredentials([ withCredentials([

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.6.3' library 'status-jenkins-lib@v1.6.5'
pipeline { pipeline {
@ -10,16 +10,6 @@ pipeline {
description: 'Name of the branch to checkout and build.', description: 'Name of the branch to checkout and build.',
defaultValue: 'develop', defaultValue: 'develop',
) )
/* Commented to use TEST_MARKERS values from job params
string(
name: 'TEST_MARKERS',
description: 'Marker expression for matching tests to run.',
defaultValue: 'new_ui_critical',
) */
string(
name: 'APK_NAME',
description: 'Filename of APK uploaded to SauceLabs, path, or URL.',
)
string( string(
name: 'PR_ID', name: 'PR_ID',
description: 'ID of the Pull Request triggering this build.', description: 'ID of the Pull Request triggering this build.',
@ -34,6 +24,19 @@ pipeline {
description: 'IDs of the TestRail case, separated by a comma (Optional)', description: 'IDs of the TestRail case, separated by a comma (Optional)',
defaultValue: '', defaultValue: '',
) )
/* FIXME: Remove this no longer relevant argument */
string(
name: 'APK_NAME',
description: 'OBSOLETE ARGUMENT TO BE REMOVED',
defaultValue: 'DUMMY',
)
/* Commented to use TEST_MARKERS values from job params
string(
name: 'TEST_MARKERS',
description: 'Marker expression for matching tests to run.',
defaultValue: 'new_ui_critical',
)
*/
} }
options { options {
@ -41,12 +44,25 @@ pipeline {
} }
stages { stages {
stage('Checks') { stage('Prep') {
steps { script { steps { script {
if (params.APK_NAME == null) { error("APK_NAME parameter not set!") } currentBuild.displayName = "PR-${params.PR_ID}"
if (params.PR_ID == null) { error("PR_ID parameter not set!") } if (params.PR_ID == null) {
error("PR_ID parameter not set!")
}
} } } }
} }
stage('Fetch') {
steps { script { /* WARNING: This copies the latest available artifact. */
copyArtifacts(
projectName: "status-mobile/prs/android-e2e/PR-${params.PR_ID}",
selector: lastWithArtifacts(),
)
apk_path = "${env.PWD}/${utils.findFile('result/*.apk')}"
} }
}
stage('Setup') { stage('Setup') {
steps { script { steps { script {
dir('test/appium') { dir('test/appium') {
@ -54,9 +70,9 @@ pipeline {
} }
} } } }
} }
stage('Test') { stage('Test') {
steps { script { steps { script {
currentBuild.displayName = "PR-${params.PR_ID}"
/* for managing optional arguments */ /* for managing optional arguments */
def extraPytestOpts = '' def extraPytestOpts = ''
if (params.TR_CASE_IDS != '') { if (params.TR_CASE_IDS != '') {
@ -103,7 +119,7 @@ pipeline {
--rerun_count=2 \ --rerun_count=2 \
--testrail_report=True \ --testrail_report=True \
-k \"${params.KEYWORD_EXPRESSION}\" \ -k \"${params.KEYWORD_EXPRESSION}\" \
--apk=${params.APK_NAME} \ --apk=${apk_path} \
--build=PR-${params.PR_ID}-${utils.timestamp()} \ --build=PR-${params.PR_ID}-${utils.timestamp()} \
--pr_number=${params.PR_ID} \ --pr_number=${params.PR_ID} \
${extraPytestOpts} ${extraPytestOpts}

View File

@ -4,12 +4,12 @@ pipeline {
parameters { parameters {
string( string(
name: 'APK_NAME', name: 'APK_URL',
description: 'Filename of APK uploaded to SauceLabs (base for upgrade, usually release build)', description: 'URL of APK to be tested(base for upgrade, usually release build)',
) )
string( string(
name: 'APK_NAME_UPGRADE', name: 'APK_URL_UPGRADE',
description: 'Filename of APK of upgraded application (installed on top of base)', description: 'URL of APK of upgraded application (installed on top of base)',
) )
string( string(
name: 'KEYWORD_EXPRESSION', name: 'KEYWORD_EXPRESSION',
@ -29,6 +29,17 @@ pipeline {
stages { stages {
stage('Prep') {
steps { script {
if (params.APK_URL == null) {
error("APK_URL parameter not set!")
}
if (params.APK_URL_UPGRADE == null) {
error("APK_URL_UPGRADE parameter not set!")
}
} }
}
stage('Setup') { stage('Setup') {
steps { script { steps { script {
dir('test/appium') { dir('test/appium') {
@ -36,6 +47,7 @@ pipeline {
} }
} } } }
} }
stage('Test') { stage('Test') {
steps { script { steps { script {
/* for managing optional arguments */ /* for managing optional arguments */
@ -77,8 +89,8 @@ pipeline {
--numprocesses 4 \ --numprocesses 4 \
--rerun_count=2 \ --rerun_count=2 \
--testrail_report=True \ --testrail_report=True \
--apk=${params.APK_NAME} \ --apk=${params.APK_URL} \
--apk_upgrade=${params.APK_NAME_UPGRADE} \ --apk_upgrade=${params.APK_URL_UPGRADE} \
${extraPytestOpts} ${extraPytestOpts}
""" """
} }