-
Bug
-
Resolution: Fixed
-
Minor
-
Jenkins 2.187, Pipeline:Groovy plugin 2.7.2, Artifactory Plugin 2.16.2
-
-
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
- causes
-
JENKINS-59108 Artifactory plugin can't publish build info for Gradle builds
-
- Open
-
- links to
[JENKINS-58643] CPS Mismatches on cpsScript.InvokeMethod
Labels | New: pipeline |
Issue Type | Original: Improvement [ 4 ] | New: Bug [ 1 ] |
Component/s | New: artifactory-plugin [ 15689 ] |
For what it's worth, the Templating Engine Plugin had almost the exact same issue where objects created and injected into the binding were throwing CPS Mismatch warnings.
we're refactoring anything placed in the binding that's going to be invoking methods to be CPS transformed before being placed injected.
After doing this - the only CpsMismatch warnings we got were around metaprogramming examples such as using InvokerHelper to invoke methods, or by taking advantage of groovy's methodMissing functionality.
those use cases are being addressed in https://github.com/cloudbees/groovy-cps/pull/99