Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3ff53a

Browse files
jshigetomiJustin ChungTravisEz13
committed
Deploy Box Update (#24632)
* reverted one time changes* added ob_outputDirectory* added mscode variable group* forgot to move psm1 to ToolArtifact folder* added pipeline name and passing toolartifact through context* added tools* PSPackagesOfficial* removed tools clone* added uploading CL* verbose statements for release tag and release version* trying to regerence variable with step name* checking REPOROOT* removed get child item* Deploy box update* nuget template context pipeline name correction* changed other instances of releasetag* added -Verbose to Copy-Item* checkout task, instead of git clone* changed to Build.SourcesDirectory* removed path specification* removed path* added tsa and credscan* not copying tools to artifacts* official and production---------Co-authored-by: Justin Chung <chungjustin@microsoft.com>Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
1 parent0e5c5aa commitd3ff53a

8 files changed

+136
-76
lines changed

‎.pipelines/PowerShell-Release-Official.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ resources:
6363
type:git
6464
name:OneBranch.Pipelines/GovernedTemplates
6565
ref:refs/heads/main
66+
-repository:PSInternalTools
67+
type:git
68+
name:PowerShellCore/Internal-PowerShellTeam-Tools
69+
ref:refs/heads/master
6670

6771
pipelines:
6872
-pipeline:CoOrdinatedBuildPipeline
@@ -110,17 +114,14 @@ extends:
110114
tsaOptionsFile:.config\tsaoptions.json
111115

112116
stages:
113-
-stage:DownloadPackages
114-
displayName:'Download Packages'
115-
dependsOn:[]
117+
-stage:setReleaseTagAndUploadTools
118+
displayName:'Set Release Tag and Upload Tools'
116119
jobs:
117-
-template:/.pipelines/templates/release-download-packages.yml@self
120+
-template:/.pipelines/templates/release-SetTagAndTools.yml@self
118121

119122
-stage:msixbundle
120123
displayName:'Create MSIX Bundle'
121124
dependsOn:[]
122-
variables:
123-
ob_release_environment:Test
124125
jobs:
125126
-template:/.pipelines/templates/release-create-msix.yml@self
126127

@@ -278,7 +279,7 @@ extends:
278279
-stage:PublishGitHubRelease
279280
displayName:Publish GitHub Release
280281
dependsOn:
281-
-DownloadPackages
282+
-setReleaseTagAndUploadTools
282283
-UpdateChangeLog
283284
variables:
284285
ob_release_environment:Production
@@ -316,7 +317,9 @@ extends:
316317

317318
-stage:PublishNuGet
318319
displayName:Publish NuGet
319-
dependsOn:PushGitTagAndMakeDraftPublic
320+
dependsOn:
321+
-setReleaseTagAndUploadTools
322+
-PushGitTagAndMakeDraftPublic
320323
variables:
321324
ob_release_environment:Production
322325
jobs:

‎.pipelines/templates/release-SetReleaseTagandContainerName.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ steps:
88
}
99
1010
$releaseTag = $Branch -replace '^.*((release|rebuild)/)'
11-
$vstsCommandString = "vso[task.setvariable variable=$Variable]$releaseTag"
11+
$vstsCommandString = "vso[task.setvariable variable=$Variable;isOutput=true]$releaseTag"
1212
Write-Verbose -Message "setting $Variable to $releaseTag" -Verbose
1313
Write-Host -Object "##$vstsCommandString"
14+
name:OutputReleaseTag
1415
displayName:Set Release Tag
1516

