trigger TeamCity build when comment on GitHub pull request - teamcity

I'd like to trigger build by commenting specific message on the pull request, like: "Build again."
I allowed all 'commit', 'PR', and 'comment' things to GitHub-TeamCity hook.
Then I tried with VCS Trigger's 'comment' rule, but no luck.
I'm used to triggering build by comment with Jenkins using this plug-in: https://plugins.jenkins.io/github-pr-comment-build
Is there any plug-in or instructions for TeamCity?
I've looked this SO, and I agree with the chosen answer. However, I found that triggering something via comment is quite handy, and it gives more extensibility such as Slack integration.
TeamCity trigger for Github comment on pull request

Related

Approved PR comment response re-deploys GitHub workflow

I have a workflow with the following triggering mechanism:
on:
pull_request_review:
types: [submitted]
jobs:
job_one:
if: github.event.review.state == 'approved'
It works exactly as expected so upon PR approval, the workflow is deployed. However, if anyone leaves a comment within the approval, and a response is added to that comment, the workflow deploys again but the job is skipped. How can I avoid deploying the workflow when a response is added to a PR comment? It overwrites the active checks and is visually confusing even though the workflow is still running.

How to Post PR comment from jenkinsfile

I am running Multibranch pipeline jobs using Github plugin with the option below
and periodical polling (5 mins) to look for open pull requests (new feature branches in our case). Open pull request is identified, job is triggered and on successful completion am able to update the status. would like to add a PR status message with URL using
pullRequest.comment('This is a comment sent from the Pipeline').
But pipeline job fails with
"No such property: pullRequest for class: groovy.lang.Binding".
on further inspection, env.CHANGE_ID is set to NULL (means it is not a PR build job which is a prerequisite to use pullRequest module). can anyone suggest some idea to get CHANGE_ID set or means to post/update comments to PR other than success or Fail

Jenkinsfile : Posting test info back to github?

I am using a Jenkinsfile to build build pull requests (declarative pipeline) , I want to push test results (one line) , code coverage(cobertura) and if possible SONAR back into the pull request in a fairly simple fashion.
I looked at some docs and added
junit 'target/surefire-reports/*.xml
but it doesn't post anything back to the pull request in github.
As far as I know, you cannot push test results back to GitHub without actually using git commit/push. What you can actually do is to create a webhook (setup guide) on GitHub and on Jenkins so that the build result is showed on GitHub and clicking on that link can redirect you to the Jenkins server.
Example
For Sonar I am sure there is a webhook as well, but I haven't used it personally.

How to check quality gate status for a project using the API?

I need to trigger HipChat notification for a project as soon as quality gate fails for a project in SonarQube. Is there a REST API for checking the quality gate status of a project. I couldn't find it under api/quailty_gate or api/projects.
I am open to other approaches of triggering a hipChat notifications as well.
You can get the quality gate status by using this REST endpoint:
/api/resources/index?includealerts=true&metrics=alert_status
which will give you an output similar to this one:
{
"key": "alert_status",
"data": "ERROR",
"alert": "ERROR",
"alert_text": "Major issues > 10, Files > 3"
}
The web service api/qualitygates/project_status has been introduced in v.5.3 to be able to get the gate status of a specified analysis (see parameter analysisId, which value is output during analysis). The initial goal is to be able to "break the build".
Version 5.4 added the parameters projectId and projectKey which are convenient when analysis is not known.
Note that version 5.5 will allow a SonarQube plugin to directly send a notification, for example to HipChat, when an analysis is finished. See JIRA ticket SONAR-7488.

Update YouTrack state on issue from checkin comment in SVN

I've been trying to set issues to status "fixed" from my SVN commits, but it keeps on failing. This is what I've been trying as SVN comment:
#TCSE-20 fixed
and
TCSE-20 fixed
Where TCSE-20 of course is my issue id. I then run my build in TeamCity, which is linked to the YouTrack project.
The comment gets recognized in YouTrack as it's added to the Comments tab. But the state remains as Submitted. What am I doing wrong?
The solution was what I was hinting in my comment. I am the administrator of our YouTrack server, and I used my email address for the "root" account, as well as having my own user, based on my username, with the same email address. When I changed the "root" accounts email address to one of my colleagues, the commands executed correctly.
Now I would like to know how to solve this better, like disabling "root" from the user lookup function, but that will be another issue. :-)

Resources