Skip to content

Commit f1e9677

Browse files
committed
Convert build pipeline to 1ES (#1061)
- Convert build pipeline to 1ES - Remove old pipeline - Changes to build.ps1 for new pipeline
1 parent 3584b32 commit f1e9677

File tree

6 files changed

+169
-139
lines changed

6 files changed

+169
-139
lines changed

azure-pipelines.yml

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

build.ps1

Lines changed: 4 additions & 29 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,6 +62,7 @@ function Get-FunctionsCoreToolsDir {
6862
}
6963
}
7064

65+
<<<<<<< HEAD
7166
function Install-SBOMUtil
7267
{
7368
if ([string]::IsNullOrEmpty($SBOMUtilSASUrl))
@@ -97,6 +92,8 @@ function Install-SBOMUtil
9792
return $manifestToolPath
9893
}
9994

95+
=======
96+
>>>>>>> f0a96f5 (Convert build pipeline to 1ES (#1061))
10097
function Deploy-PowerShellWorker {
10198
$ErrorActionPreference = 'Stop'
10299

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

171168
dotnet publish -c $Configuration "/p:BuildNumber=$BuildNumber" $PSScriptRoot
172169

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-
195170
dotnet pack -c $Configuration "/p:BuildNumber=$BuildNumber" "$PSScriptRoot/package"
196171
}
197172

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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
trigger:
2+
batch: true
3+
branches:
4+
include:
5+
- dev
6+
- v4.x/*
7+
- v3.x/*
8+
9+
# Only run the tests on PR to official branches - do we want to run them on all PRs?
10+
pr:
11+
branches:
12+
include:
13+
- '*'
14+
15+
resources:
16+
repositories:
17+
- repository: 1es
18+
type: git
19+
name: 1ESPipelineTemplates/1ESPipelineTemplates
20+
ref: refs/tags/release
21+
22+
extends:
23+
template: v1/1ES.Unofficial.PipelineTemplate.yml
24+
parameters:
25+
pool:
26+
name: 1es-pool-azfunc-public
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+
pool:
36+
name: 1es-pool-azfunc-public
37+
38+
- stage: LinuxUnitTests
39+
dependsOn: []
40+
jobs:
41+
- template: /eng/ci/templates/test.yml@self
42+
pool:
43+
name: 1es-pool-azfunc-public
44+
image: 1es-ubuntu-22.04
45+
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"

eng/ci/templates/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
jobs:
2+
- job: UnitTests
3+
steps:
4+
- pwsh: ./build.ps1 -NoBuild -Bootstrap
5+
displayName: "Running ./build.ps1 -NoBuild -Bootstrap"
6+
7+
- pwsh: ./Check-CsprojVulnerabilities.ps1
8+
displayName: "Check for security vulnerabilities"
9+
10+
- pwsh: |
11+
$ErrorActionPreference = "Stop"
12+
13+
./build.ps1 -Clean -Configuration Release -BuildNumber "$(buildNumber)"
14+
displayName: "Build worker code"
15+
16+
- pwsh: ./build.ps1 -NoBuild -Test
17+
displayName: "Running UnitTest"
18+
19+
# - pwsh: ./test/E2E/Start-E2ETest.ps1
20+
# env:
21+
# AzureWebJobsStorage: $(AzureWebJobsStorage)
22+
# AzureWebJobsCosmosDBConnectionString: $(AzureWebJobsCosmosDBConnectionString)
23+
# AzureWebJobsServiceBus: $(AzureWebJobsServiceBus)
24+
# AzureWebJobsEventHubSender: $(AzureWebJobsEventHubSender)
25+
# FUNCTIONS_WORKER_RUNTIME: "powershell"
26+
# displayName: "Running E2ETest"
27+
28+
- task: PublishTestResults@2
29+
inputs:
30+
testResultsFormat: "VSTest"
31+
testResultsFiles: "**/*.trx"
32+
failTaskOnFailedTests: true
33+
condition: succeededOrFailed()
34+
displayName: "Publish tests results"

0 commit comments

Comments
 (0)