• workflow-cps 2.75

      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

          [JENKINS-58643] CPS Mismatches on cpsScript.InvokeMethod

          Can you please be more specific? What does simplifying the plugin and making it more normal mean? How can we maintain the existing APIs and avoid this warning message? 

          Eyal Ben Moshe added a comment - Can you please be more specific? What does simplifying the plugin and making it more normal mean? How can we maintain the existing APIs and avoid this warning message? 

          dnusbaum and jglick,

          Can we perhaps add support for an optional variable, which can be set by pipeline steps, to indicate the step name? This should resolve the "false mismatch warning" issue.

          Many pipelines out there are built and reply on the Artifactory pipeline APIs, so the solution we come up with cannot break the APIs. We'd be glad to create a PR, but we first need to know you're okay with this approach.

          Looking forward to your feedback. Thanks!

          Eyal Ben Moshe added a comment - dnusbaum and jglick , Can we perhaps add support for an optional variable, which can be set by pipeline steps, to indicate the step name? This should resolve the "false mismatch warning" issue. Many pipelines out there are built and reply on the Artifactory pipeline APIs, so the solution we come up with cannot break the APIs. We'd be glad to create a PR, but we first need to know you're okay with this approach. Looking forward to your feedback. Thanks!

          Jesse Glick added a comment -

          The patch above seems like the safest and more general fix, if it indeed works. Needs testing.

          Jesse Glick added a comment - The patch above seems like the safest and more general fix, if it indeed works. Needs testing.

          jglick,

          To which patch are you referring to? Is it my above suggestion? If so, we'll start working on a pull request.

          Eyal Ben Moshe added a comment - jglick , To which patch are you referring to? Is it my above suggestion? If so, we'll start working on a pull request.

          Jesse Glick added a comment -

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

          Jesse Glick added a comment - No, to the patch in the comment by dnusbaum in 2019-08-01.

          Robi Nino added a comment -

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

          Robi Nino added a comment - Hi jglick and dnusbaum , I opened #314 with Devin's suggestion. The patch solves our issue, workflow-cps-plugin tests are passing. Thanks!

          Robert Wedd added a comment -

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

          Robert Wedd added a comment - Do we know when to expect the fix to come in i see  #314  is failing 

          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/

          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/

          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:
           

          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:  

          Devin Nusbaum added a comment -

          A fix for this issue was just released in Pipeline: Groovy Plugin version 2.75.

          Devin Nusbaum added a comment - A fix for this issue was just released in Pipeline: Groovy Plugin version 2.75.

            Unassigned Unassigned
            robinino Robi Nino
            Votes:
            3 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved: