diff --git a/Jenkinsfile b/Jenkinsfile index acef5e1..240b913 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,25 +1,41 @@ node { - stage('Preparation') { - properties([ - parameters([ - string( - defaultValue: 'Hello World!', - description: 'Tekst do wyświetlenie', - name: 'INPUT_TEXT', - trim: false - ) - ]) - ]) - } - stage('Hello') { - //Wypisz wartość parametru w konsoli (To nie jest polecenie bash, tylko groovy!) - echo "INPUT_TEXT: ${INPUT_TEXT}" - //Wywołaj w konsoli komendę "figlet", która generuje ASCI-art - sh "figlet \"${INPUT_TEXT}\" | tee output.txt" - } - stage('Goodbye') { - echo 'Goodbye!' - //Zarchiwizuj wynik - archiveArtifacts 'output.txt' + stage('Preparation') { + properties([ + parameters([ + string( + defaultValue: 'lukkoz2', + 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: Check out from version control') { + checkout([$class: 'GitSCM', + branches: [[name: '*/master']], + extensions: [], + userRemoteConfigs: [[credentialsId: 's425850', url: 'https://git.wmi.amu.edu.pl/s425850/ium_425850']]]) + } + + +stage('Build') { + // Run the maven build + withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", + "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { + sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME' + sh 'kaggle datasets list' + sh 'chmod u+x ./get_dataset.sh' + sh './get_dataset.sh' + } + stage('Save data into artifacts') { + archiveArtifacts artifacts: 'books_edited.csv', followSymlinks: false } + } } \ No newline at end of file diff --git a/get_dataset.sh b/get_dataset.sh new file mode 100644 index 0000000..ae06c21 --- /dev/null +++ b/get_dataset.sh @@ -0,0 +1,3 @@ +kaggle datasets download -d dylanjcastillo/7k-books-with-metadata +unzip -o 7k-books-with-metadata.zip +cut -d ',' -f 1,2,4,7,8 --complement books.csv > books_edited.csv