Passing information to builds from a trigger plugin

Hi

 

I'm writing a build trigger plugin that listens for events in Octopus Deploy, and triggers builds.

When a new deployment happens in Octopus, I'd like to pass the details of this deployment to the build, but unfortunately, I haven't found any information on how to do so.

Can someone point me in the right direction please? (Note: I'm not a java developer, so I'm not aware of a lot of the java ecosystem and terms).

Thanks,
Matt 

3 comments

Hi Matt,

Sorry for delay. 

Have you looked at TeamCity REST API? It's rather powerful and provides a simple way to trigger build with custom parameters: https://confluence.jetbrains.com/display/TCD9/REST+API#RESTAPI-TriggeringaBuild.

0

Hi Alina

 

Is that the recommended approach for a build trigger plugin? The entire point of a trigger plugin is to return information directly to teamcity about whether or not to trigger a build, not trigger an external build?

 

Regards,

Matt

0

Matt,

As to your original question on passing the information to the build:

It depends a lot on how this information is supposed to be consumed in the build.

The most straightforward way is to add parameters to the build. This can be done as custom user-level parameters (just like adding a parameter in custom run build dialog), or as API-level parameters. The difference is how they appear on the build's parameters tab and whether different values of parameters influence builds reuse for purpose of snapshot dependencies.

A trigger can add custom parameters on build triggering (e.g. in PolledBuildTrigger#triggerBuild), example of queueing a build can be seen in jetbrains.buildServer.server.rest.model.build.Build.getBuildToTrigger of REST API. The API-level parameters can be added using jetbrains.buildServer.serverSide.parameters.BuildParametersProvider.

0

Please sign in to leave a comment.