[workflow] Allow to customize artifactoryBaseUrl for artifacts
PRODX-11849
This reverts commit 5c93cc65e78a7ca35f6434f4af782cf2d0d60756.
Reason for revert: Revork
Change-Id: If5b3098643c945fcf3a16051371d5a06067bfaf7
diff --git a/src/com/mirantis/mk/Workflow.groovy b/src/com/mirantis/mk/Workflow.groovy
index 2bd24ea..8e5d192 100644
--- a/src/com/mirantis/mk/Workflow.groovy
+++ b/src/com/mirantis/mk/Workflow.groovy
@@ -138,15 +138,16 @@
* will be empty.
*
*/
-def storeArtifacts(build_url, step_artifacts, global_variables, job_name, build_num) {
+def storeArtifacts(build_url, step_artifacts, global_variables, job_name, build_num, artifactory_url = '') {
def common = new com.mirantis.mk.Common()
def http = new com.mirantis.mk.Http()
+ if (!artifactory_url) {
+ artifactory_url = 'https://artifactory.mcp.mirantis.net/api/storage/si-local/jenkins-job-artifacts'
+ }
def baseJenkins = [:]
def baseArtifactory = [:]
build_url = build_url.replaceAll(~/\/+$/, "")
- artifactory_url = "https://artifactory.mcp.mirantis.net/api/storage/si-local/jenkins-job-artifacts"
baseArtifactory["url"] = artifactory_url + "/${job_name}/${build_num}"
-
baseJenkins["url"] = build_url
def job_config = http.restGet(baseJenkins, "/api/json/")
def job_artifacts = job_config['artifacts']
@@ -254,7 +255,7 @@
* @param propagate Boolean. If false: allows to collect artifacts after job is finished, even with FAILURE status
* If true: immediatelly fails the pipeline. DO NOT USE 'true' with runScenario().
*/
-def runSteps(steps, global_variables, failed_jobs, jobs_data, step_id, Boolean propagate = false) {
+def runSteps(steps, global_variables, failed_jobs, jobs_data, step_id, Boolean propagate = false, artifactoryBaseUrl = '') {
// Show expected jobs list in description
updateDescription(jobs_data)
@@ -292,7 +293,7 @@
updateDescription(jobs_data)
// Store links to the resulting artifacts into 'global_variables'
- storeArtifacts(build_url, step['artifacts'], global_variables, job_name, build_id)
+ storeArtifacts(build_url, step['artifacts'], global_variables, job_name, build_id, artifactoryBaseUrl)
// Check job result, in case of SUCCESS, move to next step.
// In case job has status NOT_BUILT, fail the build or keep going depending on 'ignore_not_built' flag
@@ -396,8 +397,7 @@
* parameters: dict. parameters name and type to inherit from parent to child job, or from artifact to child job
*/
-def runScenario(scenario, slackReportChannel = '') {
-
+def runScenario(scenario, slackReportChannel = '', artifactoryBaseUrl = '') {
// Clear description before adding new messages
currentBuild.description = ''
// Collect the parameters for the jobs here
@@ -447,7 +447,7 @@
try {
// Run the 'workflow' jobs
- runSteps(scenario['workflow'], global_variables, failed_jobs, jobs_data, step_id)
+ runSteps(scenario['workflow'], global_variables, failed_jobs, jobs_data, step_id, false, artifactoryBaseUrl)
} catch (InterruptedException x) {
error "The job was aborted"
} catch (e) {
@@ -456,7 +456,7 @@
// Switching to 'finally' step index
step_id = finally_step_id
// Run the 'finally' jobs
- runSteps(scenario['finally'], global_variables, failed_jobs, jobs_data, step_id)
+ runSteps(scenario['finally'], global_variables, failed_jobs, jobs_data, step_id, false, artifactoryBaseUrl)
if (failed_jobs) {
statuses = []