From c467dc04b05c2a01da34087d83e45f6c4027fca5 Mon Sep 17 00:00:00 2001 From: "bartosz.maslanka.consultant" Date: Fri, 21 Apr 2023 15:56:43 +0200 Subject: [PATCH] jen --- Dockerfile | 14 ++++++++++++++ Jenkinsfile | 41 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a207441 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:latest +RUN apt-get update \ + && apt-get install -y git python3 python3-pip curl \ + && curl -O https://bootstrap.pypa.io/get-pip.py \ + && python3 get-pip.py --user \ + && rm get-pip.py \ + && pip3 install --user kaggle \ + && pip3 install --user pandas \ + && pip3 install --user seaborn \ + && pip3 install --user scikit-learn +ENV PATH="/root/.local/bin:$PATH" +WORKDIR /app +COPY . /app +CMD ["python", "create_dataset.py"] \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 2e732b0..625e1fa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,11 +1,42 @@ pipeline { - agent any - stages { - stage('Stage 1') { + stages { + stage('Preparation') { + properties([ + parameters([ + string( + defaultValue: 'tomaszzitkiewicz', + description: 'Kaggle username', + name: 'KAGGLE_USERNAME', + trim: false + ), + password( + defaultValue: '', + description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials', + name: 'KAGGLE_KEY' + ) + ]) + ]) + } + stage('Checkout') { steps { - echo 'Hello world!' + git branch: 'master', url: 'https://git.wmi.amu.edu.pl/s487184/ium_487184' + } + } + + stage('Run Script') { + steps { + withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", + "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { + sh 'kaggle datasets download -d elakiricoder/gender-classification-dataset > output.txt' + + } + } + } + + stage('Archive Artifacts') { + steps { + archiveArtifacts 'output.txt' } } } } -