ium_487187/Jenkinsfile

90 lines
3.3 KiB
Plaintext
Raw Normal View History

2023-03-27 21:43:16 +02:00
pipeline {
2023-04-04 19:23:40 +02:00
agent {
dockerfile {
filename 'Dockerfile'
args '-u root:root'
2023-04-04 19:37:59 +02:00
registryUrl 'https://hub.docker.com/repository/docker/s487187/ium'
2023-04-04 19:23:40 +02:00
}
}
2023-03-27 21:43:16 +02:00
stages {
2023-04-04 19:23:40 +02:00
stage('Preparation') {
2023-03-27 21:43:16 +02:00
when { expression { true } }
steps {
script {
try {
properties([
parameters([
2023-05-10 16:04:37 +02:00
// string(
// defaultValue: '',
// description: 'Kaggle username',
// name: 'KAGGLE_USERNAME',
// trim: false
// ),
// password(
// defaultValue: '',
// description: 'Kaggle token taken from kaggle.json file',
// name: 'KAGGLE_KEY'
// ),
2023-03-27 22:10:49 +02:00
string(
defaultValue: '50',
description: 'number of examples in dataset',
name: 'CUTOFF'
2023-03-27 21:43:16 +02:00
)
])
])
} catch (err) {
error "Failed to set up parameters: ${err.message}"
}
}
}
}
stage('Build') {
2023-05-10 16:07:56 +02:00
//when { expression { params.KAGGLE_USERNAME && params.KAGGLE_KEY } }
2023-03-27 21:43:16 +02:00
steps {
script {
try {
2023-05-10 16:10:11 +02:00
// withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
// "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
// sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
// sh '''
// #!/bin/bash
// pip install kaggle
// git clone https://git.wmi.amu.edu.pl/s487187/ium_487187.git
// echo "Processed Data" > output.txt
// '''
// sh "head -n ${params.CUTOFF} data.csv"
// }
2023-05-10 16:04:37 +02:00
sh '''
2023-05-10 16:10:11 +02:00
#!/bin/bash
pip install kaggle
git clone https://git.wmi.amu.edu.pl/s487187/ium_487187.git
2023-03-27 21:19:42 +02:00
2023-05-10 16:10:11 +02:00
echo "Processed Data" > output.txt
'''
2023-05-10 16:04:37 +02:00
sh "head -n ${params.CUTOFF} data.csv"
2023-03-27 21:43:16 +02:00
} catch (err) {
error "Failed to build: ${err.message}"
}
}
}
2023-03-27 21:22:53 +02:00
}
2023-03-27 20:54:26 +02:00
2023-03-27 21:43:16 +02:00
stage('End') {
2023-05-10 16:10:11 +02:00
// when { expression { params.KAGGLE_USERNAME && params.KAGGLE_KEY } }
2023-03-27 21:43:16 +02:00
steps {
echo 'Program ended!'
}
}
2023-04-04 20:11:59 +02:00
2023-04-04 20:09:47 +02:00
stage('Archive Artifact') {
steps {
2023-04-04 19:39:35 +02:00
archiveArtifacts 'output.txt'
}
2023-03-27 21:33:08 +02:00
}
2023-03-27 20:43:35 +02:00
}
2023-05-10 15:44:36 +02:00
}