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

Branch posted is always master branch #5

Open
joelwkall opened this issue Sep 27, 2016 · 1 comment
Open

Branch posted is always master branch #5

joelwkall opened this issue Sep 27, 2016 · 1 comment

Comments

@joelwkall
Copy link

joelwkall commented Sep 27, 2016

I have a git repository at bitbucket with multiple branches. These are build in TeamCity in a build project that has multiple branches. When a branch is built I expect the WebHooks to POST to my endpoint and notify which branch was built. However, it seems as if the "scm" data in the JSON is always the same, regardless of which branch was built. Example:

"scm": {
      "url": "https://bitbucket.org/xxx/yyy.git",
      "branch": "origin/master",
      "commit": "zzzz"
    }

Even though the branch build was actually not origin/master.

Can I configure the plugin to use the correct branch name in the POST?

@joelwkall
Copy link
Author

Just looked in the code and found these lines:

if (! vcsRoots.isEmpty()) {
      val vcsRoot = vcsRoots.get(0).getVcsRoot();
      scm = Scm.builder().url(vcsRoot.getProperty("url")).
                          branch(vcsRoot.getProperty("branch").replace("refs/heads/", "origin/")).
                          commit(vcsRoot.getCurrentRevision().getVersion()).build();
    }

It looks like it is only looking at the vscRoot of the build project, not the branch of the actual build. How hard would it be to make it look at the build branch instead?

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

1 participant