Update 'Jenkinsfile-create-dataset'

This commit is contained in:
Marcin Rostkowski 2023-04-19 19:10:17 +02:00
parent 828dc01960
commit 466be13232

View File

@ -1,29 +1,38 @@
pipeline {
agent any
//Definijuemy parametry, które będzie można podać podczas wywoływania zadania
parameters {
string (
defaultValue: 'Hello World!',
description: 'Tekst, którym chcesz przywitać świat',
name: 'INPUT_TEXT',
trim: false
)
}
stages {
stage('Hello') {
steps {
//Wypisz wartość parametru w konsoli (To nie jest polecenie bash, tylko groovy!)
echo "INPUT_TEXT: ${INPUT_TEXT}"
//Wywołaj w konsoli komendę "figlet", która generuje ASCI-art
sh "figlet \"${INPUT_TEXT}\" | tee output.txt"
}
}
stage('Goodbye!') {
steps {
echo 'Goodbye!'
//Zarchiwizuj wynik
archiveArtifacts 'output.txt'
}
}
}
agent any
environment {
KAGGLE_TOKEN = credentials('kaggle-token')
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Install Kaggle CLI') {
steps {
sh 'pip install kaggle'
}
}
stage('Run Shell Script') {
steps {
sh 'chmod +x script.sh'
withCredentials([string(credentialsId: 'kaggle-token', variable: 'KAGGLE_TOKEN')]) {
sh 'echo $KAGGLE_TOKEN > ~/.kaggle/kaggle.json'
sh 'chmod 600 ~/.kaggle/kaggle.json'
}
sh './script.sh'
}
}
stage('Archive Artifacts') {
steps {
archiveArtifacts artifacts: 'output.txt', fingerprint: true
}
}
}
}