1617
-pwsh:|
@@ -20,7 +21,8 @@ steps:
2021
Write-Host "##$vstsCommandString"
2122
2223
$version = '$(ReleaseTag)'.ToLowerInvariant().Substring(1)
23-
$vstsCommandString = "vso[task.setvariable variable=Version]$version"
24+
$vstsCommandString = "vso[task.setvariable variable=Version;isOutput=true]$version"
2425
Write-Host ("sending " + $vstsCommandString)
2526
Write-Host "##$vstsCommandString"
27+
name:OutputVersion
2628
displayName:Set container name
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
jobs:
2+
-job:SetTagAndTools
3+
displayName:Set Tag and Tools
4+
condition:succeeded()
5+
pool:
6+
type:windows
7+
variables:
8+
-group:'mscodehub-code-read-akv'
9+
-name:ob_outputDirectory
10+
value:'$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
11+
-name:ob_sdl_credscan_suppressionsFile
12+
value:$(Build.SourcesDirectory)\PowerShell\.config\suppress.json
13+
-name:ob_sdl_tsa_configFile
14+
value:$(Build.SourcesDirectory)\PowerShell\.config\tsaoptions.json
15+
steps:
16+
-template:release-SetReleaseTagandContainerName.yml@self
17+
18+
-checkout:self
19+
clean:true
20+
env:
21+
ob_restore_phase:true
22+
23+
-checkout:PSInternalTools
24+
clean:true
25+
env:
26+
ob_restore_phase:true
27+
28+
-pwsh:|
29+
New-Item -ItemType Directory -Path '$(Pipeline.Workspace)/ToolArtifact'
30+
Get-ChildItem -Path '$(Build.SourcesDirectory)/Internal-PowerShellTeam-Tools/Scripts' -Filter 'GitHubRelease.psm1' -ErrorAction SilentlyContinue |
31+
Copy-Item -Destination '$(Pipeline.Workspace)/ToolArtifact' -Verbose
32+
displayName: Move GitHub Tool
33+
34+
-task:onebranch.pipeline.signing@1
35+
displayName:Sign Tools
36+
inputs:
37+
command:'sign'
38+
signing_profile:internal_azure_service
39+
files_to_sign:'*.ps1;*.psm1'
40+
search_root:'$(Pipeline.Workspace)/ToolArtifact'
41+
42+
-pwsh:|
43+
Write-Verbose -Verbose "Creating output directory for release tools: $(ob_outputDirectory)/ToolArtifact"
44+
New-Item -Path $(ob_outputDirectory)/ToolArtifact -ItemType Directory -Force
45+
Get-ChildItem -Path "$(Pipeline.Workspace)/ToolArtifact/*" -Recurse |
46+
Copy-Item -Destination $(ob_outputDirectory)/ToolArtifact -Recurse -Verbose
47+
displayName: Upload Tools
48+
49+
-pwsh:|
50+
Write-Verbose -Verbose "Release Tag: $(OutputReleaseTag.releaseTag)"
51+
$releaseVersion = '$(OutputReleaseTag.releaseTag)' -replace '^v',''
52+
Write-Verbose -Verbose "Release Version: $releaseVersion"
53+
$semanticVersion = [System.Management.Automation.SemanticVersion]$releaseVersion
54+
55+
$isPreview = $semanticVersion.PreReleaseLabel -ne $null
56+
57+
$fileName = if ($isPreview) {
58+
"preview.md"
59+
}
60+
else {
61+
$semanticVersion.Major.ToString() + "." + $semanticVersion.Minor.ToString() + ".md"
62+
}
63+
64+
$filePath = "$(Build.SourcesDirectory)/PowerShell/CHANGELOG/$fileName"
65+
Write-Verbose -Verbose "Selected Log file: $filePath"
66+
67+
if (-not (Test-Path -Path $filePath)) {
68+
Write-Error "Changelog file not found: $filePath"
69+
exit 1
70+
}
71+
72+
Write-Verbose -Verbose "Creating output directory for CHANGELOG: $(ob_outputDirectory)/CHANGELOG"
73+
New-Item -Path $(ob_outputDirectory)/CHANGELOG -ItemType Directory -Force
74+
Copy-Item -Path $filePath -Destination $(ob_outputDirectory)/CHANGELOG
75+
displayName: Upload Changelog

‎.pipelines/templates/release-githubtasks.yml

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,26 @@ jobs:
88
templateContext:
99
inputs:
1010
-input:pipelineArtifact
11-
artifactName:drop_DownloadPackages_upload_packages
11+
artifactName:drop_setReleaseTagAndUploadTools_SetTagAndTools
12+
-input:pipelineArtifact
13+
pipeline:PSPackagesOfficial
14+
artifactName:drop_upload_upload_packages
1215
variables:
13-
-template:./variable/release-shared.yml@self
16+
-template:./variable/release-shared.yml@self
17+
parameters:
18+
RELEASETAG:$[ stageDependencies.setReleaseTagAndUploadTools.SetTagAndTools.outputs['OutputReleaseTag.releaseTag'] ]
1419

1520
steps:
1621
-task:PowerShell@2
1722
inputs:
1823
targetType:inline
1924
script:|
20-
Get-ChildItem Env: | Out-String -Stream | write-Verbose -Verbose
25+
Write-Verbose -Verbose "Release Tag: $(ReleaseTag)"
26+
Get-ChildItem Env: | Out-String -Stream | Write-Verbose -Verbose
2127
displayName:'Capture Environment Variables'
2228

2329
-template:release-install-pwsh.yml
2430

25-
-template:release-checkout-pwsh-repo.yml
26-
27-
-template:release-SetReleaseTagAndContainerName.yml
28-
29-
-task:PowerShell@2
30-
inputs:
31-
targetType:inline
32-
pwsh:true
33-
script:|
34-
git clone --depth 1 https://$(mscodehubCodeReadPat)@mscodehub.visualstudio.com/PowerShellCore/_git/Internal-PowerShellTeam-Tools '$(Pipeline.Workspace)/tools'
35-
displayName:Clone Internal-Tools repository
36-
3731
-task:PowerShell@2
3832
inputs:
3933
targetType:inline
@@ -55,17 +49,6 @@ jobs:
5549
Write-Verbose -Verbose -Message $fileContent
5650
displayName:Add sha256 hashes
5751

58-
-task:PowerShell@2
59-
inputs:
60-
targetType:inline
61-
pwsh:true
62-
script:|
63-
$releaseVersion = '$(ReleaseTag)' -replace '^v',''
64-
$vstsCommandString = "vso[task.setvariable variable=ReleaseVersion]$releaseVersion"
65-
Write-Host "sending " + $vstsCommandString
66-
Write-Host "##$vstsCommandString"
67-
displayName:'Set release version'
68-
6952
-task:PowerShell@2
7053
inputs:
7154
targetType:inline
@@ -79,21 +62,11 @@ jobs:
7962
targetType:inline
8063
pwsh:true
8164
script:|
82-
Import-module '$(Pipeline.Workspace)/tools/Scripts/GitHubRelease.psm1'
83-
$releaseVersion = '$(ReleaseTag)' -replace '^v',''
84-
$semanticVersion = [System.Management.Automation.SemanticVersion]$releaseVersion
85-
86-
$isPreview = $semanticVersion.PreReleaseLabel -ne $null
87-
88-
$fileName = if ($isPreview) {
89-
"preview.md"
90-
}
91-
else {
92-
$semanticVersion.Major.ToString() + "." + $semanticVersion.Minor.ToString() + ".md"
93-
}
65+
Import-module '$(Pipeline.Workspace)/ToolArtifact/GitHubRelease.psm1'
66+
Write-Verbose -Verbose "Available modules: "
67+
Get-Module | Write-Verbose -Verbose
9468
95-
$filePath = "$(Pipeline.Workspace)/PowerShell/CHANGELOG/$fileName"
96-
Write-Verbose -Verbose "Selected Log file: $filePath"
69+
$filePath = Get-ChildItem -Path "$(Pipeline.Workspace)/CHANGELOG" -Filter '*.md' | Select-Object -First 1 -ExpandProperty FullName
9770
9871
if (-not (Test-Path $filePath)) {
9972
throw "$filePath not found"

‎.pipelines/templates/release-publish-nuget.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,27 @@ jobs:
1313
templateContext:
1414
inputs:
1515
-input:pipelineArtifact
16-
artifactName:drop_DownloadPackages_upload_packages
17-
16+
pipeline:PSPackagesOfficial
17+
artifactName:drop_upload_upload_packages
1818
variables:
1919
-template:./variable/release-shared.yml@self
20+
parameters:
21+
VERSION:$[ stageDependencies.setReleaseTagAndUploadTools.SetTagAndTools.outputs['OutputVersion.Version'] ]
2022

2123
steps:
2224
-template:release-install-pwsh.yml
2325

24-
-template:release-checkout-pwsh-repo.yml
25-
26-
-template:release-SetReleaseTagAndContainerName.yml
27-
2826
-pwsh:|
29-
Get-ChildItem Env:
27+
Write-Verbose -Verbose "Version: $(Version)"
28+
Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose
3029
displayName: 'Capture Environment Variables'
3130
3231
-pwsh:|
3332
#Exclude all global tool packages. Their names start with 'PowerShell.'
3433
$null = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/release"
3534
Copy-Item "$(Pipeline.Workspace)/NuGetPackages/*.nupkg" -Destination "$(Pipeline.Workspace)/release" -Exclude "PowerShell.*.nupkg" -Force -Verbose
3635
37-
$releaseVersion = '$(VERSION)'
36+
$releaseVersion = '$(Version)'
3837
$globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg"
3938
4039
if ($releaseVersion -notlike '*-*') {

‎.pipelines/templates/release-validate-packagenames.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
displayName: Capture environment
2424
2525
-pwsh:|
26-
$name = "{0}_{1:x}" -f '$(releaseTag)', (Get-Date).Ticks
26+
$name = "{0}_{1:x}" -f '$(OutputReleaseTag.releaseTag)', (Get-Date).Ticks
2727
Write-Host $name
2828
Write-Host "##vso[build.updatebuildnumber]$name"
2929
displayName: Set Release Name

‎.pipelines/templates/uploadToAzure.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -235,23 +235,21 @@ jobs:
235235
Get-ChildItem '$(Build.ArtifactStagingDirectory)/downloads' | Select-Object -ExpandProperty FullName
236236
displayName: 'Capture downloads'
237237
238-
# - pwsh: |
239-
# Write-Verbose -Verbose "Copying Github Release files in $(Build.ArtifactStagingDirectory)/downloads to use in Release Pipeline"
240-
#
241-
# Write-Verbose -Verbose "Creating output directory for GitHub Release files: $(ob_outputDirectory)/GitHubPackages"
242-
# New-Item -Path $(ob_outputDirectory)/GitHubPackages -ItemType Directory -Force
243-
# Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)/downloads/*" -Recurse |
244-
# Where-Object { $_.Extension -notin '.msix', '.nupkg' } |
245-
# ForEach-Object { Write-Verbose -Verbose $_.FullName ; $_ } |
246-
# Copy-Item -Destination $(ob_outputDirectory)/GitHubPackages -Recurse
247-
#
248-
# Write-Verbose -Verbose "Creating output directory for NuGet packages: $(ob_outputDirectory)/NuGetPackages"
249-
# New-Item -Path $(ob_outputDirectory)/NuGetPackages -ItemType Directory -Force
250-
# Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)/downloads/*" -Recurse |
251-
# Where-Object { $_.Extension -eq '.nupkg' } |
252-
# ForEach-Object { Write-Verbose -Verbose $_.FullName ; $_ } |
253-
# Copy-Item -Destination $(ob_outputDirectory)/NuGetPackages -Recurse
254-
# displayName: Copy downloads to Artifacts
238+
-pwsh:|
239+
Write-Verbose -Verbose "Copying Github Release files in $(Build.ArtifactStagingDirectory)/downloads to use in Release Pipeline"
240+
241+
Write-Verbose -Verbose "Creating output directory for GitHub Release files: $(ob_outputDirectory)/GitHubPackages"
242+
New-Item -Path $(ob_outputDirectory)/GitHubPackages -ItemType Directory -Force
243+
Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)/downloads/*" -Recurse |
244+
Where-Object { $_.Extension -notin '.msix', '.nupkg' } |
245+
Copy-Item -Destination $(ob_outputDirectory)/GitHubPackages -Recurse -Verbose
246+
247+
Write-Verbose -Verbose "Creating output directory for NuGet packages: $(ob_outputDirectory)/NuGetPackages"
248+
New-Item -Path $(ob_outputDirectory)/NuGetPackages -ItemType Directory -Force
249+
Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)/downloads/*" -Recurse |
250+
Where-Object { $_.Extension -eq '.nupkg' } |
251+
Copy-Item -Destination $(ob_outputDirectory)/NuGetPackages -Recurse -Verbose
252+
displayName: Copy downloads to Artifacts
255253
256254
-pwsh:|
257255
# Create output directory for packages which have been uploaded to blob storage

‎.pipelines/templates/variable/release-shared.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ parameters:
55
-name:SBOM
66
type:boolean
77
default:false
8+
-name:RELEASETAG
9+
type:string
10+
default:'Not Initialized'
11+
-name:VERSION
12+
type:string
13+
default:'Not Initialized'
814

915
variables:
1016
-name:ob_signing_setup_enabled
@@ -30,3 +36,7 @@ variables:
3036
value:${{ parameters.REPOROOT }}\.config\suppress.json
3137
-name:ob_sdl_codeql_compiled_enabled
3238
value:false
39+
-name:ReleaseTag
40+
value:${{ parameters.RELEASETAG }}
41+
-name:Version
42+
value:${{ parameters.VERSION }}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp