build status into artifacts
Hi All,
This might be easy and I'm just missing it, but I'm trying to figure out how to incorporate the builds status into the artifact creation step. For example I'd like to be able to put files into a zip file like this: build-SUCCESS.zip or build-FAILURE.zip. Is this possible? I found an environment variable called build.status, but it appears as this is more for signalling teamcity when a build has success/failure during a build.
Any ideas?
Please sign in to leave a comment.
Hi George
There is no such property, so you'll need to implement this logic and create archives with such names within a build script.
Can you share a use case, why do you need this status right in file names?
Thanks
Michael
Ahh, ok. That's dissappointing.
It's not a big deal, but part of our current workflow is to publish artifacts to a simple shared directory whether they worked or not. We label them with success or failure, and an engineer can then go grab the exact non-working build and investigate. I could replicate this workflow easily with that functionality, but yeah I'll look into putting some logic in the build to detect the failure and mark it somehow.
we have TW-1558 request for that, please vote.
That would be convenient. Is there a way I can get to the build status from inside a build? I could then add a build step at the very end before artifacts are published to mark them somehow.
Separate build step is not executed, if previous step fails.
So, you'll need to do it within the same step.
yes, it would be nice to know the current build status from a build step. Currently, we need to publish an artifact only if the whole build is successful, but we don't want to exit in previous steps so the last step to publish the artifact is skipped.
Example: We have a configuration with the following:
1. build VS solution with stylecop
2. run fxcop
3. run unit tests
4. validate test duration
5. run ndepend
6. publish artifacts
we would like to make the most out of a build, so except for compilation, each step should mark the build as "failed" in case of an error, but would not skip the next steps. So, at the end, we would only create some artifacts if the build is successful.
Is that possible?
thanks,
Isel
Please vote for TW-12194 and TW-13682.
At the moment the only solution is to split the tasks between separate configurations, and link them by snapshot and artefact dependencies.
Voted. Thank you so much for referencing those posts.
Having separate configurations might solve the problem but will make it even more complicated, but maybe I am taking the wrong approach to our problem.
The original problem is that we want our "Deploy" configuration only to run if "Unit Tests" and "Integration Tests" are succesful, but we only have a snapshot dependency to "Unit Tests" which is the one that produces the dlls as artifacts.
How could I configure that in TeamCity? Can I have also a snapshot dependency on "Integration Tests" and not use any artifacts from it?
Thanks a lot!
Isel
Sure.
You can set multiple snapshot denendencies in parallel.
thank you, that solves our problem!