Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PullRequest clones always default branch #47

Open
pawepaw opened this issue Jul 11, 2016 · 12 comments
Open

PullRequest clones always default branch #47

pawepaw opened this issue Jul 11, 2016 · 12 comments
Assignees

Comments

@pawepaw
Copy link

pawepaw commented Jul 11, 2016

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:

  • vcs root
    Default branch:
    develop

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

  • I configured pull request plugin like below:

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
Copy link
Author

pawepaw commented Jul 14, 2016

Any info?

@meriouma
Copy link
Member

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
Copy link
Author

pawepaw commented Jul 15, 2016

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
Copy link
Member

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
Copy link
Author

pawepaw commented Jul 25, 2016

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
Copy link
Author

pawepaw commented Jul 28, 2016

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
Copy link
Member

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

  • We use server side checkout`
  • We're not checking "Approve on success"
  • We're not putting -:<default> in branch specification

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
Copy link
Author

pawepaw commented Jul 29, 2016

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

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

@Lechus
Copy link

Lechus commented Aug 5, 2016

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

@pawepaw
Copy link
Author

pawepaw commented Aug 9, 2016

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
Copy link
Member

meriouma commented Aug 9, 2016

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
Copy link
Author

pawepaw commented Aug 23, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants