gaelcolas / Sampler

Module template with build pipeline and examples, including DSC elements.
MIT License
167 stars 42 forks source link

Build fails when using SimpleModule template and choosing to not use Git #482

Open johlju opened 1 month ago

johlju commented 1 month ago

Problem description

Creating a module using template SimpleModule and saying no to the question to use git will make the build fail.

Verbose logs

Unhandled exception. System.IO.DirectoryNotFoundException: Cannot find the .git directory
   at GitVersion.Git.GitRepositoryInfo.GetProjectRootDirectory() in /private/tmp/gitversion-20240722-7185-xp03bq/GitVersion-6.0.0/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs:line 88

How to reproduce

Create a module:

mkdir TestModule
cd TestModule
New-SampleModule -DestinationPath '..\' -ModuleType 'SimpleModule' -ModuleAuthor 'DSC Community contributors' -ModuleName (Split-Path -Leaf $PWD) -ModuleDescription 'no description' -LicenseType MIT -SourceDirectory 'source' -ModuleVersion '0.0.1'

Build the module:

./build.ps1 -ResolveDependency -Tasks noop
./build.ps1

Expected behavior

Module generated from template should pass build (and test).

Current behavior

Build fails with message indicating Git is required.

Suggested solution

Must be a requirement for git that is not removed when the Plaster template question for Git is set to 'No'.

Operating system the target node is running

ProductName:        macOS
ProductVersion:     14.5
BuildVersion:       23F79

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module version used

Name    Version Path
----    ------- ----
Sampler 0.118.1 /Users/johlju/source/HelpUsers/KarstenHabay/TestModule/output/RequiredModules/Sampler/0.118.1/Sampler.psd1