From f4a0241079e8409e33d18641b27c59b735069414 Mon Sep 17 00:00:00 2001 From: AdamOsiowy123 Date: Wed, 4 May 2022 19:27:40 +0200 Subject: [PATCH] fix --- Jenkins/Jenkinsfile.evaluation | 16 ++++++++-------- Jenkins/Jenkinsfile.training | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Jenkins/Jenkinsfile.evaluation b/Jenkins/Jenkinsfile.evaluation index 3b2f72d..eb6bb16 100644 --- a/Jenkins/Jenkinsfile.evaluation +++ b/Jenkins/Jenkinsfile.evaluation @@ -12,10 +12,10 @@ node { name: 'BRANCH', type: 'PT_BRANCH' ), - string( - defaultValue: "0", - description: 'BUILD_NR', - name: 'BUILD_NR' + buildSelector( + defaultSelector: upstream(), + description: 'Which build to use for copying artifacts', + name: 'BUILD_SELECTOR' ), string( defaultValue: ".,14000,1,50,100", @@ -30,15 +30,15 @@ node { copyArtifacts filter: 'test_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset' git branch: "${params.BRANCH}", url: 'https://git.wmi.amu.edu.pl/s444452/ium_444452.git' copyArtifacts filter: 'neural_network_evaluation.csv', projectName: "s444452-evaluation/${BRANCH}/", optional: true - copyArtifacts filter: 'model/neural_net', projectName: "s444452-training/${BRANCH}/" + copyArtifacts filter: 'model/neural_net', projectName: "s444452-training/${BRANCH}/", selector: buildParameter('BUILD_SELECTOR') } stage('Run script') { - withEnv(["TEST_PARAMS=${params.TEST_PARAMS}"]) { - sh "python3 Scripts/evaluate_neural_network.py ${params.BUILD_NR} $TEST_PARAMS" + withEnv(["TEST_PARAMS=${params.TEST_PARAMS}", "BUILD_NR=${params.BUILD_SELECTOR}"]) { + sh "python3 Scripts/evaluate_neural_network.py $BUILD_NR $TEST_PARAMS" } } stage('Archive artifacts') { - archiveArtifacts "neural_network_evaluation.csv, evaluation.png" + archiveArtifacts "neural_network_evaluation.csv, evaluation.png", onlyIfSuccessful: true } } } catch (e) { diff --git a/Jenkins/Jenkinsfile.training b/Jenkins/Jenkinsfile.training index a6b2814..3b8c01c 100644 --- a/Jenkins/Jenkinsfile.training +++ b/Jenkins/Jenkinsfile.training @@ -41,7 +41,7 @@ def notifyBuild(String buildStatus = 'STARTED') { def details = "Build nr: ${env.BUILD_NUMBER}, status: ${buildStatus} \n url: ${env.BUILD_URL} \n build params: ${params.TRAIN_PARAMS}" if (buildStatus == 'SUCCESS') { - build job: 's444452-evaluation', parameters: [gitParameter(name: "BRANCH", value: "${env.BRANCH_NAME}"), string(name: "TEST_PARAMS", value: "${params.TRAIN_PARAMS}"), string(name: "BUILD_NR", value: "${env.BUILD_NR}")], wait: false + build job: 's444452-evaluation/master', parameters: [string(name: "TEST_PARAMS", value: "${params.TRAIN_PARAMS}")], wait: false } emailext (