anonymously132526
anonymously132526

Reputation: 177

Jenkinsfile pipeline to store artifacts to jfrog artifactory with sha checksum in filename

how do I store (Archive stage) artifacts to artifactory post jenkins build with SHA5 checksum in filename?

E.g. What I want as filename stored on artifactory:
sha__2340ursoddpkjfsodfj0429trjw0fjosdfkjsao90024r.h
Artifactory checksum SHA-1: 2340ursoddpkjfsodfj0429trjw0fjosdfkjsao90024r

def server = Artifactory.server 'my-jfrog-artifactoryserver'
def uploadSp = """{
  "files": [
    {
      "pattern": "*.h",
      "target": "builds/myhfiles/"
    }
  ]
}"""


node('h-builder')
{
 {
        stage ('Archive')
        {
            archiveArtifacts artifacts: '**/*.h', fingerprint: true
            server.upload spec: uploadSp, failNoOp: true
        }
 }
}

Upvotes: 0

Views: 718

Answers (1)

yahavi
yahavi

Reputation: 6063

You can try using Placeholders for this:

{
  "files": [
    {
      "pattern": "(*).h",
      "target": "builds/myhfiles/{1}"
    }
  ]
}

Read more about File Specs greatness here and there.

Plugin documentation here.

Upvotes: 1

Related Questions