dsccommunity/ExchangeDsc

xExchange: Move the module to automatic release

SSvilen opened this issue · 25 comments

Hi @mhendric ,

I confirmed with @johlju, that the old method of delivering the DSC modules is not decommissioned. So in order to realse the changes made in the couple if months, the module has to be moved to the new automated release. (described here)

I'm willing to do that transition, as I want to gather some experience with Azure DevOps and building complex modules. Let me know!

Hey SSvilen, that would be awesome. Thanks for volunteering!

Updated steps here https://gist.github.com/johlju/2ad77aa574aa07d3e9953fe86007731c

They are not complete just yet but I got xFailOverCluster through the CI so tomorrow I will look at the final steps.

Hey @SSvilen , I think I'm going to have to do at least some of the steps in (https://dsccommunity.org/blog/convert-a-module-for-continuous-delivery/), specifically the release related stuff that requires admin rights on the repo. You should still be able to submit a PR with most of the changes once you're ready though. I'll try to get the releases in order sometime this week.

Hi @mhendric ,

So far were only the tags a problem. They are now ok on my branch, but I don't know what will happen during the merge.
I'm right now getting the Unit and Integration Tests to work and then will do a test pipeline with my Azure DevOps org. Then I'll open the PR, because the steps afterwards require admin access.

The critical point is when the dev branch is merged into master, after dev branch has been rebased with the master branch. @SSvilen if you ignoring any commits (on date) that are in the master branch then you should be okay I think.

The problem is if it detects a commit without a correct tag, and that commit has any of this in the commit title or description '\s?(breaking|major|breaking\schange)' (from the file GitVersion.yml). But ignoring commits older than a specific date, or ignoring specific commit SHAs helped me avoid this.

I had to stop (cancel) the pipeline in one case, because I missed that it raised the major version in the PR for merging dev into master. But if you get it right in that PR, it should be okay when you merge the PR into master.

I'm ignoring everything older than 30.10.2019, because gitversion could not properly detect and iterate the version. I'll check tonight if there are any commits in the last two months with some of the keywords for bumping the major version.

Hi @johlju @gaelcolas ,

I need help here. The Azure pipelines are failing with

Invoke-Build.ps1 : Missing property 'ProjectName'.

The module works locally on my laptop with PS 7 and WSL with PS 6. I don#t understand what the problem with Azure is.
Thats my branch.

I trying running your branch now.

@mhendric I have updated the tags in this repo (dependency for gitversion to work). Make sure to delete any tags *-PSGallery from your local repos and from your fork. Only tags named vX.Y.Z should be left. See How To Delete Local and Remote Tags on Git.

@SSvilen For me it fails on gitversion and it is due to that it cannot parse the date added to gitversion.yml. Same issue I got and needed to go with ignoring SHA instead.

@SSvilen I got it to pass gitversion by rebasing the branch add-new-ci against branch dev (it was outdated).
Then I added this to gitversion.yml. This is all the commit SHA's that wanted to raise the version to 2.0.0 when running gitversion /diag.

ignore:
  sha: [
    cb4bc9584b35fb276cf94b633d421506d9fa1228,
    c984a0f9adf2c088b5a3d9ca43cb7da85777f505,
    11a752d4aca4e4c34fdc7dd9592342e7acbfd992,
    1d417cee9570e819dc47b6ec7f1198a29784464d,
    fb71bdb71077dd0e9006b27b52153432c46080f9,
    d4522d1d4b1e071baa4707e946ccbd965ceed3bb,
    cf6ba476dec244097d5c84acabcb14362277b511,
    f0c2755b62bf262e65ca059fcfc245f6b1474d41,
    ad09bfd1e697e098af2457f6d9e3a112f8a4ca1d,
    ad09bfd1e697e098af2457f6d9e3a112f8a4ca1d,
    7e0223755b7014b127c3f447f27b096c478ccef9,
    5e48918f541d33cb40caf710d37c86f9bd11171a,
    a1817376f56a6925a2f5ff7d13e4a880636a29cb,
    750e36cd3b55c364a5349b0bdcc46f894c751ae6,
    563a3f208d2b51c35b850bf298d8005150ded923,
    cb4bc9584b35fb276cf94b633d421506d9fa1228,
    c984a0f9adf2c088b5a3d9ca43cb7da85777f505,
    11a752d4aca4e4c34fdc7dd9592342e7acbfd992,
    1d417cee9570e819dc47b6ec7f1198a29784464d,
    fb71bdb71077dd0e9006b27b52153432c46080f9,
    d4522d1d4b1e071baa4707e946ccbd965ceed3bb,
    cf6ba476dec244097d5c84acabcb14362277b511,
    f0c2755b62bf262e65ca059fcfc245f6b1474d41,
    ad09bfd1e697e098af2457f6d9e3a112f8a4ca1d,
    ad09bfd1e697e098af2457f6d9e3a112f8a4ca1d,
    7e0223755b7014b127c3f447f27b096c478ccef9,
    5e48918f541d33cb40caf710d37c86f9bd11171a,
    a1817376f56a6925a2f5ff7d13e4a880636a29cb,
    750e36cd3b55c364a5349b0bdcc46f894c751ae6,
    563a3f208d2b51c35b850bf298d8005150ded923
  ]
  commits-before:

