2023-03-25 13:47:31 +01:00
|
|
|
ipeline {
|
2023-03-25 13:40:54 +01:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
2023-03-25 13:47:31 +01:00
|
|
|
stage('Notify') {
|
|
|
|
steps {
|
|
|
|
emailext attachLog: true, attachmentsPattern: 'output.txt', body: "${INPUT_TEXT}", subject: 'Hello World!', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms; tomasz.zietkiewicz@amu.edu.pl'
|
|
|
|
}
|
|
|
|
}
|
2023-03-25 13:40:54 +01:00
|
|
|
}
|
|
|
|
}
|