Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5fd920a

Browse files
committedMar 19, 2024·
Replace 1ES with OneBranch pipeline
1 parent edafb44 commit 5fd920a

14 files changed

+250
-725
lines changed
 

‎.config/tsaoptions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"instanceUrl": "https://msazure.visualstudio.com",
3+
"projectName": "One",
4+
"areaPath": "One\\MGMT\\Compute\\Powershell\\Powershell",
5+
"notificationAliases": [ "andschwa@microsoft.com", "slee@microsoft.com" ],
6+
"codebaseName": "PowerShell_PowerShellEditorServices_20240313",
7+
"tools": [ "CredScan", "PoliCheck", "BinSkim" ]
8+
}

‎.github/release.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- Ignore
5+
authors:
6+
- dependabot[bot]
7+
categories:
8+
- title: Enhancements & Features ✨
9+
labels:
10+
- Issue-Enhancement
11+
- title: Squashed Bugs 🐛
12+
labels:
13+
- Issue-Bug
14+
- title: Other Changes 🙏
15+
labels:
16+
- "*"

‎.github/workflows/ci-test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
6.0.x
3838
7.0.x
3939
8.0.x
40+
env:
41+
NUGET_AUTH_TOKEN: ${{ secrets.AZURE_NUGET_TOKEN }}
4042

4143
- name: Install PSResources
4244
shell: pwsh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
#################################################################################
2+
# OneBranch Pipelines #
3+
# This pipeline was created by EasyStart from a sample located at: #
4+
# https://aka.ms/obpipelines/easystart/samples #
5+
# Documentation: https://aka.ms/obpipelines #
6+
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
7+
# Retail Tasks: https://aka.ms/obpipelines/tasks #
8+
# Support: https://aka.ms/onebranchsup #
9+
#################################################################################
10+
11+
trigger: none
12+
13+
parameters:
14+
- name: debug
15+
displayName: Enable debug output
16+
type: boolean
17+
default: false
18+
19+
variables:
20+
system.debug: ${{ parameters.debug }}
21+
BuildConfiguration: Release
22+
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest
23+
DOTNET_NOLOGO: true
24+
DOTNET_CLI_TELEMETRY_OPTOUT: true
25+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
26+
27+
resources:
28+
repositories:
29+
- repository: templates
30+
type: git
31+
name: OneBranch.Pipelines/GovernedTemplates
32+
ref: refs/heads/main
33+
34+
extends:
35+
# https://aka.ms/obpipelines/templates
36+
template: v2/OneBranch.Official.CrossPlat.yml@templates
37+
parameters:
38+
globalSdl: # https://aka.ms/obpipelines/sdl
39+
asyncSdl:
40+
enabled: true
41+
forStages: [build]
42+
stages:
43+
- stage: build
44+
jobs:
45+
- job: main
46+
displayName: Build package
47+
pool:
48+
type: windows
49+
variables:
50+
ob_outputDirectory: $(Build.SourcesDirectory)/module
51+
steps:
52+
- pwsh: |
53+
[xml]$xml = Get-Content PowerShellEditorServices.Common.props
54+
$version = $xml.Project.PropertyGroup.VersionPrefix
55+
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"
56+
name: package
57+
displayName: Get version from project properties
58+
- task: onebranch.pipeline.version@1
59+
displayName: Set OneBranch version
60+
inputs:
61+
system: Custom
62+
customVersion: $(package.version)
63+
- task: UseDotNet@2
64+
displayName: Install .NET 8.x SDK
65+
inputs:
66+
packageType: sdk
67+
version: 8.x
68+
- task: UseDotNet@2
69+
displayName: Install .NET 7.x runtime
70+
inputs:
71+
packageType: runtime
72+
version: 7.x
73+
- task: UseDotNet@2
74+
displayName: Install .NET 6.x runtime
75+
inputs:
76+
packageType: runtime
77+
version: 6.x
78+
- task: PowerShell@2
79+
displayName: Install PSResources
80+
inputs:
81+
pwsh: true
82+
filePath: tools/installPSResources.ps1
83+
- task: PowerShell@2
84+
displayName: Build and test
85+
inputs:
86+
targetType: inline
87+
pwsh: true
88+
script: Invoke-Build TestFull -Configuration $(BuildConfiguration)
89+
- task: PublishTestResults@2
90+
displayName: Publish test results
91+
inputs:
92+
testRunner: VSTest
93+
testResultsFiles: '**/*.trx'
94+
failTaskOnFailedTests: true
95+
- task: PowerShell@2
96+
displayName: Assert release configuration
97+
inputs:
98+
targetType: inline
99+
pwsh: true
100+
script: |
101+
$assembly = [Reflection.Assembly]::LoadFile("$(Build.SourcesDirectory)/module/PowerShellEditorServices/bin/Core/Microsoft.PowerShell.EditorServices.Hosting.dll")
102+
if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) {
103+
Write-Host "##vso[task.LogIssue type=error;]Was not built in release configuration!"
104+
exit 1
105+
}
106+
- task: onebranch.pipeline.signing@1
107+
displayName: Sign 1st-party files
108+
inputs:
109+
command: sign
110+
signing_environment: external_distribution
111+
search_root: $(Build.SourcesDirectory)/module
112+
files_to_sign: |
113+
**/*.ps1;
114+
**/*.psd1;
115+
**/*.psm1;
116+
**/*.ps1xml;
117+
**/Microsoft.PowerShell.EditorServices*.dll;
118+
!Plaster/*;
119+
- task: onebranch.pipeline.signing@1
120+
displayName: Sign 3rd-party files
121+
inputs:
122+
command: sign
123+
signing_environment: 135020002
124+
search_root: $(Build.SourcesDirectory)/module
125+
files_to_sign: |
126+
**/MediatR.dll;
127+
**/Nerdbank.Streams.dll;
128+
**/Newtonsoft.Json.dll;
129+
**/OmniSharp.Extensions*.dll;
130+
**/Serilog*.dll;
131+
**/System.Reactive.dll;
132+
Plaster/**/*.ps1;
133+
Plaster/**/*.psd1;
134+
Plaster/**/*.psm1;
135+
- stage: release
136+
dependsOn: build
137+
variables:
138+
version: $[ stageDependencies.build.main.outputs['package.version'] ]
139+
drop: $(Pipeline.Workspace)/drop_build_main
140+
jobs:
141+
- job: validation
142+
displayName: Manual validation
143+
pool:
144+
type: agentless
145+
timeoutInMinutes: 1440
146+
steps:
147+
- task: ManualValidation@0
148+
displayName: Wait 24 hours for validation
149+
inputs:
150+
notifyUsers: $(Build.RequestedForEmail)
151+
instructions: Please validate the release
152+
timeoutInMinutes: 1440
153+
- job: github
154+
dependsOn: validation
155+
displayName: Publish draft to GitHub
156+
pool:
157+
type: windows
158+
variables:
159+
ob_outputDirectory: $(Build.SourcesDirectory)/out
160+
steps:
161+
- download: current
162+
displayName: Download artifacts
163+
- task: ArchiveFiles@2
164+
displayName: Zip signed artifacts
165+
inputs:
166+
rootFolderOrFile: $(drop)
167+
includeRootFolder: false
168+
archiveType: zip
169+
archiveFile: out/PowerShellEditorServices.zip
170+
- task: GitHubRelease@1
171+
displayName: Create GitHub release
172+
inputs:
173+
gitHubConnection: GitHub
174+
repositoryName: PowerShell/PowerShellEditorServices
175+
assets: out/PowerShellEditorServices.zip
176+
tagSource: userSpecifiedTag
177+
tag: v$(version)
178+
isDraft: true
179+
addChangeLog: false
180+
releaseNotesSource: inline
181+
releaseNotesInline: |
182+
# TODO: Generate release notes on GitHub!

