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

Is it possible to write a plugin to submit artifacts?

Matt Hauck May 21, 2015

I am writing a plugin that I would like to be able to submit artifacts. Something like `TestCollationService`, but for artifacts instead of tests. I can't seem to find anything in the documentation about how to do this. 

Thanks.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Matt Hauck May 22, 2015

Well, I've gotten pretty close to being able to do this, but there is one piece missing: `theSecureToken`

taskContext.getBuildContext()
  .getArtifactContext()
  .getDefinitionContexts().add(
        new ArtifactDefinitionContextImpl(new ArtifactDefinitionImpl("the blah.txt", "", "blah.txt"), theSecureToken));

This block of code works perfectly.... with the one exception of the SecureToken object that I cannot find the right way to get from the agent context. The only way I have gotten this to work is by defining other artifacts, then iterating through `artifactContext.getDefinitionContexts()` to grab the SecureToken from the first one I find. However, I would like this artifact submission to work even in the case when no other artifacts are defined in the actual build plan. 

I have tried auto-wiring in a SecureTokenService object (and also tried grabbing it from ContainerManager), but both result in a "no such bean definition" from Spring, which makes sense, since the token is probably generated on the server and then sent down to the agents, so that the server can verify it. 

My question is, where does it exist on the agent that I can reliably grab it from?

TAGS
AUG Leaders

Atlassian Community Events