Custom plugin to expose parameter exposed during build? Possible?

I have a build that calculates a value during build-time that I'd like to expose to TeamCity and have TeamCity use as the displayed build number for that build.  Is this possible with the current APIs for developing plugins?

Is writing a custom BuildParametersProvider going to allow me to parse that value from a build file at some point after the build has started on the agent?

http://javadoc.jetbrains.net/teamcity/openapi/current/jetbrains/buildServer/serverSide/parameters/BuildParametersProvider.html

0
4 comments

Hi Brian

Build numbers can be reported from build scripts by service messages.
Do you really need a plugin?

Michael

0
Avatar
Permanently deleted user

Wow, great feature I had no knowledge of, thanks.  Will this work within the Maven Runner though?

0

yes, this is universal approach to interact with externals tools.

0
Avatar
Permanently deleted user

Thanks Michael that was exactly what I needed.  I added the following to my Maven pom.xml and it works for continuous and release builds:

  <build>

  ...
    <plugins>
    ...
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>         <version>1.6</version>         <executions>           <execution>             <id>echo-buildnumber</id>             <goals>               <goal>run</goal>             </goals>             <phase>validate</phase>             <configuration>               <target>                 <!-- The main purpose here is to override what TeamCity thinks is the build                      number during a release. It will be run twice, but the second (and final)                      time should be during the release build and the version will be the version                      of the released artifact.                      NOTE: This also has the effect of overriding the build pattern of the                      TeamCity build configuration, whether it is set to %mave.project.version%                      or not.                 -->                 <echo message="##teamcity[buildNumber '${project.version}']"/>               </target>             </configuration>           </execution>         </executions>       </plugin>     </plugins>   </build>

0

Please sign in to leave a comment.