I have a question about declarative script syntax.
I have a multi-stage job, where each stage runs on a separate agent. Whether the job passes or fails, I want to archive some artefacts from the job, so I have to call archiveArtifacts from post::cleanup().
stages {
stage(‘S1’) {
agent { label “A” }
steps {
<snip>
}
stage(‘S2’) {
agent { label “B” }
steps {
<snip>
}
}
post {
cleanup{ archiveArtifacts artifacts: '*.zip'}
}
My problem is that I want to archive the artifacts from a specific agent (i.e. a specific stage). How would I do that?
Best regards
David
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAJK_iej6MzrtnHg-hf5p9SjsrHaNvJEDxkb3os6bdpTrRby4SQ%40mail.gmail.com.
Thanks, but that doesn't address my situation where I have stages running on different agents and I want to archive results from a specific agent.
stages {
stage(‘S1’) {
agent { label “A” }
steps {
<snip>
}
post {
xxx
}
stage(‘S2’) {
agent { label “B” }
steps {
<snip>
}
}
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAJK_ieiVXUnjR6r9F2aKxzU1pwXNwHQrRuuVZQ%2BVO-u4S3c0eg%40mail.gmail.com.
> Did you try to write post after stage?
It seems that is not allowed:
WorkflowScript: 140: Expected a stage @ line 140, column 9.
post{
^--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAJK_ieg04QKY5270TySAx9yf%3DPkucOrOCQAHM2i8nscK8%3D2moA%40mail.gmail.com.
>Syntax is like this https://code-maven.com/slides/jenkins-intro/pipeline-post
Thank you. That has fixed my problem.
David