简体   繁体   中英

Fail Jenkins build when zero artifacts uploaded into artifactory

I need my Jenkins build to fail in case zero artifacts are uploaded into the artifactory.

I have included failNoOp into my upload spec but it seems it's not working in my Jenkinsfile. Here is my code:

def server = Artifactory.newServer url: env.ArtifactoryServerTEST, credentialsId:'ArtifactoryUATServerKey'
server.bypassProxy = true                   
def uploadSpec = """{
    "files": [
        {
            "pattern": "final_artifacts/*.gz",
            "target": "test/"
        }
    ]
}"""

server.upload spec: uploadSpec, failNoOp: true

This needs to fail my build if none of the artifacts are uploaded into the artifactory, but it is giving me this error:

java.lang.IllegalArgumentException: Only the following arguments are allowed, [spec, buildInfo]

I'm using Artifactory OSS Version 6.2.0. anyone can help me on this?

As @yahavi mentioned, I could fix this problem by upgrade the artifactory plugin. I updated to the latest, so as at now current latest version is 3.3.2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM