gaelcolas / Sampler

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

adding some fixes #428

Open gaelcolas opened 1 year ago

gaelcolas commented 1 year ago

Fixing template and deprecating an old task we probably shouldn't be using anymore...

Asking @johlju to review and assess the impact.


This change is Reviewable

codecov[bot] commented 1 year ago

Codecov Report

Merging #428 (52f2237) into main (16933e1) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #428   +/-   ##
===================================
  Coverage    81%    81%           
===================================
  Files        44     44           
  Lines      2319   2319           
===================================
  Hits       1899   1899           
  Misses      420    420           
gaelcolas commented 1 year ago

We probably should raise an issue in the affected repos before merging/releasing then. Yes, I should think through the changes required for the RequiredModules. For me the old task was always a problem in new projects.

Regarding the ReleaseAssets:, it's not used by default, but it's very useful to add stuff to the GitHub release... https://github.com/chocolatey-community/Chocolatey/releases/tag/v0.2.0-preview0009

For instance in the Chocolatey module I add the Azure Automanage Machine Configuration packages/zips: image

johlju commented 1 year ago

Regarding the ReleaseAssets:, it's not used by default, but it's very useful to add stuff to the GitHub release...

Cool. Will see if I can implement it for SqlServerDsc (and then add it to Sampler).

johlju commented 1 year ago

We probably should raise an issue in the affected repos before merging/releasing then.

Maybe I have a script to create an issue in several repos. Though, I wonder if it easier to just propose a PR in each repo, then we can fix the the VM image to windows-latest for the build phase too.

Repos that need to change:

johlju commented 1 year ago

I will slowly fix the most used repos so we can get this merged.

johlju commented 1 year ago

After trying to update SharePointDsc and failed - concluded the task in Sampler cannot be removed because the new task in DscResource.Test only support Pester 5 currently. The task in Sampler uses the v4 tests in DscResource.Test.

The DscResource.Test command Invoke-DscResourceTest it seems it can run both the v4 and v5 tests depending on what version is installed but the new task does not use that command - not sure why, maybe we never got that far. There need to be a refactoring of the command and the new task. There are a lot of logic in the new task that is not in the command. But that might just be okay since the task knows how to read from build.yaml, but in the end maybe it should call the command as well.

Old task calls the command.

https://github.com/gaelcolas/Sampler/blob/a14049c5241e75f52270d292c026d67dac173a92/.build/tasks/DscResource.Test.build.ps1#L232

The new task calls Invoke-Pester directly.

https://github.com/dsccommunity/DscResource.Test/blob/88d3e7bb7aa59406d6fc3ff260649be6b462c0e6/source/tasks/Invoke_HQRM_Tests.build.ps1#L458-L465

johlju commented 1 year ago

This is to much work to do now. :/ I put it back on the back-burner...