diff --git a/Dockerfile b/Dockerfile index 18b24f0..8f940a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,6 @@ WORKDIR ./app COPY ./get_dataset.py ./ COPY ./get_stats.py ./ -COPY ./train.py ./ +COPY training/train.py ./ COPY predict.py ./ CMD bash \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 3b583c2..de571dc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -49,21 +49,4 @@ pipeline { archiveArtifacts artifacts: 'dataset.csv,df_train.csv,df_test.csv', onlyIfSuccessful: true } } - stage("Prediction") { - agent { - dockerfile { - filename 'Dockerfile' - reuseNode true - } - } - - steps { - sh "chmod +x ./train.py" - sh "chmod +x ./predict.py" - sh "python ./train.py" - sh "python ./predict.py" - archiveArtifacts artifacts: 'model.keras,predictions.txt', onlyIfSuccessful: true - } - } - } } diff --git a/training/Jenkinsfile b/training/Jenkinsfile new file mode 100644 index 0000000..8f118a7 --- /dev/null +++ b/training/Jenkinsfile @@ -0,0 +1,36 @@ +pipeline { + agent any + parameters { + buildSelector ( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'BUILD_SELECTOR' + ) + } + stages { + stage('Checkout repository') { + steps { + checkout scm + } + } + stage('Copy artifacts') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 'z-s464980-create-dataset', selector: buildParameter('BUILD_SELECTOR') + } + } + stage("Training") { + agent { + dockerfile { + filename 'Dockerfile' + reuseNode true + } + } + + steps { + sh "chmod +x ./train.py" + sh "python ./train.py" + archiveArtifacts artifacts: 'model.keras', onlyIfSuccessful: true + } + } + } +} diff --git a/train.py b/training/train.py similarity index 100% rename from train.py rename to training/train.py