Programmatically access Jenkins URL field?

126 views
Skip to first unread message

Peter Miklosko

unread,
Apr 11, 2013, 9:25:19 AM4/11/13
to jenkin...@googlegroups.com

How can I programmatically access Jenkins URL field that is configured through Manage Jenkins > Configure System > Jenkins Location?

I tried Computer.currentComputer().getUrl() but returns only computer/(master)/

Esteban Angee

unread,
Apr 11, 2013, 9:35:23 AM4/11/13
to jenkin...@googlegroups.com
Is this what you are looking for?

JenkinsLocationConfiguration globalConfig = new JenkinsLocationConfiguration();
globalConfig.getUrl()

Kind Regards,


On 04/11/2013 08:25 AM, Peter Miklosko wrote:

How can I programmatically access Jenkins URL field that is configured through Manage Jenkins > Configure System > Jenkins Location?

I tried Computer.currentComputer().getUrl() but returns only computer/(master)/

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
Esteban Angee Agudelo
Software Engineer
hello2morrow S.A.S
(574)5804555
esteba...@hello2morrow.com
http://www.hello2morrow.com

Peter Miklosko

unread,
Apr 11, 2013, 9:44:56 AM4/11/13
to jenkin...@googlegroups.com
Yes indeed!

Thank you Esteban

Cheers 

Peter

PS: If you reply to this question you can even get some points ;) http://stackoverflow.com/questions/15949946/programatically-access-jenkins-url


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/kTpbJpW6s3I/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.

Jesse Glick

unread,
Apr 11, 2013, 11:25:09 AM4/11/13
to jenkin...@googlegroups.com
On 04/11/2013 09:25 AM, Peter Miklosko wrote:
> How can I programmatically access Jenkins URL field that is configured through Manage Jenkins > Configure System > Jenkins Location?

Beware that most of the time if you are asking this question you are doing something wrong.

https://wiki.jenkins-ci.org/display/JENKINS/Hyperlinks+in+HTML

Peter Miklosko

unread,
Apr 11, 2013, 11:30:39 AM4/11/13
to jenkin...@googlegroups.com
I'm open to discussion.
At the moment I use it to build URL (HOSTNAME/job/JOB_NAME/BUILD_NUMBER/api/json?wrapper=changes&xpath=//changeSet) to be able to query for change log through JSON.

So is there any other better way to get hold of change log?


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/kTpbJpW6s3I/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.

Jesse Glick

unread,
Apr 11, 2013, 11:46:05 AM4/11/13
to jenkin...@googlegroups.com
On 04/11/2013 11:30 AM, Peter Miklosko wrote:
> At the moment I use it to build URL (HOSTNAME/job/JOB_NAME/BUILD_NUMBER/api/json?wrapper=changes&xpath=//changeSet) to be able to query for change log through JSON.

If you are passing this URL to an external program (i.e. it is not being displayed as a link from a Jenkins web page) then computing the absolute URL is the right thing
to do.

(BTW use ?tree in preference to ?xpath, and note that ?xpath only works for api/xml anyway!)

> So is there any other better way to get hold of change log?

From code running inside Jenkins certainly there is. (Any remote API URLs can be read off more or less directly as Java getter-method calls.)

Peter Miklosko

unread,
Apr 11, 2013, 1:13:44 PM4/11/13
to jenkin...@googlegroups.com

From code running inside Jenkins certainly there is. (Any remote API URLs can be read off more or less directly as Java getter-method calls.)

Do you mind to expand more on this? I'm trying to access change log from Jenkins plugin 

Jesse Glick

unread,
Apr 11, 2013, 4:05:06 PM4/11/13
to jenkin...@googlegroups.com
On 04/11/2013 01:13 PM, Peter Miklosko wrote:
> I'm trying to access change log from Jenkins plugin

http://javadoc.jenkins-ci.org/hudson/model/AbstractBuild.html#getChangeSet()

Peter Miklosko

unread,
Apr 11, 2013, 4:10:07 PM4/11/13
to jenkin...@googlegroups.com
I seen that one but is returning GitSCM or similar class that I cannot get hold of, couldn't find appropriate library so I could add dependency
Reply all
Reply to author
Forward
0 new messages