ium_487187/Jenkinsfile

81 lines
2.8 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([
string(
defaultValue: '',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
),
password(
defaultValue: '',
2023-03-27 21:48:47 +02:00
description: 'Kaggle token taken from kaggle.json file',
2023-03-27 21:43:16 +02:00
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') {
when { expression { params.KAGGLE_USERNAME && params.KAGGLE_KEY } }
steps {
script {
try {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
sh '''
#!/bin/bash
pip install kaggle
2023-03-27 20:43:35 +02:00
2023-05-10 15:44:36 +02:00
git clone https://git.wmi.amu.edu.pl/s487187/ium_487187.git
2023-03-27 21:19:42 +02:00
2023-03-27 21:43:16 +02:00
echo "Processed Data" > output.txt
'''
2023-05-10 15:44:36 +02:00
sh "head -n ${params.CUTOFF} data.csv"
2023-03-27 22:05:15 +02:00
}
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') {
when { expression { params.KAGGLE_USERNAME && params.KAGGLE_KEY } }
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
}