Reputation: 1523
I publish the BuildInfo to Artifactory using:
def buildInfo = Artifactory.newBuildInfo()
/* Set artifact properties */
buildInfo.env.capture = true
buildInfo.env.collect()
// Publish the build to Artifactory
server.upload spec: uploadSpec, buildInfo: buildInfo
I would like to retrieve the four property assigned to artifacts in Artifactory. I see properties being set such as build.name, build.number, build.timestamp, and vcs.revision
I can get the build number and name using:
def buildName = buildInfo.name
def buildNumber = buildInfo.number
How would I go about to retrieve the timestamp and vcs.number from the BuildInfo so that I can do a REST call and post the same four properties to a folder I create in Artifactory.
Upvotes: 2
Views: 876
Reputation: 1523
I installed Jenkins Build Timestamp Plugin and used this UTC pattern "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
In my groovy file, I added these two commands:
time=Date.parse("yyyy-MM-dd'T'HH:mm:ss.SSSZ", BUILD_TIMESTAMP)
epoch_milis = time.getTime()
Upvotes: 0