update Jenkinsfile

This commit is contained in:
Łukasz Koziej 2023-04-05 14:48:14 +02:00
parent d35b412b36
commit df16f5b271

98
Jenkinsfile vendored
View File

@ -1,52 +1,56 @@
node { node {
stage('Preparation') { def dockerImage = docker.build("lukkoz2")
properties([
parameters([ dockerImage.inside {
string( stage('Preparation') {
defaultValue: 'lukkoz2', properties([
description: 'Kaggle username', parameters([
name: 'KAGGLE_USERNAME', string(
trim: false defaultValue: 'lukkoz2',
), description: 'Kaggle username',
password( name: 'KAGGLE_USERNAME',
defaultValue: '', trim: false
description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials', ),
name: 'KAGGLE_KEY' password(
), defaultValue: '',
string( description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials',
defaultValue: '6000', name: 'KAGGLE_KEY'
description: 'Number of positions to be saved', ),
name: 'CUTOFF', string(
trim: false defaultValue: '6000',
) description: 'Number of positions to be saved',
]) name: 'CUTOFF',
]) trim: false
} )
])
])
}
stage('checkout: Check out from version control') { stage('checkout: Check out from version control') {
checkout([$class: 'GitSCM', checkout([$class: 'GitSCM',
branches: [[name: '*/master']], branches: [[name: '*/master']],
extensions: [], extensions: [],
userRemoteConfigs: [[credentialsId: 's425850', url: 'https://git.wmi.amu.edu.pl/s425850/ium_425850']]]) userRemoteConfigs: [[credentialsId: 's425850', url: 'https://git.wmi.amu.edu.pl/s425850/ium_425850']]])
} }
stage('Build') { stage('Build') {
// Run the maven build // Run the maven build
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME' sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
sh 'chmod u+x ./get_dataset.sh' sh 'chmod u+x ./get_dataset.sh'
sh './get_dataset.sh' sh './get_dataset.sh'
} }
} }
stage('Cut data') { stage('Cut data') {
withEnv(["CUTOFF=${params.CUTOFF}"]) { withEnv(["CUTOFF=${params.CUTOFF}"]) {
sh '''head -n $((CUTOFF)) books_edited.csv > books_edited_cut.csv'''} sh '''head -n $((CUTOFF)) books_edited.csv > books_edited_cut.csv'''}
} }
stage('Save data into artifacts') { stage('Save data into artifacts') {
archiveArtifacts artifacts: 'books_edited.csv', followSymlinks: false archiveArtifacts artifacts: 'books_edited.csv', followSymlinks: false
}
} }
} }