diff --git a/Dockerfile b/Dockerfile index eb57ed5..225bd03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Jenkinsfile_stats b/Jenkinsfile_stats index 781ea90..c2d3d4e 100644 --- a/Jenkinsfile_stats +++ b/Jenkinsfile_stats @@ -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' } } diff --git a/jenkinsfile b/jenkinsfile index 88dada2..05c70ad 100644 --- a/jenkinsfile +++ b/jenkinsfile @@ -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 } } }