35 lines
870 B
Groovy
35 lines
870 B
Groovy
pipeline {
|
|
agent {
|
|
dockerfile {
|
|
args '-u root --privileged'
|
|
}
|
|
}
|
|
parameters {
|
|
string (
|
|
defaultValue: 'my_username',
|
|
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/blob/main/docs/README.md#api-credentials',
|
|
name: 'KAGGLE_KEY'
|
|
)
|
|
}
|
|
stages {
|
|
stage('Test') {
|
|
steps {
|
|
script {
|
|
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", "KAGGLE_KEY=${params.KAGGLE_KEY}"]) {
|
|
sh 'set +x'
|
|
sh 'echo "{\"username\":\"$KAGGLE_USERNAME\",\"key\":\"$KAGGLE_KEY\"}" > ~/.kaggle/kaggle.json'
|
|
sh 'set -x'
|
|
sh 'kaggle datasets list'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|