This commit is contained in:
Wojciech Lidwin 2023-05-11 17:46:02 +02:00
commit 727d3f071b
2 changed files with 19 additions and 5 deletions

17
Jenkinsfile vendored
View File

@ -25,16 +25,25 @@ node {
stage('checkout: Check out from version control') { stage('checkout: Check out from version control') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's487197', url: 'https://git.wmi.amu.edu.pl/s487197/ium_487197']]]) checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's487197', url: 'https://git.wmi.amu.edu.pl/s487197/ium_487197']]])
} }
stage('Dockerfile'){
def testImage = docker.image("ium")
sh "chmod +x -R ${env.WORKSPACE}"
testImage.inside("""-w=${WORKSPACE} """){
stage('Shell Script') { stage('Shell Script') {
// 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}",
"CUTOFF=${params.CUTOFF}" ]) { "CUTOFF=${params.CUTOFF}" ]) {
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME' sh "export KAGGLE_KEY=$KAGGLE_USERNAME"
sh 'chmod u+x ./download_dataset.sh' sh "export KAGGLE_KEY=$KAGGLE_KEY"
sh './download_dataset.sh' sh '''echo KAGGLE_USERNAME: $KAGGLE_USERNAME'''
sh "kaggle datasets download -d sohier/crime-in-baltimore"
sh "unzip crime-in-baltimore.zip"
sh 'python3 data.py'
archiveArtifacts artifacts: 'BPD_Part_1_Victim_Based_Crime_Data.csv,baltimore_train.csv, baltimore_test.csv, baltimore_dev.csv' archiveArtifacts artifacts: 'BPD_Part_1_Victim_Based_Crime_Data.csv,baltimore_train.csv, baltimore_test.csv, baltimore_dev.csv'
} }
}
}
} }
} }

View File

@ -3,14 +3,19 @@ node {
stage('checkout: Check out from version control') { stage('checkout: Check out from version control') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's487197', url: 'https://git.wmi.amu.edu.pl/s487197/ium_487197']]]) checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's487197', url: 'https://git.wmi.amu.edu.pl/s487197/ium_487197']]])
} }
stage('Docker build'){
docker.image('s487197/ium:1').inside {
stage('copyArtifact') { stage('copyArtifact') {
copyArtifacts fingerprintArtifacts: true, projectName: 's487197-create-dataset', selector: lastSuccessful() copyArtifacts fingerprintArtifacts: true, projectName: 's487197-create-dataset', selector: lastSuccessful()
} }
stage('Shell Script') { stage('Shell Script') {
sh 'chmod u+x ./stats.sh' sh 'chmod u+x ./stats.sh'
sh './stats.sh' sh './stats.sh'
}
} }
stage('archiveArtifacts') { stage('archiveArtifacts') {
archiveArtifacts artifacts: 'stats.txt' archiveArtifacts artifacts: 'stats.txt'
} }
} }
}