Skip to content

Commit 747128f

Browse files
committed
Automated Release 194
1 parent bcd79f9 commit 747128f

109 files changed

Lines changed: 1391 additions & 10162 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

blog/add-codecov-support-to-repository/index.html

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<meta charset="utf-8">
33
<title>Add Code Coverage Support to Repository</title>
44

5-
<meta name="generator" content="Hugo 0.136.5">
5+
<meta name="generator" content="Hugo 0.148.2">
66

77
<!-- mobile responsive meta -->
88
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -197,6 +197,8 @@
197197
</li>
198198
<li class=" active "><a href="/blog/dsc-is-dead-long-live-dsc/">DSC is Dead</a>
199199
</li>
200+
<li class=" active "><a href="/blog/your-first-class-based-microsoft-dsc-v3-resource/">Your first class-based Microsoft DSC v3 resource</a>
201+
</li>
200202
<li class=" active "><a href="/blog/convert-tests-to-pester5-for-dsc-community-repository/">Convert tests to Pester 5 for a DSC Community repository</a>
201203
</li>
202204
<li class=" active "><a href="/blog/convert-master-to-main/">Steps to rename master branch to main for a DSC Community resource</a>
@@ -384,8 +386,7 @@ <h2 id="introduction">Introduction</h2>
384386
the GitHub repository (at the commit). Azure Pipelines code coverage
385387
generate source files form the code that are available in the pipeline,
386388
and it can only be a single path, and that single path does not support
387-
pattern matching.</p>
388-
</blockquote>
389+
pattern matching.</p></blockquote>
389390
<p>To upload code coverage we need to:</p>
390391
<ul>
391392
<li>change the <code>build.yaml</code></li>
@@ -427,8 +428,7 @@ <h3 id="modify-buildyaml">Modify <code>build.yaml</code></h3>
427428
</span></span></code></pre></div><blockquote>
428429
<p><em>NOTE:</em> the filename can be anything after the prefix <code>JaCoCo</code>, for example
429430
it is possible to use <code>JaCoCo_$OsShortName.xml</code> which results in
430-
the filename <code>JaCoCO_macOs.xml</code> when the test task is run on macOS.</p>
431-
</blockquote>
431+
the filename <code>JaCoCO_macOs.xml</code> when the test task is run on macOS.</p></blockquote>
432432
<h3 id="modify-azure-pipelinesyml">Modify <code>azure-pipelines.yml</code></h3>
433433
<p>From the job <code>Test_Unit</code> we can remove the task <code>Set Environment Variables</code>
434434
and the task <code>Publish Code Coverage</code>. Those two task will be moved to the
@@ -561,19 +561,17 @@ <h4 id="add-global-variables">Add global variables</h4>
561561
</span></span><span style="display:flex;"><span> <span style="color:#f92672">summaryFileLocation</span>: <span style="color:#e6db74">&#39;$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml&#39;</span>
562562
</span></span><span style="display:flex;"><span> <span style="color:#f92672">pathToSources</span>: <span style="color:#e6db74">&#39;$(Build.SourcesDirectory)/$(sourceFolderName)/&#39;</span>
563563
</span></span><span style="display:flex;"><span> - <span style="color:#f92672">script</span>: |<span style="color:#e6db74">
564-
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> bash &lt;(curl -s https://codecov.io/bash) -f &#34;./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml&#34;</span>
564+
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> bash &lt;(curl -s https://codecov.io/bash) -f &#34;./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml&#34;</span>
565565
</span></span><span style="display:flex;"><span> <span style="color:#f92672">displayName</span>: <span style="color:#e6db74">&#39;Publish Code Coverage to Codecov.io&#39;</span>
566566
</span></span></code></pre></div><h3 id="add-codecovyml">Add <code>codecov.yml</code></h3>
567567
<p>This file is not necessary if Codecov.io is not used.</p>
568568
<blockquote>
569569
<p><strong>NOTE:</strong> Make sure to update the default branch name in the Codecov.io
570-
project site if the default branch name is renamed.</p>
571-
</blockquote>
570+
project site if the default branch name is renamed.</p></blockquote>
572571
<blockquote>
573572
<p><strong>NOTE:</strong> If this file exist and starts with a full stop <code>.</code>, e.g. <code>.codecov.yml</code>,
574573
then please rename it to <code>codecov.yml</code>. See this FAQ for more information
575-
<a href="https://docs.codecov.io/docs/codecov-yaml#section-can-i-name-the-file-codecov-yml">https://docs.codecov.io/docs/codecov-yaml#section-can-i-name-the-file-codecov-yml</a></p>
576-
</blockquote>
574+
<a href="https://docs.codecov.io/docs/codecov-yaml#section-can-i-name-the-file-codecov-yml">https://docs.codecov.io/docs/codecov-yaml#section-can-i-name-the-file-codecov-yml</a></p></blockquote>
577575
<p>These settings can be set as desired, but the values below are what are used
578576
by default in the DSC Community repositories.</p>
579577
<p>The important part is the key <code>fixes</code>. <a href="https://codecov.io">Codecov.io</a>
@@ -589,8 +587,7 @@ <h4 id="add-global-variables">Add global variables</h4>
589587
expects.</p>
590588
<blockquote>
591589
<p>See the <a href="https://docs.codecov.io/docs/codecovyml-reference">codecov.yml Reference</a>
592-
for more information about these settings.</p>
593-
</blockquote>
590+
for more information about these settings.</p></blockquote>
594591
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">codecov</span>:
595592
</span></span><span style="display:flex;"><span> <span style="color:#f92672">require_ci_to_pass</span>: <span style="color:#66d9ef">no</span>
596593
</span></span><span style="display:flex;"><span> <span style="color:#75715e"># main should be the baseline for reporting</span>
@@ -719,8 +716,7 @@ <h3 id="modify-buildyaml-2">Modify <code>build.yaml</code></h3>
719716
<blockquote>
720717
<p><em>NOTE:</em> the filename can be anything after the prefix <code>JaCoCo</code>, for example
721718
it is possible to use <code>JaCoCo_$OsShortName.xml</code> which results in
722-
the filename <code>JaCoCO_macOs.xml</code> when the test task is run on macOS.</p>
723-
</blockquote>
719+
the filename <code>JaCoCO_macOs.xml</code> when the test task is run on macOS.</p></blockquote>
724720
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">Pester</span>:
725721
</span></span><span style="display:flex;"><span> <span style="color:#f92672">OutputFormat</span>: <span style="color:#ae81ff">NUnitXML</span>
726722
</span></span><span style="display:flex;"><span> <span style="color:#f92672">ExcludeFromCodeCoverage</span>:
@@ -763,8 +759,7 @@ <h3 id="modify-buildyaml-2">Modify <code>build.yaml</code></h3>
763759
that will be uploaded to the code coverage services.</p>
764760
<blockquote>
765761
<p><strong>NOTE:</strong> For the service Codecov.io the filename must be prefixed with
766-
&lsquo;JaCoCo&rsquo;.</p>
767-
</blockquote>
762+
&lsquo;JaCoCo&rsquo;.</p></blockquote>
768763
<p>The keyword <code>CodeCoverageFilePattern</code> is the pattern to recursively look
769764
for under the <code>output/testResults</code> folder. It should use a pattern that
770765
can recognize the JaCoCo files that the test jobs generate.</p>

blog/class-based-dsc-resources/index.html

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<meta charset="utf-8">
33
<title>Class Based DSC Resource only proposal</title>
44

5-
<meta name="generator" content="Hugo 0.136.5">
5+
<meta name="generator" content="Hugo 0.148.2">
66

77
<!-- mobile responsive meta -->
88
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -197,6 +197,8 @@
197197
</li>
198198
<li class=" active "><a href="/blog/dsc-is-dead-long-live-dsc/">DSC is Dead</a>
199199
</li>
200+
<li class=" active "><a href="/blog/your-first-class-based-microsoft-dsc-v3-resource/">Your first class-based Microsoft DSC v3 resource</a>
201+
</li>
200202
<li class=" active "><a href="/blog/convert-tests-to-pester5-for-dsc-community-repository/">Convert tests to Pester 5 for a DSC Community repository</a>
201203
</li>
202204
<li class=" active "><a href="/blog/convert-master-to-main/">Steps to rename master branch to main for a DSC Community resource</a>
@@ -353,12 +355,8 @@ <h2>Class Based DSC Resource only proposal</h2>
353355
<p>The suggested change was only for DSC Resources schema, and no changes to MOF compilations was announced for now. Removing the CIM/MI/MOF code and dependency is definitely an overarching goal for PowerShell, but it won&rsquo;t happen overnight.</p>
354356
<p>Let&rsquo;s add that when we mention change to PowerShell, it only affects the version 7.2 and up. <strong>Windows PowerShell 5.1 will (mostly) be untouched and unaffected</strong>.</p>
355357
<p>After discussing the matter with the community via the GitHub issues, Twitter, and the DSC Community Call, the Powershell team published a change of direction: they intend to <a href="https://github.com/PowerShell/PowerShell/issues/13731">start with supporting DSC Class based resources only</a> (but are still open for discussion).</p>
356-
357-
358-
359-
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
360-
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/toTwph350zY?autoplay=0&controls=1&end=0&loop=0&mute=0&start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"
361-
></iframe>
358+
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
359+
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/toTwph350zY?autoplay=0&amp;controls=1&amp;end=0&amp;loop=0&amp;mute=0&amp;start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"></iframe>
362360
</div>
363361

364362
<h1 id="opinions">Opinions</h1>
@@ -426,8 +424,7 @@ <h3 id="why-mof-and-cim-to-begin-with">Why MOF and CIM, to begin with?</h3>
426424
Bear in mind PS 5.1 is set in stone, so it won&rsquo;t get updated.</p>
427425
<p>And that leads us to <strong>the major flaw</strong>, in my opinion, for <a href="https://github.com/PowerShell/PowerShell/issues/13359">the former JSON-based DSC resource proposal</a>: We&rsquo;d have to replace the <code>[Microsoft.Management.Infrastructure.CimInstance[]]</code> with <code>[PSObject]</code>.</p>
428426
<blockquote>
429-
<p>With this change, embedded objects passed to Get/Set/Test will be PSObjects instead of CimInstances. Unless the script is explicitly checking that it is a CimInstance, existing code should work with PSObject.</p>
430-
</blockquote>
427+
<p>With this change, embedded objects passed to Get/Set/Test will be PSObjects instead of CimInstances. Unless the script is explicitly checking that it is a CimInstance, existing code should work with PSObject.</p></blockquote>
431428
<p>Doing so would <strong>break compatibility between PS 5.1 and PS 7+</strong> for any resource using such subtypes / embedded objects.</p>
432429
<p>Using class-based DSC resource, and the <code>if {} else {}</code> workaround I mentioned above, would support greater backward compatibility scenarios.</p>
433430
<p>Obviously, there&rsquo;s still a lot of differences between PS5.1 and PS7 which means for some resources it may not be possible to be used in PS7 anyway<br>
@@ -450,12 +447,8 @@ <h2 id="dsc-community-does-not-use-class-based-resources">DSC Community does not
450447
<p>Since then we had a DSC Community call were Bartek Bielawski (<a href="https://twitter.com/bielawb?lang=en">@bielawb</a> on Twitter) came to <a href="https://youtu.be/r-eKNZ7iEfw?t=172">present on the class resources</a> that he&rsquo;s been using in production for a while (along with Daniel Both <a href="https://twitter.com/poshboth">@poshboth</a>).<br>
451448
We also got more experience with Class-based resource with <a href="https://github.com/dsccommunity/JeaDsc/tree/master/source/DSCClassResources"><code>JeaDsc</code></a>, although it&rsquo;s not the approach I would <em>recommend</em> today. Great experience nonetheless, and great work.</p>
452449
<p>We&rsquo;ve made several changes to our pipeline automation, and getting to a point (soon) where adding DSC Class Resource should be easier.</p>
453-
454-
455-
456-
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
457-
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/bbpFBsl8K9k?autoplay=0&controls=1&end=0&loop=0&mute=0&start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"
458-
></iframe>
450+
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
451+
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/bbpFBsl8K9k?autoplay=0&amp;controls=1&amp;end=0&amp;loop=0&amp;mute=0&amp;start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"></iframe>
459452
</div>
460453

461454
<p>I also had to dig a lot deeper when I worked on the <code>Invoke-DscResource</code> RFC with the PowerShell team for PowerShell 7.</p>
@@ -481,8 +474,7 @@ <h2 id="unit-testing-classes-and-class-based-dsc-resources-is-hard">Unit Testing
481474
</span></span><span style="display:flex;"><span>Mock -CommandName Get-Service -MockWith {[<span style="color:#66d9ef">pscustomobject</span>]@{Name=<span style="color:#e6db74">&#39;Docker&#39;</span>}}
482475
</span></span></code></pre></div><p>Worth noting, Jakub Jares (<a href="https://twitter.com/nohwnd">@nohwnd</a>, the maintainer of Pester) is <a href="https://twitter.com/nohwnd/status/1308715571756912640?s=20">suggesting to build this in Pester 5</a> (go upvote now, please).</p>
483476
<blockquote>
484-
<p><a href="https://twitter.com/nohwnd/status/1308752521142435842?s=20"><em>@nowhnd:</em></a> The api would probably look like this: Mock -Type ([DateTime]) -Property Now -Get <the value> But imho the final form is not that important. It does work on PowerShell classes. In the end you should be able to use this to replace almost any method and property.</p>
485-
</blockquote>
477+
<p><a href="https://twitter.com/nohwnd/status/1308752521142435842?s=20"><em>@nowhnd:</em></a> The api would probably look like this: Mock -Type ([DateTime]) -Property Now -Get <the value> But imho the final form is not that important. It does work on PowerShell classes. In the end you should be able to use this to replace almost any method and property.</p></blockquote>
486478
<p>Again, that&rsquo;s definitely something that we will work on and document, but I don&rsquo;t see this as a major obstacle.<br>
487479
We could also mock by inheriting the class and overridding that method.</p>
488480
<p>Now, I&rsquo;d like to slide-in another opinion, which might be unpopular, but your DSC Resource PSM1 or Class should not be thousands of lines long.<br>

0 commit comments

Comments
 (0)