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

[ISSUE]: Branch detection in multi-repository pipeline is based on pipeline variable instead of targetPath repository branch #1306

Open
2 tasks done
TimJongerius opened this issue Oct 21, 2024 · 0 comments

Comments

@TimJongerius
Copy link

TimJongerius commented Oct 21, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

AzureDevops task

What are you seeing?

I am experiencing unexpected behavior when using GitVersion in a multi-repository pipeline setup. It appears that the branch is being detected based on the pipeline variable and not the branch of the repository checked out in the targetPath.
Problem:

In my pipeline, I have multiple repositories:

Main repository / Self (checked out on develop branch)
Secondary repositories (checked out on v3.0.0 tag, v4.0.0, etc.)

Despite the secondary repositories being on the v3.0.0 tag, GitVersion seems to calculate the version as if it’s still on the develop branch of the main pipeline. As a result, the version calculated for the secondary repositories ends up as 3.0.0-alpha.0 instead of 3.0.0, which reflects the tag v3.0.0 it's actually checked out on.

This behavior causes issues with tagging and versioning in multi-repository pipelines, especially when different repositories are on different branches or tags.

Can you please provide guidance on how to ensure that the version is calculated based on the branch/tag of the repository in the targetPath?

As a fix we changed the self/main repo branch name from develop to main. so there is no label added. We could also provide a GitVersion.yaml to fix this behaviour but it feels wrong that the Self Branch Name gets used for the SemVer calculation of secondary repositories.

Thank you!

What is expected?

Expected Behavior:

GitVersion should calculate the version based on the branch or tag of the repository in the targetPath, not just the pipeline branch. In this case, it should detect that the secondary repository is on v3.0.0 and return the version 3.0.0, not 3.0.0-alpha.0.

Expected Output:

Version returned: 3.0.0 (from the v3.0.0 tag of the secondary repository).

Steps to Reproduce

Steps to Reproduce:

Set up a pipeline with two repositories.
Checkout the main/self repository on a develop branch.
Checkout a secondary repository on a tag, e.g., v3.0.0.
Run GitVersion on targetPath={secondaryRepoPath} to calculate the version.

Observed Output:

Version returned: 3.0.0-alpha.0 (from the develop branch of the pipeline).

Environment:

GitVersion version: 6.x
CI System: Azure DevOps

Output log or link to your CI build (if appropriate).

No response

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