Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-44148

Add ability to have artifacts with the same name in parallel pipeline stages

    Details

    • Similar Issues:

      Description

      I have a pipeline script that runs parallel builds and captures artifacts from each build. The artifacts all have the same name and path. The pipeline syntax doesn't offer a way to namespace these artifacts or bundle particular builds together so they don't overwrite each other. Here's a snippet of my script that should reproduce the problem.

      pipeline {
          agent none
          stages {
              stage("Build/Test") {
                  steps {
                      script {
                          def builds = [:]
                          
                          for (def config in ["debug", "default", "opt"]) {
                                  def config_inside = "${config}"
                                  
                                  builds["${config_inside}"] = {
                                      node ("node001") {
                                          stage("Build Test ${config_inside}") {
                                              sh "$HOME/software/jenkins_scripts/nightly.sh ${config_inside} gnu yes $WORKSPACE"
                                              junit allowEmptyResults: true, testResults: 'test/mpi/summary.junit.xml'
                                              archiveArtifacts 'filtered-make.txt,c.txt,**/config.log,m.txt,mi.txt,test/mpi/summary.junit.xml'
                                          }
                                      }
                                  }
                              }
                          }
                          
                          parallel builds
                      }
                  }
              }
          }
      }
      

        Attachments

          Activity

          Hide
          enbabe Abe S added a comment -

          Still a problem with Jenkins 2.204.2, Pipeline 2.6. This is a bit of a deal breaker at the moment. I am using a matrix build with declarative pipeline like so:

          pipeline {
            agent any
            stages {
              stage('Build') {
                matrix {
                  agent { dockerfile true }
                  axes {
                    axis {
                      name 'AREA'
                      values 'dev', 'test', 'prod'
                    }
                  }
                  stages {
                    stage('Build') {
                      steps {
                        sh "AREA=${AREA}"
                        sh 'mvn clean install package'
                      }
                    }
                  }
                  post {
                    always{
                      archiveArtifacts artifacts: '**/target/rpm/**/*.rpm'
                    }
                  }
                }
              }
            }
          }
          

           

          Show
          enbabe Abe S added a comment - Still a problem with Jenkins 2.204.2, Pipeline 2.6. This is a bit of a deal breaker at the moment. I am using a matrix build with declarative pipeline like so: pipeline { agent any stages { stage( 'Build' ) { matrix { agent { dockerfile true } axes { axis { name 'AREA' values 'dev' , 'test' , 'prod' } } stages { stage( 'Build' ) { steps { sh "AREA=${AREA}" sh 'mvn clean install package ' } } } post { always{ archiveArtifacts artifacts: '**/target/rpm /**/ *.rpm' } } } } } }  
          Hide
          tallguy Jeremy Viehland added a comment -

          Workaround might be (ugh) to make a copy with a unique name and archive that instead. That's what I'm going to try.

          Show
          tallguy Jeremy Viehland added a comment - Workaround might be (ugh) to make a copy with a unique name and archive that instead. That's what I'm going to try.

            People

            • Assignee:
              Unassigned
              Reporter:
              wbland Wesley Bland
            • Votes:
              7 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated: