2024-08-24 07:17:23 +00:00
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
stages {
|
|
|
|
stage('Build') {
|
|
|
|
steps {
|
2024-08-24 07:34:32 +00:00
|
|
|
sh 'echo "sample artifact change" > artifact.txt'
|
2024-08-24 07:17:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Save user') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
def username = currentBuild.getBuildCauses().find { it._class == 'hudson.model.Cause$UserIdCause' }?.userId
|
|
|
|
writeFile file: 'user.txt', text: username
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Archive artifacts') {
|
|
|
|
steps {
|
|
|
|
archiveArtifacts artifacts: '**/artifact.txt, user.txt'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|