‎.vsts-ci/azure-pipelines-ci.yml

-45
This file was deleted.

‎.vsts-ci/azure-pipelines-release.yml

-68
This file was deleted.

‎.vsts-ci/misc-analysis.yml

-20
This file was deleted.

‎.vsts-ci/templates/ci-general.yml

-85
This file was deleted.

‎.vsts-ci/templates/publish-general.yml

-12
This file was deleted.

‎.vsts-ci/templates/release-general.yml

-96
This file was deleted.

‎NuGet.Config

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<packageSources>
4-
<clear />
5-
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
6-
</packageSources>
7-
<disabledPackageSources>
8-
<clear />
9-
</disabledPackageSources>
3+
<packageSources>
4+
<clear />
5+
<add key="PowerShellCore_PublicPackages" value="https://pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/nuget/v3/index.json" />
6+
</packageSources>
107
</configuration>

‎tools/terms/FileTypeSet.xml

-379
This file was deleted.

‎tools/terms/UserExclusions.xml

-12
This file was deleted.

‎tools/updateVersion.ps1

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
param(
5+
[Parameter(Mandatory)]
6+
[semver]$Version,
7+
8+
[Parameter(Mandatory)]
9+
[string]$Changes
10+
)
11+
12+
$v = "$($Version.Major).$($Version.Minor).$($Version.Patch)"
13+
14+
$path = "PowerShellEditorServices.Common.props"
15+
$f = Get-Content -Path $path
16+
$f = $f -replace '^(?<prefix>\s+<VersionPrefix>)(.+)(?<suffix></VersionPrefix>)$', "`${prefix}${v}`${suffix}"
17+
$f = $f -replace '^(?<prefix>\s+<VersionSuffix>)(.*)(?<suffix></VersionSuffix>)$', "`${prefix}$($Version.PreReleaseLabel)`${suffix}"
18+
$f | Set-Content -Path $path
19+
git add $path
20+
21+
$path = "module/PowerShellEditorServices/PowerShellEditorServices.psd1"
22+
$f = Get-Content -Path $path
23+
$f = $f -replace "^(?<prefix>ModuleVersion = ')(.+)(?<suffix>')`$", "`${prefix}${v}`${suffix}"
24+
$f | Set-Content -Path $path
25+
git add $path
26+
27+
$Changelog = Get-Content -Path "CHANGELOG.md"
28+
@(
29+
$Changelog[0..1]
30+
"## v$Version"
31+
"### $([datetime]::Now.ToString('dddd, MMMM dd, yyyy'))"
32+
""
33+
$Changes
34+
""
35+
$Changelog[2..$Changelog.Length]
36+
) | Set-Content -Encoding utf8NoBOM -Path "CHANGELOG.md"
37+
git add $path

0 commit comments

Comments
 (0)
Please sign in to comment.