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

CPS Mismatches on cpsScript.InvokeMethod

XMLWordPrintable

    • 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

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

              Created:
              Updated:
              Resolved: