Teamcity, how to define which VCS had triggered the build - version-control

In my Teamcity build configuration I have three VCS configured:
If any of those would have a check-in - the trigger would fire and my build would be running.
What I need to know - which from those repositories had fired the trigger.
What I can know is the type of the trigger event: echo %teamcity.build.triggeredBy% (in case if the build was triggered automatically it would say "GIT") , however, I don't' see any option to know which VCS had triggered the build.
Any thoughts how this could be achieved?

Related

on_stop is not triggered automatically after Merge

I have two projects, both of the have the same jobs (becuase they "extends" the same .guint job which has os_stop action)
The first project runs automatically manual job with action on_stop after merge, but the second project does not do this. Are there any specific settings for this action or what I missed?
Gitlab version 13.15
I was searching for info, but nothing found on this problem

Can I delete a Github workflow run within the workflow itself?

We developed a CI system that runs via Github actions on self-hosted runners.
In order to prevent building unnecessarily, we incorporated a pre-build job that triggers a build only if the commit message has [trigger ci] anywhere.
Now we are facing a slight annoyance: Even if the build job doesn't run, we still have a workflow run show up in the workflow runs list, as expected, but it has basically become a copy of the commit history and very hard to navigate or find which workflows did actually build.
Is there any way that I can delete a workflow run from the workflow runs list conditionally, within the workflow itself? This way, we can keep only the runs that did trigger a build, and delete the ones that skipped building.

Can Azure Devops pipelines, where the build failed, show the user of the last commit when triggered with CI?

I'm doing Visual Studio builds on a self hosted agent, which are currently being triggered by the Continuous Integration setting in an Azure Devops pipeline.
When a build completes, it shows: Triggered by Microsoft.VisualStudio.Services.TFS
It also shows the repository, branch and revision number.
However, it is expected it would show Triggered by , If not showing the correct Azure Devops user, at least showing the Subversion user name, that would be something.
There was an expectation it would be possible to send email notifications to the user of the commit. (Not fool proof that they caused the problem, but the most convenient way to give the responsibility to somebody to make sure any build error gets resolved)
Does anybody know if a solution exists?
In both Classic and yaml pipelines, you can specify a condition for a pipeline step. If you want it to run when the pipeline fails, it will be condition: failed() (in yaml), or Control Options -> Run this task -> Only when a previous task has failed (in Classic). Alternativel, you can check Agent.JobStatus variable.
there's no predefined variable for current committer, but you can easily determine the last commit's author by using svn command, then log it. (any other version control system will have its own CLI that should allow it).
In yaml, it could look like this (using git instead of svn):
steps:
... (your build)
- bash: |
author=`git log -1 --pretty=format:'%ae'` # get last commit author from git
echo "last commiter: $author"
# TODO: send email or other kind of notification
condition: failed()
In classic one:
You are using wrong tool for you task. CI build will be triggered after changes was committed to branch. In that case it is not possible to fix those changes. As a result you will have history where a lot of revisions are not stable.
It might be more suitable for you to use PR policy build. It is designed to validate incoming changes so target branch will be always stable and ready to some deploy. In this case, policy build will be triggered by PR creator so he will be informed about it's result. That can be configured in personal notification settings.
In the end I couldn't Continuous Integration triggers to reliably work. They would always stop working after a short time. I'm surprised I have ran into so many issues with this, but I guess it just isn't that well supported.
Instead, now, I am queue the build via an svn post-commit hook which uses the azure devops REST API.
the REST API has setting, requestedFor":{"id":""}, where you can add the user id (which I also needed a rest api command to find)
A lot of messing around to get to this point, for a feature I expected to 'just work', hopefully this keeps working

Manually trigger a teamcity build from github

I want to trigger a build in Teamcity by doing a manual action(not a commit or pullrequests). Like if i click a button in github it should trigger a build config in teamcity or something similar(by passing the branch). I dont want the process to be automatic for every commits, instead just manually trigger for custom branches.
If there is a possibility for this, pls let me know as it would be much helpfull..
Thanks in advance!
Yes you can do that by leaving your Triggers menu empty...
Go to Build --> Edit settings --> Triggers and make shore that there are no triggers. You can alway manually run build by clicking on icon RUN
If you want trigger just for couple of branches you can add trigger to your VCS like this
so my list contains branches develop, qa, release and master and rule +:*/merge is for every open Pull Request

Can a workflow be triggered from a post-build action of a freestyle project?

I have a Jenkins Workflow which I am able to run by clicking Build. But when I try to start it from the Build other projects post-build action of an (freestyle) project, I just get an error in the form
my-flow is not buildable
and the downstream flow is not run when the upstream project is built.
The post-build action Build other projects does not simply do what it sounds like: build those projects when the step is run. In fact running the step does nothing at all. Instead, it causes the named projects to be included in an edge of the dependency graph, and downstream projects according to the graph are then run according to separate logic. And currently the dependency graph API is defined in such a way that Workflow jobs cannot participate. Long story short, that mode does not work.
The Parameterized Trigger plugin offers other ways to start downstream jobs. The nonblocking trigger works much like the Jenkins core trigger: it affects the dependency graph. There is also a blocking trigger (which is a build step, not a post-build action), which just does what you probably expected: start the downstream build (much like the build step in Workflow). Currently this plugin does not support Workflow, though it would probably be easy to make it use more current APIs so that it would: JENKINS-26050
What does work is to configure the relationship in the reverse direction: in the Workflow job configuration, select Build after other projects are built and select your freestyle project. Now when the freestyle project finishes building, the Workflow job is triggered.