How do I get the “parentNumber” in my jenkins pipeline?

56 views
Skip to first unread message

red 888

unread,
Aug 22, 2018, 6:36:09 PM8/22/18
to Jenkins Users

Using the artifactory plugin.


When I rebuild a jenkins job and deploy to jfrog, I see this in the build info json: 

enter image description here


Super useful to me and I cant find how to get that in the jenkins pipeline anywhere- its the job from which it was rebuilt.

So when I rebuild a job from an old build this value is the number of the build I rebuilt it from.


How do I get that in my pipeline? I look in the build info object but its not there:

def artifactory = Artifactory.server 'myserver.jfrog.io'
def buildInfo = Artifactory.newBuildInfo()
echo buildInfo.dump()

How does the plugin even get this info? Its no where in the env vars I can find and I havent seen any examples of how to get it.

Jan Monterrubio

unread,
Aug 22, 2018, 8:50:18 PM8/22/18
to jenkins...@googlegroups.com
The variables come from: https://wiki.jenkins.io/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-belowJenkinsSetEnvironmentVariables , I believe what you have is BUILD_NUMBER.

They're probably passed into the plugin.

Would you be able to get the file located at BUILDINFO_PROPFILE? I found this in the changelog:

"
Build-info exports an environment variable 'BUILDINFO_PROPFILE' with the location of the generated build info properties file"



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5ad01da6-f7fb-450b-bff9-8a831121e69c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

red 888

unread,
Aug 22, 2018, 11:19:41 PM8/22/18
to Jenkins Users
Im not sure where that file is, but im more interested in _how_ they get that value. How can you get the build number of the job you rebuild from?

It looks like they're using the build cause to get that build number? Does the build cause have the build number of the "parent" job I run rebuild from?
Reply all
Reply to author
Forward
0 new messages