Search code examples
groovyjenkins-pipelineartifactoryjenkins-groovy

Groovy syntax - uploading artifacts


For uploading artifacts, with given uploadSpec,

1) Below code

server.upload(uploadSpec)

does not upload the artifacts

2) Below code

server.upload spec: uploadSpec

upload the artifacts


From syntax perspective, I can understand the first case, where uploadSpec is passed as argument to server.upload() method

How to understand syntax? server.upload spec: uploadSpec, failNoOp: true


Solution

  • The second syntax is the equivalent of: server.upload([spec: uploadSpec]). That is call upload on server and pass a map. The map has a single key "spec" and its value is uploadSpec. For your third example, its still a map, but with two keys ("spec" and "failNoOp")