Zad 04.Docker Konteneryzacja - changes in Jenkinsfile

This commit is contained in:
Cezary Gałązkiewicz 2022-04-11 00:49:21 +02:00
parent 92a55cfc38
commit d1b4ca5675
3 changed files with 14 additions and 27 deletions

View File

@ -1,17 +1,21 @@
FROM ubuntu:latest
ARG KAGGLE_KEY
ARG KAGGLE_USERNAME
ENV KAGGLE_USERNAME=${KAGGLE_USERNAME}
ENV KAGGLE_KEY=${KAGGLE_KEY}
RUN apt update && apt install -y python3-pip
RUN apt install -y unzip python3
RUN pip3 install kaggle pandas seaborn sklearn
RUN mkdir ~/.kaggle/
RUN echo '{"username":"ikami1","key":"c70ff184133bfabb351608b128e76cd2"}' > ~/.kaggle/kaggle.json
RUN mkdir /.kaggle && chmod o+w /.kaggle
WORKDIR /ium
COPY download_dataset.sh process_dataset.py stats.sh Steel_industry_data.csv ./
RUN chmod a+x download_dataset.sh process_dataset.py
RUN chmod a+x download_dataset.sh process_dataset.py stats.sh
#CMD ./download_dataset.sh
#CMD python3 process_dataset.py

View File

@ -10,15 +10,9 @@ pipeline {
)
}
stages {
stage('Checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's470623', url: 'https://git.wmi.amu.edu.pl/s470623/ium_470623.git']]])
}
}
stage('Copy artifacts') {
steps {
copyArtifacts fingerprintArtifacts: true, projectName: 's470623-create-dataset', selector: buildParameter('BUILD_SELECTOR')
sh 'chmod u+x ./stats.sh'
sh './stats.sh'
}
}

View File

@ -1,6 +1,9 @@
pipeline {
agent {
dockerfile true
dockerfile {
additionalBuildArgs '-t ium'
args '-e KAGGLE_USERNAME=${params.KAGGLE_USERNAME} -e KAGGLE_KEY=${params.KAGGLE_KEY}'
}
}
parameters {
string(
@ -19,31 +22,17 @@ pipeline {
description: 'CUTOFF parameter',
name: 'CUTOFF')
}
environment {
KAGGLE_USERNAME="$params.KAGGLE_USERNAME"
KAGGLE_KEY="$params.KAGGLE_KEY"
}
stages {
stage('Test stage') {
steps {
echo 'Hello world! Some test text - added text'
}
}
stage('Checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's470623', url: 'https://git.wmi.amu.edu.pl/s470623/ium_470623.git']]])
}
}
stage('Shell script') {
steps {
sh 'chmod u+x ./download.sh'
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}",
"CUTOFF=${params.CUTOFF}"]) {
sh "./download_dataset.sh"
sh "python3 process_dataset.py"
archiveArtifacts artifacts: "steel_industry_data_test.csv, steel_industry_data_dev.csv, steel_industry_data_train.csv"
}
sh "./download_dataset.sh"
sh "python3 process_dataset.py"
archiveArtifacts artifacts: "steel_industry_data_test.csv, steel_industry_data_dev.csv, steel_industry_data_train.csv", onlyIfSuccessful: true
}
}
}