Incorrect branch is triggered on snapshot-dependent builds

Hello all,

I'm observing a strange behavior and wanted to figure out if this is a problem with the setup or I'm not understanding the functionality correctly.

I have a repository with two branches branc1 and branch2 and two builds that both use the same VCS.

Build B snapshot-depends on Build A.
Build A has default branch branch1
Build B has default branch branch2.

If I trigger Build B from run custom build dialog and explicitly select a branch from the changes\build branch option (say, I selected branch2) then Build A is triggered on branch2 and correct artifacts are passed back to build B as expected.

But if I just simply run Build B, than it runs with its default branch (branch2), triggers build A, but build A also runs with its default branch (branch1). So as a result I get the wrong combination - build B ran on one branch but received the artifacts from another branch.

Can anyone tell me what am I missing here?

Thanks,
Zura

7 comments
Comment actions Permalink

You are not missing anything - this is an expected behaviour. If you trigger the build with default branch, all dependencies will be triggered with default branch as well.

It's probably worth reworking you build configuration workflow to have this working properly. For instance, create several build configuration, based on the same template, where each configuration has its own default branch/

0
Comment actions Permalink

I did have to rework my workflow, but I still think there is an inconsistency here - snapshot dependency is supposed to be run on the same everything (I guess that's the whole idea of snapshot dependency?) but this come ins conflict with build on default triggering another build on default branch as well, even when those two defaults are not the same...

0
Comment actions Permalink

It definitely seems like this is very counterintuitive to me, too. Like he said, a "snapshot dependency" is supposed to result in the same snapshot used for both builds. It cannot possibly be the same snapshot if the builds build with different branches. At the very least, it seems like this should be a setting. I'm having the same problem, too. When Build B builds for its branch, I need its snapshot dependency (Build A) to build for the same branch.

0
Comment actions Permalink

There two options here:
1) whether branch is default or not
2) branch name

The first one has priority over the second one.

0
Comment actions Permalink

So how, exactly, do you make two builds using the same VCS root have different default branches? I can't seem to figure that one out. EDIT: Nevermind. I figured this out. I set a project-wide property that defined the default branch, used that property in the default branch field, and overrode the property in the build for which I wanted to use a different default branch. Worked great.

With that asked, your response did not really address our concerns. I don't even understand your response. I'll submit a feature request regarding this. Seems like it should be a fairly easy setting.

0
Comment actions Permalink

Zura, I've filed this bug report to (hopefully) address your concerns and mine. Go vote for it to help move it along.

0
Comment actions Permalink

I've added the first vote :)

This may be a rear case (although I see that you are implementing the gitflow approach that is supposedly quite popular) but I think this is a fundamental issue breaking the whole snapshot dependency concept and should be considered severe even if I understand how this happens and how does this confilcts with default branch feature... especially if there is a push to present TC as a convenient deployment management tool.

0

Please sign in to leave a comment.