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

CopyArtifacts does not copy from sub module with parameter filter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • copyartifact-plugin
    • None
    • Jenkins 2.289.1
      org.jenkins-ci.plugins:copyartifact:1.46.1

      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!

            Unassigned Unassigned
            anatolys Anatoly Shirokov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: