From a0ccb6e3bd6248d7f10b1870b0ebebe2871d6be6 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Thu, 5 May 2022 23:28:25 +0200 Subject: [PATCH] Add git build selector --- Jenkinsfile-eval | 13 +++++++++++-- Jenkinsfile-train | 8 +++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile-eval b/Jenkinsfile-eval index 753f699..6aef2c7 100644 --- a/Jenkinsfile-eval +++ b/Jenkinsfile-eval @@ -4,6 +4,15 @@ pipeline { image 's444409-create-dataset' } } + + parameters { + gitParameter branchFilter: 'origin/(.*)', defaultValue: 'main', name: 'BRANCH', type: 'PT_BRANCH' + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'BUILD_SELECTOR' + ) + } environment { NOTIFICATION_ADDRESS = 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' @@ -17,12 +26,12 @@ pipeline { } stage('Get model trend') { steps { - copyArtifacts projectName: 's444409-training/main/', selector: lastSuccessful(), optional: true + copyArtifacts projectName: "s444409-training/${params.BRANCH}/", selector: buildParameter('BUILD_SELECTOR'), optional: true } } stage('Get previous trend') { steps { - copyArtifacts projectName: 's444409-evaluation/main/', selector: lastSuccessful(), optional: true + copyArtifacts projectName: "s444409-evaluation/${params.BRANCH}/", selector: buildParameter('BUILD_SELECTOR'), optional: true } } stage('Evaluate model and write results to file') { diff --git a/Jenkinsfile-train b/Jenkinsfile-train index 92d5fcf..8a09238 100644 --- a/Jenkinsfile-train +++ b/Jenkinsfile-train @@ -12,6 +12,12 @@ pipeline { name: 'EPOCHS', trim: true ) + gitParameter branchFilter: 'origin/(.*)', defaultValue: 'main', name: 'BRANCH', type: 'PT_BRANCH' + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'BUILD_SELECTOR' + ) } agent { @@ -29,7 +35,7 @@ pipeline { stage('Archive model and evaluate it') { steps { archiveArtifacts artifacts: 'model_out', onlyIfSuccessful: true - build job: 's444409-evaluation/main/' + build job: "s444409-evaluation/${params.BRANCH}/" } } }