ci/e2e: make copying of nightly artifacts work

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Churikova Tetiana 2023-02-08 15:51:57 +01:00 committed by Jakub Sokołowski
parent b1d4368154
commit c4264462b1
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
6 changed files with 26 additions and 12 deletions

View File

@ -8,6 +8,8 @@ pipeline {
disableConcurrentBuilds()
/* Prevent Jenkins jobs from running forever */
timeout(time: 40, unit: 'MINUTES')
/* Allow copying of artifacts from this job. */
copyArtifactPermission('/status-mobile/e2e/*')
/* Limit builds retained */
buildDiscarder(logRotator(
numToKeepStr: '10',

View File

@ -1,3 +1,5 @@
library 'status-jenkins-lib@v1.6.5'
pipeline {
agent { label 'linux' }
@ -18,13 +20,17 @@ pipeline {
disableConcurrentBuilds()
}
stages {
stage('Prep') {
stage('Fetch') {
when { expression { !params.APK_URL } }
steps { script {
if (params.PR_ID == null) {
error("PR_ID parameter not set!")
}
copyArtifacts(
projectName: "status-mobile/nightly",
filter: '*-x86.apk',
/* WARNING: This copies the latest available artifact. */
selector: lastWithArtifacts(),
)
apk_path = "${env.WORKSPACE}/${utils.findFile('*-x86.apk')}"
} }
}
@ -73,7 +79,7 @@ pipeline {
-m testrail_id \
-m \"new_ui_critical or new_ui_medium\" \
-k \"${params.KEYWORD_EXPRESSION}\" \
--apk=${params.APK_NAME}
--apk=${params.APK_URL ?: apk_path}
"""
}
}

View File

@ -14,6 +14,10 @@ pipeline {
name: 'PR_ID',
description: 'ID of the Pull Request triggering this build.',
)
string(
name: 'APK_URL',
description: 'Optional, set if job require APK to be downloaded from URL.',
)
string(
name: 'KEYWORD_EXPRESSION',
description: 'This will run tests which contain names that match the given string expression (Optional)',
@ -54,9 +58,11 @@ pipeline {
}
stage('Fetch') {
steps { script { /* WARNING: This copies the latest available artifact. */
when { expression { !params.APK_URL } }
steps { script {
copyArtifacts(
projectName: "status-mobile/prs/android-e2e/PR-${params.PR_ID}",
/* WARNING: This copies the latest available artifact. */
selector: lastWithArtifacts(),
)
apk_path = "${env.WORKSPACE}/${utils.findFile('result/*.apk')}"
@ -119,7 +125,7 @@ pipeline {
--rerun_count=2 \
--testrail_report=True \
-k \"${params.KEYWORD_EXPRESSION}\" \
--apk=${apk_path} \
--apk=${params.APK_URL ?: apk_path} \
--build=PR-${params.PR_ID}-${utils.timestamp()} \
--pr_number=${params.PR_ID} \
${extraPytestOpts}

View File

@ -1,3 +1,5 @@
library 'status-jenkins-lib@v1.6.5'
pipeline {
agent { label 'linux' }

View File

@ -108,9 +108,9 @@ class BaseTestReport:
return url
@staticmethod
def get_jenkins_link_to_rerun_e2e(branch_name="develop", pr_id="", apk_name="", tr_case_ids=""):
def get_jenkins_link_to_rerun_e2e(branch_name="develop", pr_id="", tr_case_ids=""):
return 'https://ci.status.im/job/status-mobile/job/e2e/job/status-app-prs-rerun/parambuild/' \
'?BRANCH_NAME=%s&APK_NAME=%s&PR_ID=%s&TR_CASE_IDS=%s' % (branch_name, apk_name, pr_id, tr_case_ids)
'?BRANCH_NAME=%s&PR_ID=%s&TR_CASE_IDS=%s' % (branch_name, pr_id, tr_case_ids)
def get_sauce_final_screenshot_url(self, job_id):
return 'https://media.giphy.com/media/9M5jK4GXmD5o1irGrF/giphy.gif'

View File

@ -71,13 +71,11 @@ class GithubHtmlReport(BaseTestReport):
if not_executed_tests:
html += "<li><a href=\"%s\">Rerun not executed tests</a></li>" % self.get_jenkins_link_to_rerun_e2e(
pr_id=pr_id,
apk_name=apk_name,
tr_case_ids=','.join([str(i) for i in tests]))
if failed_tests:
html += "<li><a href=\"%s\">Rerun failed tests</a></li>" % self.get_jenkins_link_to_rerun_e2e(
pr_id=pr_id,
apk_name=apk_name,
tr_case_ids=','.join([str(test.testrail_case_id) for test in tests]))
if not not_executed_tests: