Skip to content

Commit 9d56ef3

Browse files
authored
Merge branch 'main' into windows-setting-language
2 parents b482a12 + 569b657 commit 9d56ef3

File tree

8 files changed

+187
-37
lines changed

8 files changed

+187
-37
lines changed

.github/actions/spelling/allow.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ codeowners
1111
github
1212
https
1313
Icm
14+
markdownlint
1415
microsoft
1516
msftbot
1617
numpy
@@ -39,3 +40,6 @@ ELSPROBLEMS
3940
requ
4041
whatif
4142
pscustomobject
43+
VGpu
44+
wildcards
45+
worktree
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
wildcards
2-
ssh
1+
AKV
32
Amd
4-
usr
5-
screenshots
3+
Authenticode
4+
automerge
65
currentstate
6+
esrp
7+
gtm
8+
msft
9+
NPH
10+
Peet
11+
rfc
12+
screenshots
713
Scrollbars
814
Searchbox
9-
VGpu
10-
versioning
11-
worktree
15+
SFP
16+
Signtool
1217
sortby
13-
msft
14-
automerge
15-
Workaround
18+
ssh
19+
usr
20+
versioning
21+
VGpu

.github/actions/spelling/expect/software.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ vscode
22
Linux
33
dotnet
44
dotnettool
5-
cspell
65
NUnit
76
reportgenerator
8-
Toolpackage
9-
markdownlint
7+
markdownlint
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# winget-dsc pipeline to publish module artifacts
2+
name: '$(Build.DefinitionName)-$(Build.DefinitionVersion)-$(Date:yyyyMMdd)-$(Rev:r)'
3+
4+
trigger: none
5+
6+
parameters: # parameters are shown up in ADO UI in a build queue time
7+
8+
- name: moduleName
9+
displayName: 'Name of the module to publish to the PSGallery'
10+
type: string
11+
12+
- name: moduleVersion
13+
displayName: 'Version of the module'
14+
type: string
15+
16+
resources:
17+
repositories:
18+
- repository: self
19+
type: git
20+
ref: refs/heads/main
21+
- repository: 1ESPipelineTemplates
22+
type: git
23+
name: 1ESPipelineTemplates/1ESPipelineTemplates
24+
ref: refs/tags/release
25+
extends:
26+
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
27+
parameters:
28+
pool:
29+
name: Azure-Pipelines-1ESPT-ExDShared
30+
image: windows-2022
31+
os: windows
32+
customBuildTags:
33+
- ES365AIMigrationTooling
34+
settings:
35+
skipBuildTagsForGitHubPullRequests: true
36+
37+
stages:
38+
- stage: Prepare
39+
jobs:
40+
- job: Prepare_Sign
41+
displayName: Prepare and sign ${{ parameters.moduleName }}
42+
steps:
43+
- task: NuGetToolInstaller@1
44+
displayName: 'Use NuGet 6.x'
45+
inputs:
46+
versionSpec: 6.x
47+
- task: PowerShell@2
48+
displayName: Replace module version
49+
inputs:
50+
targetType: inline
51+
pwsh: true
52+
script: |
53+
$manifestContent = (Get-Content -path $(Build.SourcesDirectory)\resources\${{ parameters.moduleName }}\${{ parameters.moduleName }}.psd1 -Raw)
54+
55+
$newManifestContent = $manifestContent -replace "'0.1.0'", "'${{ parameters.moduleVersion }}'"
56+
57+
Set-Content -path $(Build.SourcesDirectory)\resources\${{ parameters.moduleName }}\${{ parameters.moduleName }}.psd1 -Value $newManifestContent
58+
59+
New-Item ToSign -Type Directory
60+
Set-Content -path ToSign\${{ parameters.moduleName }}.psd1 -Value $newManifestContent
61+
Get-Content ToSign\${{ parameters.moduleName }}.psd1 -Raw
62+
63+
Copy-Item -Path "$(Build.SourcesDirectory)\resources\${{ parameters.moduleName }}\${{ parameters.moduleName }}.psm1" -Destination "ToSign\${{ parameters.moduleName }}.psm1" -Force
64+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
65+
displayName: 'Sign manifest'
66+
inputs:
67+
ConnectedServiceName: AppInstallerESRPCodeSigning
68+
AppRegistrationClientId: '32216f16-efc9-4013-9fae-c6a2c54a3fc0'
69+
AppRegistrationTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47'
70+
AuthAKVName: PeetDevOpsKeyVault
71+
AuthCertName: ESRPAuth
72+
AuthSignCertName: ESRPRequestSigning
73+
FolderPath: '$(System.DefaultWorkingDirectory)\ToSign\'
74+
Pattern: '*'
75+
signConfigType: inlineSignParams
76+
inlineOperation: |
77+
[
78+
{
79+
"KeyCode" : "CP-230012",
80+
"OperationCode" : "SigntoolSign",
81+
"Parameters" : {
82+
"OpusName" : "Microsoft",
83+
"OpusInfo" : "http://www.microsoft.com",
84+
"FileDigest" : "/fd \"SHA256\"",
85+
"PageHash" : "/NPH",
86+
"TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
87+
},
88+
"ToolName" : "sign",
89+
"ToolVersion" : "1.0"
90+
},
91+
{
92+
"KeyCode" : "CP-230012",
93+
"OperationCode" : "SigntoolVerify",
94+
"Parameters" : {},
95+
"ToolName" : "sign",
96+
"ToolVersion" : "1.0"
97+
}
98+
]
99+
- task: PowerShell@2
100+
displayName: Copy Signed Files and Validate signature
101+
inputs:
102+
targetType: inline
103+
pwsh: true
104+
script: |
105+
New-Item ToPublish\${{ parameters.moduleName }} -Type Directory
106+
$moduleFolder = "ToPublish\${{ parameters.moduleName }}"
107+
Copy-Item -Path "ToSign\${{ parameters.moduleName }}.psm1" -Destination "ToPublish\${{ parameters.moduleName }}\${{ parameters.moduleName }}.psm1" -Force
108+
Copy-Item -Path "ToSign\${{ parameters.moduleName }}.psd1" -Destination "ToPublish\${{ parameters.moduleName }}\${{ parameters.moduleName }}.psd1" -Force
109+
110+
$notValid = Get-ChildItem $moduleFolder -Recurse -Attributes !Directory | Get-AuthenticodeSignature | where { $_.Status -ne 'Valid' }
111+
if ($null -ne $notValid)
112+
{
113+
$notValid
114+
throw "A file is not signed"
115+
}
116+
- task: CopyFiles@2
117+
displayName: Copy files to be published to staging directory
118+
inputs:
119+
SourceFolder: ToPublish\${{ parameters.moduleName }}
120+
targetFolder: $(Build.ArtifactStagingDirectory)/${{ parameters.moduleName }}
121+
flattenFolders: true
122+
contents: |
123+
*.psm1
124+
*.psd1
125+
- task: 1ES.PublishPipelineArtifact@1
126+
inputs:
127+
targetPath: $(Build.ArtifactStagingDirectory)/${{ parameters.moduleName }}
128+
artifactName: ${{ parameters.moduleName }}
129+
displayName: Publish Module Artifact
130+
131+
- stage: Publish
132+
displayName: Manual Approval
133+
trigger: manual
134+
jobs:
135+
- job: PublishToGallery
136+
steps:
137+
- task: DownloadPipelineArtifact@2
138+
inputs:
139+
buildType: current
140+
artifactName: ${{ parameters.moduleName }}
141+
targetPath: $(System.DefaultWorkingDirectory)/ModuleToPublish/${{ parameters.moduleName }}
142+
itemPattern: |
143+
*.psm1
144+
*.psd1
145+
- pwsh: |
146+
$moduleFolder = "$(System.DefaultWorkingDirectory)/ModuleToPublish/${{ parameters.moduleName }}"
147+
Get-ChildItem -Path $moduleFolder -Recurse
148+
$moduleFolderPath = (Resolve-Path $moduleFolder).Path
149+
Publish-Module -Path $moduleFolderPath -Repository PSGallery -NuGetApiKey $env:api_key -verbose
150+
displayName: Publish ${{ parameters.moduleName }}'
151+
env:
152+
api_key: $(DscSamplesNugetApiKey)
153+

resources/Help/Microsoft.Dotnet.Dsc/DotNetToolPackage.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ The `DotNetToolPackage` DSC Resource allows you to install, update, and uninstal
1919

2020
## PARAMETERS
2121

22-
| **Parameter** | **Attribute** | **DataType** | **Description** | **Allowed Values** |
23-
| ------------------- | ------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
24-
| `PackageId` | Key | String | The ID of the .NET tool package to manage. | N/A |
25-
| `Version` | Optional | String | The version of the .NET tool package to install. If not specified, the latest version will be installed. | N/A |
26-
| `Commands` | Optional | String[] | An array of commands provided by the .NET tool package. | N/A |
27-
| `Prerelease` | Optional | Boolean | Indicates whether to include prerelease versions of the .NET tool package. The default value is `$false`. | `$true`, `$false` |
28-
| `ToolPathDirectory` | Optional | String | The directory where the .NET tool package will be installed. If not specified, the package will be installed globally. | Use custom directory when you have |
29-
| `Exist` | Optional | Boolean | Indicates whether the package should exist. Defaults to `$true`. | `$true` or `$false` |
22+
| **Parameter** | **Attribute** | **DataType** | **Description** | **Allowed Values** |
23+
| ------------------- | ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
24+
| `PackageId` | Key | String | The ID of the .NET tool package to manage. | N/A |
25+
| `Version` | Optional | String | The version of the .NET tool package to install. If not specified, the latest version will be installed. | N/A |
26+
| `Commands` | Optional | String[] | An array of commands provided by the .NET tool package. | N/A |
27+
| `Prerelease` | Optional | Boolean | Indicates whether to include prerelease versions of the .NET tool package. The default value is `$false`. Note: If the prerelease version is lower than the current version, the highest version will be installed. | `$true`, `$false` |
28+
| `ToolPathDirectory` | Optional | String | The directory where the .NET tool package will be installed. If not specified, the package will be installed globally. | Use custom directory when you have |
29+
| `Exist` | Optional | Boolean | Indicates whether the package should exist. Defaults to `$true`. | `$true` or `$false` |
3030

3131
## EXAMPLES
3232

@@ -59,4 +59,5 @@ Invoke-DscResource -ModuleName Microsoft.DotNet.Dsc -Name DotNetToolPackage -Met
5959
}
6060
6161
# This example installs the prerelease version of the .NET tool package 'PowerShell' in the 'C:\tools' directory.
62+
# NOTE: When the version in the feed is for example v7.4.5-preview1 and the highest is v7.4.6, the highest will be installed.
6263
```

resources/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ $DotNetCliPath = Get-DotNetPath
336336
}
337337
338338
This example installs the prerelease version of the .NET tool package 'PowerShell' in the 'C:\tools' directory.
339+
NOTE: When the version in the feed is for example v7.4.5-preview1 and the highest is v7.4.6, the highest will be installed.
339340
#>
340341
[DSCResource()]
341342
class DotNetToolPackage {

resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function Invoke-VSCode {
9595
[string]$Command
9696
)
9797

98-
$stdErrTempFile = "$env:TEMP\$((New-Guid).Guid)"
99-
$stdOutTempFile = "$env:TEMP\$((New-Guid).Guid)"
98+
$stdErrTempFile = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath (New-Guid).Guid
99+
$stdOutTempFile = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath (New-Guid).Guid
100100
$invocationSuccess = $true
101101

102102
$processParams = @{

tests/Microsoft.DotNet.Dsc/Microsoft.DotNet.Dsc.Tests.ps1

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,6 @@ Describe 'DSC operation capabilities' {
4343
$finalState.Version | Should -Not -BeNullOrEmpty
4444
}
4545

46-
It 'Sets desired package with prerelease' -Skip:(!$IsWindows) {
47-
$parameters = @{
48-
PackageId = 'dotnet-ef'
49-
PreRelease = $true
50-
}
51-
52-
Invoke-DscResource -Name DotNetToolPackage -ModuleName Microsoft.DotNet.Dsc -Method Set -Property $parameters
53-
54-
$finalState = Invoke-DscResource -Name DotNetToolPackage -ModuleName Microsoft.DotNet.Dsc -Method Get -Property $parameters
55-
$finalState.PackageId | Should -Be $parameters.PackageId
56-
$finalState.PreRelease | Should -BeTrue
57-
}
58-
5946
It 'Sets desired package with version' -Skip:(!$IsWindows) {
6047
$parameters = @{
6148
PackageId = 'dotnet-reportgenerator-globaltool'
@@ -99,7 +86,7 @@ Describe 'DSC operation capabilities' {
9986
It 'Exports resources' -Skip:(!$IsWindows) {
10087
$obj = [DotNetToolPackage]::Export()
10188

102-
$obj.PackageId.Contains('dotnet-ef') | Should -Be $true
89+
$obj.PackageId.Contains('gitversion.tool') | Should -Be $true
10390
$obj.PackageId.Contains('dotnet-reportgenerator-globaltool') | Should -Be $true
10491
}
10592

0 commit comments

Comments
 (0)