Now it is failing on

/home/vsts/work/1/s/output/RequiredModules/InvokeBuild/5.5.6/Invoke-Build.ps1 : Missing property 'ProjectName'.

This fails in PowerShell Core. It is the nested module that is the issue, remove that and the below error does not occur. Looking at that manifest it is save with the wrong encoding (should be UTF-8), fixinf the encoding (and make sure the file is correct) the error does not occur.

/Users/johlju/source/xExchange [add-new-ci ≡ +0 ~1 -0 !]> Test-ModuleManifest ./source/xExchange.psd1
Test-ModuleManifest : The module manifest '/Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1' could not be processed because it is not a valid PowerShell module manifest file. Remove the elements that are not permitted: At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:9 char:3
+ @{
+   ~
Missing closing '}' in statement block or type definition.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:10 char:1
+ ਍ഀഀ
+ ~~~
Unexpected token '਍ഀഀ' in expression or statement.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:73 char:45
+         'Get-ExistingRemoteExchangeSession',
+                                             ~
Missing expression after ','.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:74 char:1
+ ਍        ✀䜀攀琀ⴀ刀攀洀漀琀攀䔀砀挀栀愀渀最攀匀攀猀猀椀漀渀✀Ⰰഀഀ
+ ~
Unexpected token '਍' in expression or statement.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:75 char:37
+         'New-RemoteExchangeSession',
+                                     ~
Missing expression after ','.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:76 char:1
+ ਍        ✀䤀洀瀀漀爀琀ⴀ刀攀洀漀琀攀䔀砀挀栀愀渀最攀匀攀猀猀椀漀渀✀Ⰰഀഀ
+ ~
Unexpected token '਍' in expression or statement.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:77 char:40
+         'Remove-RemoteExchangeSession',
+                                        ~
Missing expression after ','.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:78 char:1
+ ਍        ✀吀攀猀琀ⴀ䔀砀挀栀愀渀最攀倀爀攀猀攀渀琀✀Ⰰഀഀ
+ ~
Unexpected token '਍' in expression or statement.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:79 char:35
+         'Get-ExchangeVersionYear',
+                                   ~
Missing expression after ','.
At /Users/johlju/source/xExchange/source/Modules/xExchangeHelper/xExchangeHelper.psd1:80 char:1
+ ਍        ✀䜀攀琀ⴀ䔀砀挀栀愀渀最攀唀渀椀渀猀琀愀氀氀䬀攀礀✀ഀഀ
+ ~
Unexpected token '਍' in expression or statement.
Not all parse errors were reported.  Correct the reported errors and try again.
At line:1 char:1
+ Test-ModuleManifest ./source/xExchange.psd1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (/Users/johlju/sourc\u2026ExchangeHelper.psd1:String) [Test-ModuleManifest], MissingMemberException
+ FullyQualifiedErrorId : Modules_InvalidManifest,Microsoft.PowerShell.Commands.TestModuleManifestCommand'

@SSvilen Check the other module manifests as well, the have the same issue.

Hi @johlju,

Thanks a lot. Funny, I’m not passing even the first step. I’ll try again tonight.

I did Test-Modulemanifest on every module this morning inside ubuntu. They were all passing 😳

Maybe you are on a locale that reads UTF16-LE correctly? 🤔

Hi @johlju ,

Changing the helper modules psd1 files to UTF8 did the job.. Thank you!
I did not get any gitversion problems, since I added ignore on everything before end of October.
commits-before: 2019-10-23T00:00:00

Let's see now if all tests pass.

It is good that it works! 😄 For reference, if gitversion step fails with this error then it is date conversion issues. https://dev.azure.com/viscalyx/xExchange/_build/results?buildId=265&view=logs&j=106e58e8-a59e-5cbd-0716-376180231163&t=cc899c23-0acc-5cd0-5295-95cfdd0edd43&l=293

Hi @johlju ,

Me again. :) Looks like HQRM tests are testing the files in Examples folder. Can we turn that off somehow? I tried that in the build.yaml, but did not work:
ExcludeSourceFile:
- output
- Examples

No worries, just ask away :) You can opt-out from the specific tests. There should already one test opt-out by default under the DscTag:, just add the test description there (the one in the Describe-block) or you could exclude a tag if that is simpler/possible.

@johlju , I think all the steps in https://dsccommunity.org/blog/convert-a-module-for-continuous-delivery/ have been completed. Any chance you can give this repo a once over and make sure we didn't mess anything up? Thanks.

Sure. Can do that tomorrow. Working on xSystemSecurity today :)

Looks good to me. Sent in a PR to update the pipeline files to the latest.