Hello everyone

I'm using Jenkins Pipeline to construct some continuous integration thingy.

I'm currently trying to trigger an existing job and take in the generated
artifacts in the current job's workspace.

The following works fine:

    pipeline {
        agent {
            label 'builder-rpm'
        }

        options {
            timestamps()
            ansiColor('xterm')
        }

        stages {
            stage('Build Other pipeline') {
                steps {
                    build job: 'Components/components-rpm-build', parameters: [
                        string(name: 'Component', value: 'libewnotify'),
                        string(name: 'TargetDistro', value: 'el7'),
                        string(name: 'RepoServer', value: '')
                    ]
                    copyArtifacts(
                        filter: 'results/*.rpm',
                        fingerprintArtifacts: true,
                        flatten: true,
                        projectName: 'Components/components-rpm-build',
                        selector: lastSuccessful(),
                        target: "${env.WORKSPACE}/dist"
                    )
                }
            }
        }
    }

The problem of it is that lastSuccessful() will take indeed the last
successful build, meaning that if some other user manages to run a parallel
build faster than me, I'm going to take in their artifacts instead of mine.

According to the "Copy Artifact" page at
https://wiki.jenkins.io/display/JENKINS/Copy+Artifact+Plugin
there should be a way to use a specific job, with `specific`:

    def built = build('downstream');
    copyArtifacts(projectName: 'downstream',
                  selector: specific("${downstream.number}"));

There's however no explanation nor examlpe on how to use it in a declarative
pipeline.

Any hint?

Thanks in advance for any help.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/p7688k%24i9r%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to