Adding a custom build parameter for System.DateTime

Hi,

I am wanting to implement the following version number format for my build "YYYY.MM.Rev".

Is there a way i can add a build parameter or environment variable to read the Systems DateTime ?

Thanks

0
4 comments

Hi Corbin,

that's an interesting request. As of now, there aren't any exposed variables to pick up that value, although there should be a pretty easy way to handle that:
-Create two build parameters for year and month.
-Keep them updated, if it's only once a month it should be easy.

To avoid having to manually do it, it should be rather easy to set up a build configuration that is schedule triggered at the start of a month and updates this parameters via the REST API. Setting them at the root project level means you should be able to use all throughout your system due to inheritance.

1
Avatar
Permanently deleted user

Hi Denis,

I thought that was the way id have to do it, thanks for the help :) 

0

(Using TeamCity Enterprise 2018.2.2 (build 61245))


Hi.

How do you automate the build configuration to update the year and month parameter?
This could have been trivial with a date parameter in TeamCity :|

I've created two parameters (BuildMonth and BuildYear) in the <Root project> and created a sub project that will contain the build configuration.
How do I approach the REST API within the Build Configuration that updates the parameters? Powershell? Writing something in C# that accesses the REST API and updates the values?

 

0

Hi Harald,

 

You can use any language you feel comfortable with. The most common option is curl, which is available for most supported platforms and can be run as a command line script. Powershell is also a common option in windows. Writing an actual application (C# or otherwise) could give even more flexibility but is probably overkill for this task.

0

Please sign in to leave a comment.