diff --git a/docs/build-server-support/build-server/continua.md b/docs/build-server-support/build-server/continua.md index 840eee9eff..156148479c 100644 --- a/docs/build-server-support/build-server/continua.md +++ b/docs/build-server-support/build-server/continua.md @@ -1,45 +1,45 @@ -# Continua CI Setup - -This guide explains how to run GitVersion inside [Continua CI](https://www.finalbuilder.com/continua-ci). - -## Assumptions -This guide assumes a few variables are present in the configuration. Note that this example uses `Catel` as repository name, but it should be replaced by the name of the repository where GitVersion is runnign against. - -* RepositoryBranchName => $Source.Catel.BranchName$ -* RepositoryCommitId => $Source.Catel.LatestChangeset.Id$ -* RepositoryName => Catel -* RepositoryName => $Source.Catel.Path$ -* RepositoryUrl => $Source.Catel.Url$ - -It also requires a few variables which will automatically be filled by GitVersion. The example below are just a few, any of the GitVersion variables written to the output can be used. - -* GitVersion_FullSemVer -* GitVersion_MajorMinorPatch -* GitVersion_NuGetVersion - -You also need to add a property collector for the agents to detect the GitVersion tool on the agents: - -* Namespace => GitVersion -* Run On => Agent -* Type => Path Finder Plugin -* Property Name => Path -* Executable => GitVersion.exe -* Search paths => your installation folder (e.g. `C:\Tools\GitVersion` or if you are using Chocolatey `C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools`) - -## Basic Usage -To run GitLink inside [Continua CI](https://www.finalbuilder.com/continua-ci), follow the steps below: - -* Add a new `Execute Program` step to a stage -* In the `Execute Program` tab, set the following values: - * Executable path: $Agent.GitVersion.Path$ - * Working directory: %RepositoryPath% -* In the `Arguments` tab, set the following values: - * Arguments: /url %RepositoryUrl% /b %RepositoryBranchName% /c %RepositoryCommitId% /output buildserver -* In the `Options` tab, set the following values: - * Wait for completion: checked - * Log output: checked - * Check program exit code: checked - * Exit code must be: equal to - * Exit code: 0 - -Now GitVersion will automatically run and fill the `GitVersion_` variables. +# Continua CI Setup + +This guide explains how to run GitVersion inside [Continua CI](https://www.finalbuilder.com/continua-ci). + +## Assumptions +This guide assumes a few variables are present in the configuration. Note that this example uses `Catel` as repository name, but it should be replaced by the name of the repository where GitVersion is runnign against. + +* RepositoryBranchName => $Source.Catel.BranchName$ +* RepositoryCommitId => $Source.Catel.LatestChangeset.Id$ +* RepositoryName => Catel +* RepositoryName => $Source.Catel.Path$ +* RepositoryUrl => $Source.Catel.Url$ + +It also requires a few variables which will automatically be filled by GitVersion. The example below are just a few, any of the GitVersion variables written to the output can be used. + +* GitVersion_FullSemVer +* GitVersion_MajorMinorPatch +* GitVersion_NuGetVersion + +You also need to add a property collector for the agents to detect the GitVersion tool on the agents: + +* Namespace => GitVersion +* Run On => Agent +* Type => Path Finder Plugin +* Property Name => Path +* Executable => GitVersion.exe +* Search paths => your installation folder (e.g. `C:\Tools\GitVersion` or if you are using Chocolatey `C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools`) + +## Basic Usage +To run GitLink inside [Continua CI](https://www.finalbuilder.com/continua-ci), follow the steps below: + +* Add a new `Execute Program` step to a stage +* In the `Execute Program` tab, set the following values: + * Executable path: $Agent.GitVersion.Path$ + * Working directory: %RepositoryPath% +* In the `Arguments` tab, set the following values: + * Arguments: /url %RepositoryUrl% /b %RepositoryBranchName% /c %RepositoryCommitId% /output buildserver +* In the `Options` tab, set the following values: + * Wait for completion: checked + * Log output: checked + * Check program exit code: checked + * Exit code must be: equal to + * Exit code: 0 + +Now GitVersion will automatically run and fill the `GitVersion_` variables. diff --git a/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj b/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj index 3a43e6a0d5..d10be5be83 100644 --- a/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj +++ b/src/GitVersionCore.Tests/GitVersionCore.Tests.csproj @@ -1,6 +1,6 @@  - + Debug @@ -51,7 +51,7 @@ True - ..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll + ..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll True @@ -212,7 +212,7 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs b/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs index 43858d43d0..a612913953 100644 --- a/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs +++ b/src/GitVersionCore.Tests/Mocks/MockQueryableCommitLog.cs @@ -42,6 +42,11 @@ public IEnumerable QueryBy(string path, FollowFilter filter) throw new NotImplementedException(); } + public IEnumerable QueryBy(string path, CommitFilter filter) + { + throw new NotImplementedException(); + } + public Commit FindMergeBase(Commit first, Commit second) { return null; diff --git a/src/GitVersionCore.Tests/Mocks/MockRepository.cs b/src/GitVersionCore.Tests/Mocks/MockRepository.cs index b10691906c..cf84a8dd73 100644 --- a/src/GitVersionCore.Tests/Mocks/MockRepository.cs +++ b/src/GitVersionCore.Tests/Mocks/MockRepository.cs @@ -47,6 +47,11 @@ public Branch Checkout(Commit commit, CheckoutOptions options) throw new NotImplementedException(); } + public void Checkout(Tree tree, IEnumerable paths, CheckoutOptions opts) + { + throw new NotImplementedException(); + } + public void CheckoutPaths(string committishOrBranchSpec, IEnumerable paths, CheckoutOptions checkoutOptions = null) { throw new NotImplementedException(); @@ -197,6 +202,11 @@ public string Describe(Commit commit, DescribeOptions options) throw new NotImplementedException(); } + public void RevParse(string revision, out Reference reference, out GitObject obj) + { + throw new NotImplementedException(); + } + public Branch Head { get; set; } public Configuration Config { get; set; } public Index Index { get; set; } diff --git a/src/GitVersionCore.Tests/packages.config b/src/GitVersionCore.Tests/packages.config index 2040502656..9af7742567 100644 --- a/src/GitVersionCore.Tests/packages.config +++ b/src/GitVersionCore.Tests/packages.config @@ -4,8 +4,8 @@ - - + + diff --git a/src/GitVersionCore/GitVersionCore.csproj b/src/GitVersionCore/GitVersionCore.csproj index cd4b515941..98a2186c6e 100644 --- a/src/GitVersionCore/GitVersionCore.csproj +++ b/src/GitVersionCore/GitVersionCore.csproj @@ -1,6 +1,6 @@  - + Debug @@ -48,7 +48,7 @@ False - ..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll + ..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll True @@ -197,7 +197,7 @@ - + diff --git a/src/GitVersionCore/packages.config b/src/GitVersionCore/packages.config index 179506243b..e1db441a64 100644 --- a/src/GitVersionCore/packages.config +++ b/src/GitVersionCore/packages.config @@ -4,8 +4,8 @@ - - + + diff --git a/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj b/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj index 39fc8addb2..2e4cb93319 100644 --- a/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj +++ b/src/GitVersionExe.Tests/GitVersionExe.Tests.csproj @@ -1,6 +1,6 @@  - + Debug @@ -44,7 +44,7 @@ True - ..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll + ..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll True @@ -156,6 +156,6 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/src/GitVersionExe.Tests/PullRequestInTeamCityTest.cs b/src/GitVersionExe.Tests/PullRequestInTeamCityTest.cs index 060ab92c6f..84484f0afd 100644 --- a/src/GitVersionExe.Tests/PullRequestInTeamCityTest.cs +++ b/src/GitVersionExe.Tests/PullRequestInTeamCityTest.cs @@ -26,22 +26,25 @@ public void GivenARemoteWithATagOnMaster_AndAPullRequestWithTwoCommits_AndBuildI remoteRepository.MakeATaggedCommit("1.0.3"); var branch = remoteRepository.CreateBranch("FeatureBranch"); - remoteRepository.Checkout(branch); + Commands.Checkout(remoteRepository, branch); remoteRepository.MakeCommits(2); - remoteRepository.Checkout(remoteRepository.Head.Tip.Sha); + Commands.Checkout(remoteRepository, remoteRepository.Head.Tip.Sha); //Emulate merge commit var mergeCommitSha = remoteRepository.MakeACommit().Sha; - remoteRepository.Checkout("master"); // HEAD cannot be pointing at the merge commit + Commands.Checkout(remoteRepository, "master"); // HEAD cannot be pointing at the merge commit remoteRepository.Refs.Add(pullRequestRef, new ObjectId(mergeCommitSha)); // Checkout PR commit Commands.Fetch((Repository)fixture.Repository, "origin", new string[0], new FetchOptions(), null); - fixture.Repository.Checkout(mergeCommitSha); + Commands.Checkout(fixture.Repository, mergeCommitSha); } var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, isTeamCity: true); result.ExitCode.ShouldBe(0); + + result.Output.ShouldStartWith("{", "we expect valid json output to parse back output variables"); + result.OutputVariables.FullSemVer.ShouldBe("1.0.4-PullRequest0005.3"); // Cleanup repository files diff --git a/src/GitVersionExe.Tests/packages.config b/src/GitVersionExe.Tests/packages.config index 7755ca183c..7105e8ee0c 100644 --- a/src/GitVersionExe.Tests/packages.config +++ b/src/GitVersionExe.Tests/packages.config @@ -2,8 +2,8 @@ - - + + diff --git a/src/GitVersionExe/GitVersionExe.csproj b/src/GitVersionExe/GitVersionExe.csproj index db387204a5..8b7f8391d5 100644 --- a/src/GitVersionExe/GitVersionExe.csproj +++ b/src/GitVersionExe/GitVersionExe.csproj @@ -1,6 +1,6 @@  - + Debug AnyCPU @@ -50,7 +50,7 @@ False - ..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll + ..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll True @@ -219,7 +219,7 @@ - + diff --git a/src/GitVersionExe/packages.config b/src/GitVersionExe/packages.config index 2dc57dc5c0..0eb81cff2e 100644 --- a/src/GitVersionExe/packages.config +++ b/src/GitVersionExe/packages.config @@ -5,8 +5,8 @@ - - + + \ No newline at end of file diff --git a/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj b/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj index 972b551f43..4f9b051b36 100644 --- a/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj +++ b/src/GitVersionTask.Tests/GitVersionTask.Tests.csproj @@ -1,6 +1,6 @@  - + Debug AnyCPU @@ -61,7 +61,7 @@ True - ..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll + ..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll True @@ -221,7 +221,7 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/src/GitVersionTask.Tests/packages.config b/src/GitVersionTask.Tests/packages.config index 3c08cb8fc3..84be3469a3 100644 --- a/src/GitVersionTask.Tests/packages.config +++ b/src/GitVersionTask.Tests/packages.config @@ -5,8 +5,8 @@ - - + + diff --git a/src/GitVersionTask/GitVersionTask.csproj b/src/GitVersionTask/GitVersionTask.csproj index f4e0a6edc3..8043b375b8 100644 --- a/src/GitVersionTask/GitVersionTask.csproj +++ b/src/GitVersionTask/GitVersionTask.csproj @@ -1,6 +1,6 @@  - + Debug @@ -44,7 +44,7 @@ True - ..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll + ..\packages\LibGit2Sharp.0.23.0-pre20160922233542\lib\net40\LibGit2Sharp.dll True @@ -139,7 +139,7 @@ - + diff --git a/src/GitVersionTask/packages.config b/src/GitVersionTask/packages.config index b25f2bf091..d9f8c3d0a7 100644 --- a/src/GitVersionTask/packages.config +++ b/src/GitVersionTask/packages.config @@ -4,8 +4,8 @@ - - + + \ No newline at end of file