How to fetch commit status from bitbucket in teamcity - bitbucket

I would like to ask if it's possible to fetch commit status from bitbucket in teamcity pipelines.
I know that I can get commit hash by build.vcs.number, maybe it's possible to get commit status in a similar way?

Related

gerrit query - get latest commit hash for repo

I am using automation to pull always ref/master from the project
Is there an option to query gerrit to have information about last merged commit (getting only HASG also acceptable) ?
Using git log is not an option

How can I get Jenkins builds to report failures back to Bitbucket server?

My work is running Jenkins and Bitbucket Server (so instead of the bitbucket cloud, they host their own bitbucket version). I am used to having passing/failing builds on github and bitbucket cloud immediately reporting back on PRs and branches as to whether the build passed or failed. I want to give that gift to my team in the current environment. How do I get PRs in Bitbucket server to receive success/failure of builds from Jenkins?
[Figure 1 just shows an example of the functionality I want, operational on PRs in github+codeship]
While the Webhook to Jenkins for Bitbucket can help notify Jenkins to poll whenever there is a commit, you still need to be mindful of the “lazy ref updates” in Bitbucket (described in this thread)
We had to implement something that would do a get to the REST API for the pull-request/*/changes before the call to the Jenkins /git/notifyCommit url.
The last Jenkins URL /git/notifyCommit comes from the Jenkins Git plugin.
See more at "Configuring Webhook To Jenkins for Bitbucket".
Once Jenkins is properly called, you can then, as mentioned in "Notify build status from Jenkins to Bitbucket Server", use the "Jenkins Stash Pullrequest Builder", from nemccarthy/stash-pullrequest-builder-plugin.
The bitbucket server has build-status API. It stores a build-status for particular commit, there is no separate PR build status. The PR build status is a build status of the head commit in this PR.
You can implement yourself the rest api call to update the build status or to use one of the existing plugins. We use Post Webhooks for Bitbucket bitbucket plugin in conjunction with Bitbucket Branch Source jenkins plugin.
You could you use BitBucket REST API to achieve this ?
Here the how-to update commits with the build status :
Updating build status for commits
Commit status are then shown in Pull Request and on branches
you can setup Stash notifier plugin , it workds perfectly with BitBucket and notifies build status to branch and pull request

How to notify the build status to bitbucket UI when there is no pull request create and merge?

Am new to Jenkins. I found a plugin to notify the each commit status in bit bucket UI(Bit bucket Cloud Build Status Notifier Plugin) and am very much confused about notifying the build status.
https://wiki.jenkins-ci.org/display/JENKINS/Bitbucket+Cloud+Build+Status+Notifier+Plugin
Am doing commit continuously in development branch and i have registered the oauth credentials as described in above link with Jenkins job. After the Jenkins job run, i could not see the build status in bit bucket cloud UI.
Could anyone please suggest me whether this plugin update the commit status from pull request page to development branch while merge? Or This plugin can pass the direct build status to development branch when commit done and Jenkins job ran.
Thanks in advance!!!
If the plugin is configured properly you should be able to see the build status posted by the plugin in commit history of your development branch within Bitbucket Cloud. The build status is set for a given commit sha1, that means that it doesn't care if it's a pull request or not since the commit sha1 doesn't change.
If the build status is not shown in Bibucket Clould UI, I guess your problem is related to the plugin or Jenkins configuration. Take a look to the Jenkins log file for more information in order to be able to guide you to solve the problem.

Jenkins GitHub disable auto commit status

I'm using Jenkins with GitHub plugin. Everything works great except one thing.
How can I get rid of automatic commit statuses, like this one
Desired behavior:
Push commits to GitHub (works!)
Trigger job (works!)
Set commit statuses via GitHub API (works!)
DO NOT set automatic commit statuses (NOT working)
GitHub plugin configuration
There's a plugin for Jenkins to add a setting for disabling commit statuses: Disable GitHub Multibranch Status.

Git-Tfs: Pull a TFS changeset into existing git repository

I've got a git repository that was migrated from a TFS repository. There is currently no link between the repositories.
If I use git tfs list-remote-branches {http://...TFSRepo}, I can see the branches in TFS.
What I want to do is be able to pull a TFS changeset into my current git repository -- preferably as a commit, but I'd take just pulling the changes into the current branch.
quick-clone doesn't do what I need as it creates a new git repository (buried in my existing git repository...)
Is is possible to perform a pull of a single TFS changeset using the git-tfs extensions?
There is no way to pull only one changeset in an existing git repository that is not a git-tfs repository.
But you've got 2 possibilities to achieve your goal...
The first is to do a quick-clone in a new repository and then add this repository has a remote and fetch the commit you want.
The second is more tricky, less sure to work because you must understand how git-tfs works.
Amend the last commit to add at the end of the commit message something like that:
git-tfs-id: [https://tfs.codeplex.com:443/tfs/TFS16]$/valtechgittfs/BugMerge;C31467
with :
git-tfs-id: [https://url.tfs.server:/tfs/TeamCollection]$/ProjectName/BranchName;CchangesetId
where you specify as the changeset id, the one of the last changeset before the one you want to fetch. Then, if you have at least the v0.20 of git-tfs, then, fetch changesets...

Resources