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 create an artifact from my plugin Edited

Hello,

I'm developing a plugin that creates files on the remote agent. I need to create an artifact and publish it in Bamboo.

1. How do I create the artifact? Is creating an ArtifactDefinition and an Artifact enough?

2. If so, how do I link the ArtifactDefinition to the Plan which runs my plugin? I'm unable to figure out how to get the "current plan".

3. Do I need to copy the files from the Agent to the server first? If so, how?

4. Do you have a simple code example that can help explain (In addition to answering the questions above)?

Please assist me as I've been struggling with this for so long and it's becoming quite urgent.

Thank you

1 answer

0 votes

If you're generating artifact it means build produces some file.

The best place to manage it is to create Task plugin which user adds to his build. Then user can configure his plan configuration and add Artifact definition.

 

Thank you for the quick response.

Regarding your answer, you mean to tell me that it's the user's responsibility to make sure that the artifacts are eventually published in Bamboo? This doesn't really make sense to me. Isn't there a way to do so code-wise?

it's possible to create ArtifactDefinition programatically, bit it doesn't make sense to manage file upload from agent manually, Bamboo should do it. So artifact shoulb defined before build started and sent to agent. 

Can you describe the result you want to achieve with your plugin, what is business needs?

I'm creating a plugin for a program that runs a load test on the application the user specifies. It basically emulates a group of "virtual users" that access a web application and records the results. After the test run the results are saved on the agent, and that's where I'm stuck now.

I wanted to collect the result and publish them in Bamboo without having the user do any action manually. Is this possible?

Ok, it's become a little clear now. Good way to handle this situation is to create artifact definition for build reacting on some user actions. 

As sample you can look at source code of Bamboo Clover plugin (it's part of Bamboo source code available for customers at my.atlassian.com). Plugin creates ArtifactDefinition for Clover report generated at agent side and then visible to user at additional tab of Build result. It's created when user enables Clover support for Job See com.atlassian.bamboo.clover.builder.coverage.CloverBuildProcessor#customizeBuildRequirements

 

ArtifactDefinitionImpl artifact = new ArtifactDefinitionImpl(CLOVER_REPORT_ARTIFACT_LABEL, reportDir, "**/*.*");
artifact.setProducerJob(job);

artifactDefinitionManager.saveArtifactDefinition(artifact);

 

Suggest an answer

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

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

587 views 1 6
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