0

I'm using declarative pipeline as Jenkins job. Stages 'Build' and 'Archive' run both in parallel to build and gather artifacts from nodes of different platforms (linux 32 & 64, windows, etc...)

Unfortunately, the artifacts are all of the same name. I cannot archive multiple mylib.so in a single pipeline job. Or can I?

Well, in the case of Windows the library will be a .dll and so there is a difference, but that cannot be an overall solution to this.

Is there a way to distinguish between artifacts built by several nodes?

My pipeline looks similar to this:

pipeline {
    agent none
    stages {
        stage('Build') {
            parallel {
                stage('Build on some Linux x64') {
                    agent { node { label 'linux_64' } }
                    steps {
                        // call make
                    }
                }
                stage('Build some more...') { ... }
            }
        }
        stage('Archive') {
            parallel {
                stage('Archive from Linux x64') {
                    agent { node { label 'linux_64' } }
                    steps {
                        archive includes: 'out/*.so'
                    }
                }
                stage('Archive some more...') { ... }
            }
        }
    }
}

I've also seen this, so there may be nothing directly out-of-the-box.

qdbp
  • 109
  • 1
  • 1
  • 12

1 Answers1

0

About to face the same issue...

You can use the stash and unstash to move files between folders and nodes (Google unstashing into other directories). In which case stash your output for each platform, and add a final stage which unstashes each into separate folders. Then finally archive the lot to make it available after the build is complete.

There are variations on this, and of course you could have the build itself output to platform/architecture specific folders.

simon.watts
  • 976
  • 10
  • 14