gusztavvargadr / packer

Packer templates for building Windows and Ubuntu images
https://app.vagrantup.com/gusztavvargadr
The Unlicense
457 stars 67 forks source link

dotnet cake --target=info shows an error on macos. #468

Open Techienaut opened 4 days ago

Techienaut commented 4 days ago

I went through the entire steps in https://github.com/gusztavvargadr/packer/blob/master/samples/README.md?plain=1 to install dependencies (e.g. dotnet, cake, etc etc).

I'm getting this error when I enter: dotnet cake --target=info on my macbook: Error: Argument 'sample' was not set.

dotnet is in my PATH. The git folder name is "packer" and I'm in the root of that folder. I downloaded all the submodules for git.

More Info

When I enter dotnet cake --target=info --verbosity=diagnostic I get error:

Compiling build script...
Error: Cake.Core.CakeException: Argument 'sample' was not set.
   at Cake.Common.ArgumentAliases.Argument[T](ICakeContext context, String name) in C:\projects\cake\src\Cake.Common\ArgumentAliases.cs:line 86
   at Submission#0.Argument[T](String name)
   at Submission#0.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at Cake.Infrastructure.Scripting.RoslynScriptSession.Execute(Script script) in C:\projects\cake\src\Cake\Infrastructure\Scripting\RoslynScriptSession.cs:line 206
   at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath) in C:\projects\cake\src\Cake.Core\Scripting\ScriptRunner.cs:line 172
   at Cake.Features.Building.BuildFeature.RunCore(ICakeArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 99
   at Cake.Features.Building.BuildFeature.Run(ICakeArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 49
   at Cake.Commands.DefaultCommand.Execute(CommandContext context, DefaultCommandSettings settings) in C:\projects\cake\src\Cake\Commands\DefaultCommand.cs:line 76
gusztavvargadr commented 2 days ago

@Techienaut related to your other issue #467, unfortunately, the docs are still lacking a bit after a recent update, that's why it's commented out in the README. The not rendered part is the old version which is slightly out of date, although the concepts are the same. Please see this discussion for a similar query: https://github.com/gusztavvargadr/packer/discussions/449#discussioncomment-10089850

To start a build in the new setup use the configuration parameter as follows:

dotnet cake --configuration windows-server/2022-standard/virtualbox/native
dotnet cake --configuration windows-server/2022-standard/virtualbox/vagrant

The first command will build the native image, the second one will use the first one's output to build a Vagrant box.

For the time being while the docs are not updated, you can take a look at the pipeline definitions for working samples of the usage and the source of the build script itself.

Sorry for the inconvenience and please let me know if you have any other questions.