ArcBees / teamcity-plugins

40 stars 26 forks source link

PullRequest clones always default branch #47

Open pawepaw opened 8 years ago

pawepaw commented 8 years ago

Hello,

I'm using teamcity 9.1.4 and I wanted to build my feature branches (all are based on develop branch). I made configuration for VCS root and configured branch specification there:

Branch specification: +:refs/heads/feature/*

base branch: develop

Teamcity detects pull requests but it builds with sources from develop branch not from feature branches. Is it possible that teamcity api has changed and triggering build for specific branch no longer works? Or i missconfigured something?

Edit: I've changed default branch in vcs root to another branch and it started building this branch. So no matter what my branch specification is it always builds default branch from vcs root.

pawepaw commented 8 years ago

Any info?

meriouma commented 8 years ago

Is your branch name of the pull request prefixed by feature/? The only time we had this issue is when we didn't write the correct branch specification

pawepaw commented 8 years ago

Yes my branch is prefixed by feature.

In teamcity it says it's building correct branch but i spotted this by removing test on the branch. Even after removing, it was running. Checked sources in work directory and it was wrong branch.

meriouma commented 8 years ago

Hmm, I'm having a hard time figuring what could be wrong. If TeamCity is building the correct branch, then the trigger works as expected, otherwise you would see a build of develop being started. Maybe you can try checking the "Clean all files in the checkout directory before the build" option.

pawepaw commented 8 years ago

If i trigger build manually using run button and i chose which branch it all works fine. Gonna check what will happen if i set clean all files..

pawepaw commented 8 years ago

Checked if "Clean all files in the checkout directory before the build" and it does not help.

btw. I've checked logs and teamcity implicitly change branch to develop. I can give you more data to reproduce it if you need.

I will sum up everything here:

  1. Enviroment: I'm using teamcity 9.1.7 right now but I had same issue on 9.1.4 (are you sure it'll work on teamcity 9.1.x? Have you tested it?) Your plugin version is snapshot-20161503143845
  2. I've configure you plugin: base branch: develop apporve on success: true trigger
  3. vcs root configuration for this build: default branch: develop branch specification: +:refs/heads/feature/* -:<default> clean policy: on branch change clean files policy: all untracked files

vcs vcs2 vcs3

I've created new branch based on develop with name feature/CMP-4290/check-pr-branch-source and created two tests that are failing always.

        [Test]
        [Category("Unit")]
        public void TestPrBuildConfiguration()
        {
            throw new NotImplementedException();   
        }

Here is build result if it's triggered by plugin (after creating pull request with this branch): result buildlog

Here is build result if i triggered it manually selecting changes: result_failed buildlog2

On each trigger branch contained the same changes so in both triggers it should fail on two tests. But in build triggered by plugin it does not fail because as you can see in logs it collects changes from develop branch.

meriouma commented 8 years ago

Thanks for the detailed report. I spotted 3 differences with how we use it :

Could you try server side checkout?

Regarding versions, we're running the plugin on TeamCity 8.0.1, TeamCity 9.0.1, TeamCity 9.1 and TeamCity 9.1.6

pawepaw commented 8 years ago

Tried all except removing "apporve on success". I'll try to apply all of above.

edit. Tried, makes no difference. Still builds develop.

Lechus commented 8 years ago

Teamcity 9.0.4 - works with feature branch with settings as @meriouma suggested above.

pawepaw commented 8 years ago

any info? Maybe you have any idea what else i can investigate? Tried changing my branch specification from +:refs/heads/feature/* to +:refs/heads/Feature/* but it makes no difference.

meriouma commented 8 years ago

I'm running out of ideas. Can you try watching +:refs/heads/* and create a branch without /feature to see if it changes anything?

pawepaw commented 8 years ago

Yeah, thanks! Started working after changing to +:refs/heads/* it works now for every pull request to develop but it's ok.