Get Base URL of bamboo server with plugin running on remote agent

Hi, I have an issue with finding the baseurl of the bamboo server. I’m calling getBaseUrl() as in BambooWebResourceIntegration, which works on the default agent, but failed when we tried to run it on the remote agent.

Any idea what could be the cause of that? Or how could I go about setting the administrationConfiguration. Thank you in advanced!

Here’s the error log

error	15-Aug-2017 13:46:10	com.atlassian.spring.container.ComponentNotFoundException: Failed to find component: No bean named 'administrationConfiguration' is defined
error	15-Aug-2017 13:46:10		at com.atlassian.spring.container.SpringContainerContext.getComponent(SpringContainerContext.java:79)
error	15-Aug-2017 13:46:10		at com.atlassian.spring.container.ContainerManager.getComponent(ContainerManager.java:33)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.plugin.webresource.BambooWebResourceIntegration.getAdministrationConfiguration(BambooWebResourceIntegration.java:206)
error	15-Aug-2017 13:46:10		at createagent.CreateAgentTask.getEnvVar(CreateAgentTask.java:116)
error	15-Aug-2017 13:46:10		at createagent.CreateAgentTask.execute(CreateAgentTask.java:56)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:317)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:246)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:317)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:118)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:74)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:215)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:139)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:130)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:221)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:129)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:137)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:51)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
error	15-Aug-2017 13:46:10		at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
error	15-Aug-2017 13:46:10		at java.lang.Thread.run(Thread.java:745)
error	15-Aug-2017 13:46:10	Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'administrationConfiguration' is defined
error	15-Aug-2017 13:46:10		at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:704)
error	15-Aug-2017 13:46:10		at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1175)
error	15-Aug-2017 13:46:10		at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284)
error	15-Aug-2017 13:46:10		at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
error	15-Aug-2017 13:46:10		at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:275)
error	15-Aug-2017 13:46:10		at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
error	15-Aug-2017 13:46:10		at com.atlassian.spring.container.SpringContainerContext.getComponent(SpringContainerContext.java:75)
error	15-Aug-2017 13:46:10		... 20 more

Check this page : https://developer.atlassian.com/bamboodev/bamboo-plugin-guide/common-bamboo-classes

Go to Administration Configuration section down below.

Hint: You should use ContainerManager.getComponent(“administrationConfiguraiton”)

1 Like

Maybe not relevant anymore; but I wanted to achieve the exact same thing.

You need to import and use in your plugin class the class CachingAdministrationConfigurationAccessor

This will allow you to get hold of a AdministrationConfiguration object.

Regards

1 Like