From 980ab556548a84b2215a7697d67c4faf0d7dab7e Mon Sep 17 00:00:00 2001 From: Tomasz Koszarek Date: Fri, 30 Jun 2023 00:28:27 +0200 Subject: [PATCH] Add 'Jenkinsfile_create_dataset' --- Jenkinsfile_create_dataset | 78 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Jenkinsfile_create_dataset diff --git a/Jenkinsfile_create_dataset b/Jenkinsfile_create_dataset new file mode 100644 index 0000000..66fbdc0 --- /dev/null +++ b/Jenkinsfile_create_dataset @@ -0,0 +1,78 @@ +pipeline { + agent any + //Definijuemy parametry, które będzie można podać podczas wywoływania zadania + parameters { + string ( + defaultValue: 'kaggletests', + 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' + ) + string( + defaultValue: '0', + description: 'CUTOFF', + name: 'CUTOFF', + trim: false + ) + + } + stages { + stage('clear_all') { + steps { + //Wypisz wartość parametru w konsoli (To nie jest polecenie bash, tylko groovy!) + sh 'rm -rf *' + } + } + stage('checkout') { + steps { + //Wypisz wartość parametru w konsoli (To nie jest polecenie bash, tylko groovy!) + sh 'git clone https://git.wmi.amu.edu.pl/s487174/ium_z487174' + } + } + + + stage('Build') { + steps { + // Run the maven build + withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", + "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { + print 'DEBUG: parameter isFoo = ' + params.KAGGLE_KEY + sh "export KAGGLE_USERNAME=${params.KAGGLE_USERNAME}" + sh "export KAGGLE_KEY=${params.KAGGLE_KEY}" + // sh 'kaggle datasets download -d bartoszpieniak/poland-cars-for-sale-dataset' + // sh 'unzip archive.zip -d ./ium_z487174' + + } + } + } + stage('BuildDocker') { + steps { + //Wypisz wartość parametru w konsoli (To nie jest polecenie bash, tylko groovy!) + sh 'mkdir ./results' + sh 'echo $KAGGLE_KEY' + sh 'docker build -t datasets:1.0 ./ium_z487174' + // sh 'pip3 install -r ./ium_z487174/requirements.txt' + // sh 'python3 ./ium_z487174/dataset.py' + } + } + stage('RunDocker') { + steps { + sh "docker run -e KAGGLE_USERNAME=$KAGGLE_USERNAME -e KAGGLE_KEY=$KAGGLE_KEY -v /var/lib/jenkins/workspace/z-s487174-create-dataset/results:/app/results datasets:1.0" + + } + } + stage('Goodbye!') { + steps { + echo 'Goodbye!' + //Zarchiwizuj wynik + //archiveArtifacts 'output.txt' + archiveArtifacts 'results/train_data.csv, results/dev_data.csv, results/test_data.csv' + } + } + } +} \ No newline at end of file