-
Notifications
You must be signed in to change notification settings - Fork 654
change prerelease tag to local.timestamp when building locally #2069
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
Conversation
@@ -77,6 +78,12 @@ public SemanticVersion FindVersion(GitVersionContext context) | |||
} | |||
} | |||
|
|||
if (context.IsLocalBuild && taggedSemanticVersion == null && context.Repository.RetrieveStatus().IsDirty) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why this is superior to our current solution we have with our own msbuild target.
We can check if the repo is dirty in GitVersion 😍
cc @zionyx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I wonder if that's what we want.
We properly want to have all local build marked with local.timestamp
when I think about our use case for local nuget repository source.
This comment has been minimized.
This comment has been minimized.
@@ -33,7 +33,8 @@ public void RunExecViaCommandLine() | |||
var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, ExecCommand.BuildTool, "RunExecViaCommandLine.csproj /target:OutputResults"); | |||
|
|||
result.ExitCode.ShouldBe(0, result.Log); | |||
result.Log.ShouldContain("GitVersion_FullSemVer: 1.2.4+1"); | |||
var now = DateTime.Now.ToString("yyyyMMddHH"); | |||
result.Log.ShouldMatch($".+GitVersion_FullSemVer: 1.2.4-local.{now}\\d+\\+1.+"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great we already had a test that constituted as a dirty repo 😍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should properly add a dirty one and none dirty? to see when build is local 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the rationale behind this change. Why would you want a new version number every hour when building locally? One of GitVersion's strengths imho is being able to generate the same version number for the same commit on the same branch no matter where it is being built. This seems to break that premise.
@@ -75,13 +76,13 @@ private string ResolveCurrentBranch(IBuildServer buildServer, string targetBranc | |||
return currentBranch; | |||
} | |||
|
|||
private VersionVariables GetCachedGitVersionInfo(string targetBranch, string commitId, Config overrideConfig, bool noCache) | |||
private VersionVariables GetCachedGitVersionInfo(string targetBranch, string commitId, Config overrideConfig, bool noCache, bool isCiBuild) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we stick to either isLocalBuild
or isCiBuild
to avoid confusion?
private VersionVariables GetCachedGitVersionInfo(string targetBranch, string commitId, Config overrideConfig, bool noCache, bool isCiBuild) | |
private VersionVariables GetCachedGitVersionInfo(string targetBranch, string commitId, Config overrideConfig, bool noCache, bool isLocalBuild) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was indecisive on wording I think isLocalBuild
is best. I must have missed this one.
@asbjornu the hour thing is only for tests that ignores minutes and seconds cause it would be cause test failures. The local version number is timestamped down to seconds so everytime you build you will get a new package version with the new version. Together with custom The desire for this is ease local development between libraries. |
I will agree that this may not be something for GitVersion to accept as it is very different premise. Perhaps it could be hidden behind a GitVersion configuration otherwise we will continue to use our current solution we have in our specialized msbuild targets. |
To be honest I don't think we need to cover this specific scenario |
This specific scenario should be handled outside of the GitVersion tool |
No worries, thanks for taking the time to review the PR ❤️ |
I think #1385 points to a direction you might take to solve this, @Casz. See |
Thanks may look into |
fixes #1570