Skip to content

How Can I include the TeamCity build number in the metadata #1358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RobSmyth opened this issue Jan 17, 2018 · 9 comments
Closed

How Can I include the TeamCity build number in the metadata #1358

RobSmyth opened this issue Jan 17, 2018 · 9 comments
Labels

Comments

@RobSmyth
Copy link

RobSmyth commented Jan 17, 2018

Hi,

I want to include the TeamCity build number in the SemVer (AssemblyInformationVersion) metadata. How can I do this?

I want the build server's build number so that releases can be traced back to a particular build in an environment were builds of the same <major>.<minor>.<patch> version number could (in theory) be built multiple times. We need traceability to the build logs.

I'm hoping somebody has already done this. I know that TeamCity sets an environment variable with this number so it is both possible to detect if the build is running from a TeamCity server and what the build number is.

@RobSmyth
Copy link
Author

I've had some success by adding the TC build number to the env.Git_Branch TC parameter:

%teamcity.build.vcs.branch.XXXXX%.B%system.build.number%

Seems to work, the build number is visible as .B123.

Will doing this break something else? Will 'Git_Branch' work as expected?

@asbjornu
Copy link
Member

Wow, this is quite a hack. I'm surprised and impressed that it works! 😄 I can't guarantee that it'll work in all scenarios, though. Request-wise, this seems to be a duplicate of #1157 (and #648 before that). Is that correct? If so, can this be closed as a duplicate?

@RobSmyth
Copy link
Author

Hi, yes it is quite a hack and it does not work properly. I forget why.

As for be a duplicate - that depends on the solution. #1157 is for TFS so I cannot say a solution for TFS would be usable with TeamCity. Using environment variables (#648) may well be workable with TeamCity as I think I can get it push out the build number to an environment variable.

If youre going to implement environment variables, then I think I can use that solution and this can be closed as a duplicate.

Rob

@asbjornu
Copy link
Member

After thinking about this for a while and reading all the requirements and ideas for solution, I think environment variables is the way to go. We don't have anything near an implementation yet, though. Are you up for the challenge?

@asbjornu
Copy link
Member

If what I describe in #1157 (comment) sounds like a fitting solution to this problem, I propose that we close this as a duplicate of #1157.

@RobSmyth
Copy link
Author

Are you up for the challenge?

Maybe LOL. I'll see how i go.

@asbjornu
Copy link
Member

Excellent! Just shout out if you need any assistance!

@jbaehr
Copy link
Contributor

jbaehr commented Mar 20, 2018

Please try/comment the PR #1385. It allows you to use environment variables in format strings. I think this would solve your issue.

@stale
Copy link

stale bot commented Jun 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 29, 2019
@stale stale bot closed this as completed Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants