Skip to content

[JENKINS-66825] CopyArtifacts does not copy from sub module with parameter filter #553

Description

@jenkins-infra-bot

I have Maven Project Job to build мulti module maven project (for example https://github.com/anatoly-spb/multi-module-maven-project ) with string parameter BUILD_PARAMETER (sandbox-multimodule-maven-project-build-with-param)

I want to copy artifacts for specified module with parameter filters: BUILD_PARAMETER=test from the sandbox-multimodule-maven-project-build-with-param job.

I have created the simplest pipeline:

pipeline {
    agent any

    stages {
stage('Copy') {
    steps {
copyArtifacts filter: '**/*.jar', fingerprintArtifacts: true, flatten: true, parameters: 'BUILD_PARAMETER=copy', projectName: 'sandbox-multimodule-maven-project-build-with-param/ru.rlisystems$module1', selector: lastSuccessful()
    }
}
    }
}

which fails with:

Running on Jenkins in D:\Jenkins\jobs\sandbox-multimodule-maven-project-copyartifact-pipeline\workspace
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Copy)
[Pipeline] copyArtifacts
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Unable to find a build for artifact copy from: sandbox-multimodule-maven-project-build-with-param/ru.rlisystems$module1
Finished: FAILURE

If I remove the module1 submodule from project name:

pipeline {
    agent any

    stages {
stage('Copy') {
    steps {
copyArtifacts filter: '**/*.jar', fingerprintArtifacts: true, flatten: true, parameters: 'BUILD_PARAMETER=copy', projectName: 'sandbox-multimodule-maven-project-build-with-param', selector: lastSuccessful()
    }
}
    }
}

everything is fine:

[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in D:\Jenkins\jobs\sandbox-multimodule-maven-project-copyartifact-pipeline\workspace
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Copy)
[Pipeline] copyArtifacts
Copied 1 artifact from "sandbox-multimodule-maven-project-build-with-param » module1" build number 3
Copied 1 artifact from "sandbox-multimodule-maven-project-build-with-param » module2" build number 3
Copied 0 artifacts from "sandbox-multimodule-maven-project-build-with-param » root" build number 3
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

I expect that the CopyArtifact plugin will process correctly submodule project name which allowed by the documentation:

The name of the project to copy artifacts from.

Maven projects:
Artifacts from all modules will be copied. Enter JOBNAME/MODULENAME here to copy from a particular module; you may copy/paste this from the URL for that module when browsing Jenkins.
Example: MyMavenJob/my.group$MyModule

Thank you for your time!


Originally reported by anatolys, imported from: CopyArtifacts does not copy from sub module with parameter filter
  • status: Open
  • priority: Major
  • component(s): copyartifact-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20260107-133739
Raw content of original issue

I have Maven Project Job to build мulti module maven project (for example https://github.com/anatoly-spb/multi-module-maven-project ) with string parameter BUILD_PARAMETER (sandbox-multimodule-maven-project-build-with-param)

I want to copy artifacts for specified module with parameter filters: BUILD_PARAMETER=test from the sandbox-multimodule-maven-project-build-with-param job.

I have created the simplest pipeline:

pipeline {
    agent any

    stages {
        stage('Copy') {
            steps {
                copyArtifacts filter: '**/*.jar', fingerprintArtifacts: true, flatten: true, parameters: 'BUILD_PARAMETER=copy', projectName: 'sandbox-multimodule-maven-project-build-with-param/ru.rlisystems$module1', selector: lastSuccessful()
            }
        }
    }
}

which fails with:

Running on Jenkins in D:\Jenkins\jobs\sandbox-multimodule-maven-project-copyartifact-pipeline\workspace
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Copy)
[Pipeline] copyArtifacts
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Unable to find a build for artifact copy from: sandbox-multimodule-maven-project-build-with-param/ru.rlisystems$module1
Finished: FAILURE

If I remove the module1 submodule from project name:

pipeline {
    agent any
stages {
    stage('Copy') {
        steps {
            copyArtifacts filter: '**/*.jar', fingerprintArtifacts: true, flatten: true, parameters: 'BUILD_PARAMETER=copy', projectName: 'sandbox-multimodule-maven-project-build-with-param', selector: lastSuccessful()
        }
    }
}

}

everything is fine:

[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in D:\Jenkins\jobs\sandbox-multimodule-maven-project-copyartifact-pipeline\workspace
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Copy)
[Pipeline] copyArtifacts
Copied 1 artifact from "sandbox-multimodule-maven-project-build-with-param » module1" build number 3
Copied 1 artifact from "sandbox-multimodule-maven-project-build-with-param » module2" build number 3
Copied 0 artifacts from "sandbox-multimodule-maven-project-build-with-param » root" build number 3
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

I expect that the CopyArtifact plugin will process correctly submodule project name which allowed by the documentation:

The name of the project to copy artifacts from.

Maven projects:
Artifacts from all modules will be copied. Enter JOBNAME/MODULENAME here to copy from a particular module; you may copy/paste this from the URL for that module when browsing Jenkins.
Example: MyMavenJob/my.group$MyModule

Thank you for your time!

environment
Jenkins 2.289.1<br/>
org.jenkins-ci.plugins:copyartifact:1.46.1

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions