Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to access job artifacts (regular / shared ) in a new tab in the Bamboo job page. Edited

Hi,

If someone could please help, a thanks in advance. :)

I wanted to display an HTML report into a new tab on Bamboo Job Link (Default job). I have implemented the new tab using xwork and web-item in atlassian-xml. The class "XYZ" defined in action tab is extended from "PlanResultsAction". I am using a free-marker template which would display the artifact HTML report.

I was going through a similar question in link
"https://community.atlassian.com/t5/Answers-Developer-Questions/What-is-the-proper-way-to-access-a-build-artifact-from-within-a/qaq-p/558533"

Question 1:

How can I initialize BuildContextImpl and BuildContextHelper in class "XYZ" to get the Build Working Directory and hence the artifacts?

My task runs on the agent, it would then publish artifacts generated on the agent using the below, 

 

"artifactManager.publish(taskContext.getBuildLogger(), taskContext.getBuildContext().getPlanResultKey(),
143 fileWorkingDir, artifact, new Hashtable<String, String>(), 1);"

Question 2:

Does the shared artifact get copied on the server?

I have created an artifact definition too, so I can see 2 artifacts (image)

Artifacts.png

Question 3:

 

I am always publishing an artifact (using publish API). Is my assumption correct that it always gets copied on the server from an agent?

What is the right way to display the content of the artifact in the new tab?

 

1 answer

I did a bit of investigation. Now I am extending my class from "ViewBuildResults" instead of "PlanResultsAction". 

I now use the function "getSharedArtifactPath" and "getArtifactPath" to get the artifacts. But now I am getting the below error

ERROR [http-nio-6990-exec-1] [BambooStrutsUnknownHandler] There is no Action mapped for namespace [/] and action name [XYZ] associated with context path [/bamboo].

Hi Kshitij,

 

Where you successful in implementing your feature and resolving the above issue?

Yup. I did it successfully. It was some simple change in code I think.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center - Early Access Program 2

We’re preparing for Bamboo 8.0, which will be our first Data Center release. To make sure our app vendors and customers with written in-house apps are prepared, we’re launching Bamboo 8.0 Early Acces...

101 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you