Skip to content

Commit 7cd4593

Browse files
authored
Cherrypick 1ES pipelines to PS7.2 branch (#1075)
- Add code-mirror.yml - Convert build pipeline to 1ES - Remove old pipeline - Changes to build.ps1 for new pipeline - Remove NuGet Config
1 parent 684a843 commit 7cd4593

File tree

8 files changed

+179
-193
lines changed

8 files changed

+179
-193
lines changed

NuGet.config

Lines changed: 0 additions & 8 deletions
This file was deleted.

azure-pipelines.yml

Lines changed: 0 additions & 127 deletions
This file was deleted.

build.ps1

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ param(
2828
$Configuration = "Debug",
2929

3030
[string]
31-
$BuildNumber = '0',
32-
33-
[switch]
34-
$AddSBOM,
35-
36-
[string]
37-
$SBOMUtilSASUrl
31+
$BuildNumber = '0'
3832
)
3933

4034
#Requires -Version 6.0
@@ -68,35 +62,6 @@ function Get-FunctionsCoreToolsDir {
6862
}
6963
}
7064

71-
function Install-SBOMUtil
72-
{
73-
if ([string]::IsNullOrEmpty($SBOMUtilSASUrl))
74-
{
75-
throw "The `$SBOMUtilSASUrl parameter cannot be null or empty when specifying the `$AddSBOM switch"
76-
}
77-
78-
$MANIFESTOOLNAME = "ManifestTool"
79-
Write-Host "Installing $MANIFESTOOLNAME..."
80-
81-
$MANIFESTOOL_DIRECTORY = Join-Path $PSScriptRoot $MANIFESTOOLNAME
82-
Remove-Item -Recurse -Force $MANIFESTOOL_DIRECTORY -ErrorAction Ignore
83-
84-
Invoke-RestMethod -Uri $SBOMUtilSASUrl -OutFile "$MANIFESTOOL_DIRECTORY.zip"
85-
Expand-Archive "$MANIFESTOOL_DIRECTORY.zip" -DestinationPath $MANIFESTOOL_DIRECTORY
86-
87-
$dllName = "Microsoft.ManifestTool.dll"
88-
$manifestToolPath = "$MANIFESTOOL_DIRECTORY/$dllName"
89-
90-
if (-not (Test-Path $manifestToolPath))
91-
{
92-
throw "$MANIFESTOOL_DIRECTORY does not contain '$dllName'"
93-
}
94-
95-
Write-Host 'Done.'
96-
97-
return $manifestToolPath
98-
}
99-
10065
function Deploy-PowerShellWorker {
10166
$ErrorActionPreference = 'Stop'
10267

@@ -170,28 +135,6 @@ if (!$NoBuild.IsPresent) {
170135

171136
dotnet publish -c $Configuration "/p:BuildNumber=$BuildNumber" $PSScriptRoot
172137

173-
if ($AddSBOM)
174-
{
175-
# Install manifest tool
176-
$manifestTool = Install-SBOMUtil
177-
Write-Log "manifestTool: $manifestTool "
178-
179-
# Generate manifest
180-
$buildPath = "$PSScriptRoot/src/bin/$Configuration/$TargetFramework/publish"
181-
$telemetryFilePath = Join-Path $PSScriptRoot ((New-Guid).Guid + ".json")
182-
$packageName = "Microsoft.Azure.Functions.PowerShellWorker.nuspec"
183-
184-
# Delete the manifest folder if it exists
185-
$manifestFolderPath = Join-Path $buildPath "_manifest"
186-
if (Test-Path $manifestFolderPath)
187-
{
188-
Remove-Item $manifestFolderPath -Recurse -Force -ErrorAction Ignore
189-
}
190-
191-
Write-Log "Running: dotnet $manifestTool generate -BuildDropPath $buildPath -BuildComponentPath $buildPath -Verbosity Information -t $telemetryFilePath"
192-
& { dotnet $manifestTool generate -BuildDropPath $buildPath -BuildComponentPath $buildPath -Verbosity Information -t $telemetryFilePath -PackageName $packageName }
193-
}
194-
195138
dotnet pack -c $Configuration "/p:BuildNumber=$BuildNumber" "$PSScriptRoot/package"
196139
}
197140

eng/ci/code-mirror.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
trigger:
2+
branches:
3+
include:
4+
# Below branches are examples for Azure/azure-functions-host. Replace with appropriate branches for your repository.
5+
# Keep this set limited as appropriate (don't mirror individual user branches).
6+
- dev
7+
- v4.x/*
8+
- v3.x/*
9+
10+
resources:
11+
repositories:
12+
- repository: eng
13+
type: git
14+
name: engineering
15+
ref: refs/tags/release
16+
17+
variables:
18+
- template: ci/variables/cfs.yml@eng
19+
20+
extends:
21+
template: ci/code-mirror.yml@eng

eng/ci/official.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
trigger:
2+
batch: true
3+
branches:
4+
include:
5+
- v4.x/*
6+
- v3.x/*
7+
8+
# CI only, does not trigger on PRs.
9+
pr: none
10+
11+
resources:
12+
repositories:
13+
- repository: 1es
14+
type: git
15+
name: 1ESPipelineTemplates/1ESPipelineTemplates
16+
ref: refs/tags/release
17+
18+
variables:
19+
Configuration: Release
20+
buildNumber: $[ counter('build', 4000) ] # Start higher than the versions from the previous pipeline. Every build (pr or branch) will increment.
21+
22+
extends:
23+
template: v1/1ES.Official.PipelineTemplate.yml@1es
24+
parameters:
25+
pool:
26+
name: 1es-pool-azfunc
27+
image: 1es-windows-2022
28+
os: windows
29+
30+
stages:
31+
- stage: WindowsUnitTests
32+
dependsOn: []
33+
jobs:
34+
- template: /eng/ci/templates/test.yml@self
35+
36+
- stage: LinuxUnitTests
37+
dependsOn: []
38+
jobs:
39+
- template: /eng/ci/templates/test.yml@self
40+
pool:
41+
name: 1es-pool-azfunc
42+
image: 1es-ubuntu-22.04
43+
os: linux
44+
45+
- stage: Build
46+
dependsOn: [WindowsUnitTests, LinuxUnitTests]
47+
jobs:
48+
- template: /eng/ci/templates/build.yml@self

eng/ci/public.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
trigger:
2+
batch: true
3+
branches:
4+
include:
5+
- dev
6+
7+
resources:
8+
repositories:
9+
- repository: 1es
10+
type: git
11+
name: 1ESPipelineTemplates/1ESPipelineTemplates
12+
ref: refs/tags/release
13+
14+
extends:
15+
template: v1/1ES.Unofficial.PipelineTemplate.yml@1es
16+
parameters:
17+
pool:
18+
name: 1es-pool-azfunc-public
19+
image: 1es-windows-2022
20+
os: windows
21+
22+
stages:
23+
- stage: WindowsUnitTests
24+
dependsOn: []
25+
jobs:
26+
- template: /eng/ci/templates/test.yml@self
27+
pool:
28+
name: 1es-pool-azfunc-public
29+
30+
- stage: LinuxUnitTests
31+
dependsOn: []
32+
jobs:
33+
- template: /eng/ci/templates/test.yml@self
34+
pool:
35+
name: 1es-pool-azfunc-public
36+
image: 1es-ubuntu-22.04
37+
os: linux

eng/ci/templates/build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
jobs:
2+
- job:
3+
templateContext:
4+
outputs:
5+
- output: nuget
6+
packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg"
7+
packageParentPath: "$(Build.ArtifactStagingDirectory)"
8+
nuGetFeedType: internal
9+
publishVstsFeed: "e6a70c92-4128-439f-8012-382fe78d6396/c0493cce-bc63-4e11-9fc9-e7c45291f151"
10+
sbomPackageName: "Azure Functions PowerShell Worker"
11+
sbomBuildComponentPath: "$(Build.SourcesDirectory)"
12+
allowPackageConflicts: true
13+
# - output: nuget
14+
# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], true))
15+
# packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
16+
# packageParentPath: '$(Build.ArtifactStagingDirectory)'
17+
# nuGetFeedType: 'internal'
18+
# publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df' # AzureFunctionsPreRelease feed
19+
# allowPackageConflicts: true
20+
steps:
21+
- pwsh: ./build.ps1 -NoBuild -Bootstrap
22+
displayName: "Running ./build.ps1 -NoBuild -Bootstrap"
23+
24+
- pwsh: |
25+
$ErrorActionPreference = "Stop"
26+
27+
./build.ps1 -Clean -Configuration Release -BuildNumber "$(buildNumber)"
28+
displayName: "Build worker code"
29+
30+
- task: CopyFiles@2
31+
inputs:
32+
SourceFolder: "$(System.DefaultWorkingDirectory)/package"
33+
Contents: |
34+
**/*.nuspec
35+
**/*.nupkg
36+
TargetFolder: "$(Build.ArtifactStagingDirectory)"
37+
flattenFolders: true
38+
displayName: "Copy package to artifacts directory"

0 commit comments

Comments
 (0)