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

Copy Artifact copying files when shouldn't and parameter filter errors

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • copyartifact-plugin
    • Jenkins: 2.107.3
      Plugin: 1.39.1
      OS: CentOS release 6.9
      Apache Tomcat/9.0.8
    • n/a

      I have 2 Freestyle jobs that each create a series of files/subdirs/files.  I have updated these jobs to set Permission to Copy Artifact for my 3rd job.  I have added Archive the artifacts as a Post Build Action for the Mac_job and have specified the files I want archived.  I have the desired files in the workspace of the Win_job as an experiment to see if either configuration works better than the other.  This part appears to be working fine for both build jobs, and the resulting artifacts are being stored in their archive directories:

       

      ~/.jenkins/jobs/Mac_job/lastSuccessful/archive/release
      ~/.jenkins/workspace/Win_job/release

       

      I have a 3rd job (deploy_job) that needs to pull in the artifacts from the other two jobs into its workspace so that it can stage the files to other locations.  The job is parameterized with 2 boolean parameters (MAC_RELEASE, WIN_RELEASE), each to align with one of the "upstream" jobs.  Note that this is not a pipeline job though.

      I've added two build steps - Copy artifacts from another project, and have set them to the other project names.  The first one for the Mac_job is using Latest successful build.  The second one for the Win_job is using Copy from WORKSPACE of latest completed build.  They're different merely because I haven't gotten either configuration to work and have been experimenting. I have specified the Artifacts to copy (release/**), have provided a separate Target directory in the deploy_job for each copy task and have set a Parameter filter for each copy task using the associated boolean parameter, like so:

      MAC_RELEASE=true    <–for the Mac_job
      WIN_RELEASE=true     <–for the Win_job

      I do have the Fingerprint Artifacts selected, though not really sure what this step does.  In my Post-build Actions, I use Flexible publish plugin, and if the boolean resolves to true, it takes the files in the deploy_job Target directory(ies) and copies them to another system.  But from the console log it doesn't look like it even gets this far in the job as it errors out trying to copy  the artifacts from the other projects into the workspace.  If I run the deploy_job checking both boolean parameters in the Build with Parameters, it appears to error at trying to locate the Mac_job build artifact directory. The complete console output:

      Building on master in workspace ~/.jenkins/workspace/deploy_job
      Run condition [Boolean condition] enabling prebuild for step [[Send build artifacts over SSH]]
      Run condition [Boolean condition] enabling prebuild for step [[Send build artifacts over SSH]]
      No emails were triggered.
      ERROR: Unable to find a build for artifact copy from: Mac_job
      [Boolean condition] checking [true] against [^(1|y|yes|t|true|on|run)$] (origin token: ${MAC_RELEASE})
      Run condition [Boolean condition] enabling perform for step [[Send build artifacts over SSH]]
      SSH: Current build result is [FAILURE], not going to run.
      [Boolean condition] checking [true] against [^(1|y|yes|t|true|on|run)$] (origin token: ${WIN_RELEASE})
      Run condition [Boolean condition] enabling perform for step [[Send build artifacts over SSH]]
      SSH: Current build result is [FAILURE], not going to run.
      Email was triggered for: Failure - Any
      Sending email for trigger: Failure - Any
      An attempt to send an e-mail to empty list of recipients, ignored.
      Finished: FAILURE

      From the output it appears that it fails the job because it is unable to map to the lastSuccessful link on the Mac_job.  But what's more confusing is if I run the deploy_job with only having the WIN_RELEASE boolean parameter checked, it still looks like it's trying to find the Mac_job build artifacts for some reason. Though the boolean value says it's preventing the step from being performed, there is still the error in attempting to locate the build artifacts.  But it shouldn't be trying to locate any source or files because the parameter was set to false.

      Building on master in workspace /opt/app/ngt/support/.jenkins/workspace/deploy_job
      Run condition [Boolean condition] enabling prebuild for step [[Send build artifacts over SSH]]
      Run condition [Boolean condition] enabling prebuild for step [[Send build artifacts over SSH]]
      No emails were triggered.
      ERROR: Unable to find a build for artifact copy from: Mac_job
      [Boolean condition] checking [false] against [^(1|y|yes|t|true|on|run)$] (origin token: ${MAC_RELEASE})
      Run condition [Boolean condition] preventing perform for step [[Send build artifacts over SSH]]
      [Boolean condition] checking [true] against [^(1|y|yes|t|true|on|run)$] (origin token: ${WIN_RELEASE})
      Run condition [Boolean condition] enabling perform for step [[Send build artifacts over SSH]]
      SSH: Current build result is [FAILURE], not going to run.
      Email was triggered for: Failure - Any
      Sending email for trigger: Failure - Any
      An attempt to send an e-mail to empty list of recipients, ignored.
      Finished: FAILURE

      None of the output is in line with what I am used to seeing in console logs, and I'm not sure if it's the Copy Artifacts plugin that is generating the Run condition lines at the top of the output? So either the Which build and/or Parameter filters components are not working in the Copy artifacts plugin, or the documentation is misleading on how to use these components for this plugin.

       

       

          [JENKINS-57241] Copy Artifact copying files when shouldn't and parameter filter errors

          Kim Abbott added a comment -

          I looked at the system logs too and there was nothing noteworthy there to add.

          Kim Abbott added a comment - I looked at the system logs too and there was nothing noteworthy there to add.

          Kim Abbott added a comment - - edited

          Now that I've read the console output for the millionth time, I believe what it's representing is that the first two "Run conditions" in the log are from the Copy Artifacts build steps implying that the Copy Artifacts was resolving to true for both the MAC_RELEASE and WIN_RELEASE parameters, even when the MAC_RELEASE was not checked, and that may explain why it still shows it attempting (in error) to locate the build for artifacts to copy. 

          The latter Run conditions are from the Post Build Actions where the Flexible Publisher is evaluating whether to run the Send build artifacts over SSH tasks.  This part appears to be working correctly and is correctly evaluating the boolean parameter values, but since the build step failed the post build step won't run.

          Kim Abbott added a comment - - edited Now that I've read the console output for the millionth time, I believe what it's representing is that the first two "Run conditions" in the log are from the Copy Artifacts build steps implying that the Copy Artifacts was resolving to true for both the MAC_RELEASE and WIN_RELEASE parameters, even when the MAC_RELEASE was not checked, and that may explain why it still shows it attempting (in error) to locate the build for artifacts to copy.  The latter Run conditions are from the Post Build Actions where the Flexible Publisher is evaluating whether to run the Send build artifacts over SSH tasks.  This part appears to be working correctly and is correctly evaluating the boolean parameter values, but since the build step failed the post build step won't run.

          Kim Abbott added a comment - - edited

          So encountered a weird sort of success and failure at the same time.  I changed the evaluation string for the booleans to this (which doesn't match the documentation at all):

          Parameter filters: ${MAC_RELEASE}
          Parameter filters: ${WIN_RELEASE}

          To run the job, my build parameters were checked for the WIN_RELEASE boolean but not checked for the MAC_RELEASE boolean.  For some reason, the changes to the boolean evaluation above somehow enabled the job to find the build for artifacts to copy (success! but I have no idea why and seems like a bug) but it copied the artifacts for the Mac_job even though that boolean parameter evaluated to false, so it shouldn't have copied anything for that build, So that still seems like a bug.  Fortunately the Publish actions didn't push the updated files as it correctly evaluated the boolean, but my workspace files were overwritten with updated Mac_job files which I didn't want.
          Building on master in workspace ~/.jenkins/workspace/deploy_job
          Run condition [Boolean condition] enabling prebuild for step [[Send build artifacts over SSH]]
          Run condition [Boolean condition] enabling prebuild for step [[Send build artifacts over SSH]]
          No emails were triggered.
          Copied 456 artifacts from "Mac_job" build number 196
          Copied 270 artifacts from "Win_job" build number 233
          [Boolean condition] checking [false] against [^(1|y|yes|t|true|on|run)$] (origin token: ${MAC_RELEASE})
          Run condition [Boolean condition] preventing perform for step [[Send build artifacts over SSH]]
          [Boolean condition] checking [true] against [^(1|y|yes|t|true|on|run)$] (origin token: ${WIN_RELEASE})
          Run condition [Boolean condition] enabling perform for step [[Send build artifacts over SSH]]
          SSH: Connecting from host [jenkins.ngt.com]
          SSH: Connecting with configuration [tws.ngtlab.net (dev2) tomcat] ...
          SSH: Disconnecting configuration [tws.ngtlab.net (dev2) tomcat] ...
          SSH: Transferred 270 file(s)
          No emails were triggered.
          Finished: SUCCESS
           

          Kim Abbott added a comment - - edited So encountered a weird sort of success and failure at the same time.  I changed the evaluation string for the booleans to this (which doesn't match the documentation at all): Parameter filters: ${MAC_RELEASE} Parameter filters: ${WIN_RELEASE} To run the job, my build parameters were checked for the WIN_RELEASE boolean but not checked for the MAC_RELEASE boolean.  For some reason, the changes to the boolean evaluation above somehow enabled the job to find the build for artifacts to copy (success! but I have no idea why and seems like a bug) but it copied the artifacts for the Mac_job even though that boolean parameter evaluated to false, so it shouldn't have copied anything for that build, So that still seems like a bug.  Fortunately the Publish actions didn't push the updated files as it correctly evaluated the boolean, but my workspace files were overwritten with updated Mac_job files which I didn't want. Building on master in workspace ~/.jenkins/workspace/deploy_job Run condition [Boolean condition] enabling prebuild for step [ [Send build artifacts over SSH] ] Run condition [Boolean condition] enabling prebuild for step [ [Send build artifacts over SSH] ] No emails were triggered. Copied 456 artifacts from "Mac_job" build number 196 Copied 270 artifacts from "Win_job" build number 233 [Boolean condition] checking [false] against [^(1|y|yes|t|true|on|run)$] (origin token: ${MAC_RELEASE}) Run condition [Boolean condition] preventing perform for step [ [Send build artifacts over SSH] ] [Boolean condition] checking [true] against [^(1|y|yes|t|true|on|run)$] (origin token: ${WIN_RELEASE}) Run condition [Boolean condition] enabling perform for step [ [Send build artifacts over SSH] ] SSH: Connecting from host [jenkins.ngt.com] SSH: Connecting with configuration [tws.ngtlab.net (dev2) tomcat] ... SSH: Disconnecting configuration [tws.ngtlab.net (dev2) tomcat] ... SSH: Transferred 270 file(s) No emails were triggered. Finished: SUCCESS  

          ikedam added a comment -

          Though it’s really difficult to see what’s the actual problem you’re facing as your description is really long and looks describing unrelated things, it sounds that your problem is that “Copy Artifact is run unexpectedly though you’re expecting it’s controlled with parameter values”.

          You looks confuse the parameter filter feature of Copy Artifact plugin and the condition defined with Conditional Buildstep plugin and Run Condition plugin.
          The parameter filter feature of Copy Artifact plugin filters builds to copy from, and don’t skip the step itself.
          From the console output, Conditional Buildstep is applied to "Send build artifacts over SSH".

          Please reconfigure your project and put Copy Artifact under Conditional Buildstep.

          If that doesn’t resolve your problem, please reopen this ticked with information to how to reproduce the problem with least steps in a new Jenkins instance.

          ikedam added a comment - Though it’s really difficult to see what’s the actual problem you’re facing as your description is really long and looks describing unrelated things, it sounds that your problem is that “Copy Artifact is run unexpectedly though you’re expecting it’s controlled with parameter values”. You looks confuse the parameter filter feature of Copy Artifact plugin and the condition defined with Conditional Buildstep plugin and Run Condition plugin. The parameter filter feature of Copy Artifact plugin filters builds to copy from, and don’t skip the step itself. From the console output, Conditional Buildstep is applied to "Send build artifacts over SSH". Please reconfigure your project and put Copy Artifact under Conditional Buildstep. If that doesn’t resolve your problem, please reopen this ticked with information to how to reproduce the problem with least steps in a new Jenkins instance.

          Kim Abbott added a comment -

          I think you are absolutely correct.  Thank you for the comment and sorry it has taken me so long to send you thanks.

          Kim Abbott added a comment - I think you are absolutely correct.  Thank you for the comment and sorry it has taken me so long to send you thanks.

            rupunzlkim Kim Abbott
            rupunzlkim Kim Abbott
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: