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

CPS Mismatches on cpsScript.InvokeMethod

    Details

    • Similar Issues:

      Description

      Hello,

      Following the introduction of a new warning log message in version 2.7.1 of the Pipeline:Groovy plugin, we are now receiving types of the following warning in builds using the Artifactory Plugin:

      expected to call org.jfrog.hudson.pipeline.common.types.ArtifactoryServer.upload but wound up catching artifactoryUpload
      

      The pipeline API supported by the Artifactory plugin creates objects, on which methods can be invoked.
      For example:

      def server = Artifactory.server 'my-server'
      server.upload ...
      

      Notice that the 'server' object allows executing the 'artifactoryUpload' step.
      This OOP style is very convenient and allows reusing code and configuration. This approach received very positive feedbacks since it was introduced.
      Currently however, this is achieved by having the 'server' instance store the CpsScript, so that it can be used to invoke the step (by using 'cpsScript.invokeMethod').

      The Artifactory pipeline API is available for a few years already and has become extremely popular.
      We would appreciate your advice on how to change the plugin in a way that will both satisfy the CPS guidelines without breaking its current functionality and structure.

      Alternatively, the usage of cpsScript.invokeMethod could be added as an exception to the cps mismatch report, similar to the proposed addition in this PR.

      Thank you

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            No, to the patch in the comment by Devin Nusbaum in 2019-08-01.

            Show
            jglick Jesse Glick added a comment - No, to the patch in the comment by Devin Nusbaum in 2019-08-01.
            Hide
            robinino Robi Nino added a comment -

            Hi Jesse Glick and Devin Nusbaum,
            I opened #314 with Devin's suggestion.
            The patch solves our issue, workflow-cps-plugin tests are passing.
            Thanks!

            Show
            robinino Robi Nino added a comment - Hi Jesse Glick and Devin Nusbaum , I opened #314 with Devin's suggestion. The patch solves our issue, workflow-cps-plugin tests are passing. Thanks!
            Hide
            robertw Robert Wedd added a comment -

            Do we know when to expect the fix to come in i see #314 is failing 

            Show
            robertw Robert Wedd added a comment - Do we know when to expect the fix to come in i see  #314  is failing 
            Hide
            jakemroz Jake Mroz added a comment -

            We are seeing this issue in Jenkins 2.176.3, Artifactory Plugin 3.4.0, Groovy Plugin 2.74:

             

            expected to call org.jfrog.hudson.pipeline.common.types.ArtifactoryServer.promote but wound up catching artifactoryPromoteBuild; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
            Show
            jakemroz Jake Mroz added a comment - We are seeing this issue in Jenkins 2.176.3, Artifactory Plugin 3.4.0, Groovy Plugin 2.74:   expected to call org.jfrog.hudson.pipeline.common.types.ArtifactoryServer.promote but wound up catching artifactoryPromoteBuild; see: https: //jenkins.io/redirect/pipeline-cps-method-mismatches/
            Hide
            hwhopema Ward Hopeman added a comment -

            We are also seeing this on Jenkins v2.190.1; Artifactory plugin v3.40; Groovy plugin v2.2
            artifactoryUploadexpected to call org.jfrog.hudson.pipeline.common.types.ArtifactoryServer.upload but wound up catching artifactoryUpload; see:
             

            Show
            hwhopema Ward Hopeman added a comment - We are also seeing this on Jenkins v2.190.1; Artifactory plugin v3.40; Groovy plugin v2.2 artifactoryUploadexpected to call org.jfrog.hudson.pipeline.common.types.ArtifactoryServer.upload but wound up catching artifactoryUpload; see:  

              People

              • Assignee:
                Unassigned
                Reporter:
                robinino Robi Nino
              • Votes:
                3 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated: