Open MaksSlesarenko opened 10 years ago
It triggers on pull-request but says no changes.
TeamCity 8.0.5 plugin from build #13 http://teamcity.arcbees.com/repository/download/TeamCityPlugins_CompileMaster/710:id/bitbucket/target/bitbucket.zip
Did you install a previous version of the plugin, then updated to the new one?
If it's not the first build on the branch, it might show that there's no change (since the last build)
The plugin was not updated. I see in build agent work directory that the code was checkouted from main branch without changes from PR.
The thing is that we had that bug in the past, and fixed it with the latest version.
What is the version number shown for the plugin on the page : {yourTeamCityServer}/admin/admin.html?item=plugins
I'm out of ideas here. The plugin works on our TeamCity server and I've had another person that reported the bug you are experiencing, but the last version fixed it and it works fine for him too. Do you have anything relevant in your log files?
Can you give any tips what to look for?
I ran into such an issue when my branch spec didn't match what the plugin was passing.
Try manually triggering a build, selecting a branch to run build from and then look at what teamcity has in the build history for the branch name. That match what the bitbucket plugin is passing (I think you can see what that is by looking at one of the builds triggered by it)
Does this plugin support mercurial? As I understand +:refs/heads/* doesn't make much sense for hg.
Ah that's a good point, the plugin was only tested with git. I'm not sure what's the branch specification for mercurial.. Maybe you can try +:*
?
As I understand branch is not created on pull request in mercurial. You need to checkout upstream branch and than do
hg import https://bitbucket.org/!api/2.0/repositories/COMPANY/PROJECT/pullrequests/REQUEST_ID/diff
In bitbucket, a branch is not created for git pull requests either. The plugin uses the bitbucket REST API to find the pull requests, not the VCS. What the branch specification does is gather information on branches so the plugin can find the commits.
I've already tried +:*
with no luck. As I understand from what you said above, wrong branch specification can result than commits are not displayed at TeamCity's build page. But my source code does not have changes from PR, that means that hg import
was not executed.
Can you try +:* and wait for the next PR to open?
I have set branch to default
branch specification to +:*
if I create a pull request within my repository from develop
to default
than develop
branch gets a build
if I create a pull request from fork default
to main default
than default
is built, no patches applied
if I create a pull request from fork develop
to main default
than develop
is built, no patches applied
I agent's build log there is comments that patch was applied http://pastebin.com/qHQsS5Vc
teamcity-activities.log http://pastebin.com/ZUqr3qN8
Thank you for those tests. So if I understand, your first PR from a branch to another triggered the build with the correct changes? But the PR from a fork didnt?
In first case default
should have been built + patch from develop
, instead develop
itself was built.
Also in build logs I have such thing
teamcity.build.branch=develop
vcsroot.branchName=default
From what I see now branch specification +:*
just overrides specified branch name
The first case is the expected result, as develop contains default + your changes. For forks, I must say that I don't think it's supported. There's no way teamcity knows about the forks, because the VCS root doesn't include them
The first case is the expected result, as develop contains default + your changes
But TeamCity labled it as a develop
branch build
For forks, I must say that I don't think it's supported. There's no way teamcity knows about the forks, because the VCS root doesn't include them
Actually it knows, otherwise build would not be triggered on pull request from fork.
In any case, can your plugin export parameter with PULL_REQUEST_ID to Ant or do you know a way I can get it in Ant from TeamCity? This will do the job for me.
The reason it's labeled develop
is that you want develop to be compiled when you ask for a PR from develop
to default
, as develop
is the branch containing the new changes and is the branch you want to test to be sure it doesn't break anything, not default
. I might be missing something about your use case though.
As for the parameter, I can look on what's possible with TeamCity to pass to the build
As I understand your in your plugin gets changeset number from api and calls setChangeset(CHANGESET_ID) and then git implicitly changes branch to pull request, because pull requests are stored within same repository in git. But this approach does not work for mercurial. Maybe you can use https://bitbucket.org/aragost/javahg/ to import patch that is provided by bitbucket api to project working copy in build agent?
Is this issue still relevant?
Yes it is
Any idea on when you might work on this? I'm keen to get a pull-request setup on mercurial/bitbucket combo, and there are so little tools supporting this. I had thought my salvation was here, but alas, it doesn't work.
I'm not a Java developer, so I did clone the repo, but very quickly got lost in how to map the links that come back from bitbucket using gson.
Could even exporting the pull request ID into the TeamCity Env variables be the place to start? Then the first build step can download the patch (PullRequest.links.patch) and apply it?
Sorry for the delays. We are not using mercurial at the moment so it's hard to tell when we'll implement this feature. If anyone wants to contribute this, pull requests are more than welcome!
Are you using the latest version? Also, be sure to add
+:refs/heads/*
in Branch specification of your VCS root. This bug was found and fixed in the last version, but it requires the branch specification to be able to find the commits.Thank you!