I'm using Jenkins within Openshift together with the stash notifier plugin. This plugin needs the jenkins rootURL to be set to work.
When Jenkins starts (not only in openshift, but also native) the jenkins.model.JenkinsLocationConfiguration.xml is not saved automatically. and since this file does not exist Jenkins.getinstance().getRootUrl() returns null.
When I enter the System Configuratiuon of jenkins, the root URL ist set in the GUI. After saving, the file jenkins.model.JenkinsLocationConfiguration.xml will be created.
Also if I start a new Jenkins and create a Job, the file is created.
When I work within Openshift the jobs are created from Openshift's BuildConfigs. But when these Jobs are created, the jenkins.model.JenkinsLocationConfiguration.xml file does not exist and the root url is still null in any of these builds.
There is also an Issue on redhats bugzilla about this: https://bugzilla.redhat.com/show_bug.cgi?id=1510908