From a4ef4af18219326d12fcdc6d34652b4299f0e087 Mon Sep 17 00:00:00 2001 From: Adrian Charkiewicz Date: Tue, 3 May 2022 22:12:13 +0200 Subject: [PATCH] second multibranch pipeline --- Jenkinsfile | 6 +++--- Jenkinsfile2 | 14 ++++++++------ Jenkinsfile_evaluation | 32 ++++++++++++++++++++++++++++++++ Jenkinsfile_stats | 23 +++++++++++++++++++++++ Jenkinsfile_training | 28 ++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 Jenkinsfile_evaluation create mode 100644 Jenkinsfile_stats create mode 100644 Jenkinsfile_training diff --git a/Jenkinsfile b/Jenkinsfile index a8d1896..4b4783a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,9 +29,9 @@ pipeline { stages { stage("Check out from version control") { steps { - checkout scm - } - } + checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's444354', url: 'https://git.wmi.amu.edu.pl/s444354/ium_444354.git']]]) + } + } stage("Shell Script") { steps { sh "chmod u+x ./script.sh" diff --git a/Jenkinsfile2 b/Jenkinsfile2 index ca2238f..1b1e6d9 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -1,21 +1,23 @@ pipeline { agent { - dockerfile true + dockerfile {image 'ksero/ium:pytorch'} } - parameters{ + + /* parameters{ buildSelector( defaultSelector: lastSuccessful(), name: 's444354-create-dataset', description: 'Which build to use for copying artifacts' ) + }*/ + - } stages { stage("Check out from version control") { - steps { - checkout scm - } + steps { + checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's444354', url: 'https://git.wmi.amu.edu.pl/s444354/ium_444354.git']]]) + } } stage("Shell Script") { steps { diff --git a/Jenkinsfile_evaluation b/Jenkinsfile_evaluation new file mode 100644 index 0000000..9698f44 --- /dev/null +++ b/Jenkinsfile_evaluation @@ -0,0 +1,32 @@ +pipeline { + agent { + docker { image 's444507_create_dataset_image:latest' } + } + parameters { + buildSelector(defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts.', name: 'BUILD_SELECTOR') + gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH' + + } + stages { + stage('Get arifacts') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 's444507-create-dataset', selector: buildParameter('BUILD_SELECTOR') + copyArtifacts fingerprintArtifacts: true, projectName: '444507-training/${BRANCH}', selector: buildParameter('BUILD_SELECTOR') + copyArtifacts fingerprintArtifacts: true, projectName: 's444507-evaluation/master', selector: buildParameter('BUILD_SELECTOR'), optional: true + } + } + stage('Run evaluation') { + steps { + sh "python3 ./lab06_evaluation.py ${currentBuild.number}" + } + } + } + post { + success { + archiveArtifacts artifacts: 'metrics.*', followSymlinks: false + } + always { + emailext body: "${currentBuild.currentResult}", subject: 's444507-evaluation', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' + } + } +} \ No newline at end of file diff --git a/Jenkinsfile_stats b/Jenkinsfile_stats new file mode 100644 index 0000000..6b6e104 --- /dev/null +++ b/Jenkinsfile_stats @@ -0,0 +1,23 @@ +pipeline { + agent { + docker { image 's444354_create_dataset_image:latest' } + } + stages { + stage('Get arifacts') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 's44354-create-dataset', selector: lastSuccessful() + } + } + stage('Show stats') { + steps { + sh "python3 ./data_processing.py" + sh "python3 ./pytorch/pytorch.py" + } + } + } + post { + success { + archiveArtifacts artifacts: 'result.txt', followSymlinks: false + } + } +} \ No newline at end of file diff --git a/Jenkinsfile_training b/Jenkinsfile_training new file mode 100644 index 0000000..a0366e3 --- /dev/null +++ b/Jenkinsfile_training @@ -0,0 +1,28 @@ +pipeline { + agent { + docker { image 's444354_create_dataset_image:latest' } + } + parameters { + string(name: 'epoch', defaultValue: '1000', description: 'Number of epochs to train model.') + } + stages { + stage('Get arifacts') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 's444354-create-dataset', selector: lastSuccessful() + } + } + stage('Show stats') { + steps { + sh "python3 ./pytorch/pytorch.py $epoch" + } + } + } + post { + success { + archiveArtifacts artifacts: 'pytorch/result.txt', followSymlinks: false + } + always { + emailext body: "${currentBuild.currentResult}", subject: 's444354-training', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' + } + } +} \ No newline at end of file