Skip to content

Commit

Permalink
[1ES] Migrate FunctionsNetHost CI pipelines (#2515)
Browse files Browse the repository at this point in the history
  • Loading branch information
liliankasem committed Jun 7, 2024
1 parent 2ece46d commit b8db3dd
Show file tree
Hide file tree
Showing 6 changed files with 281 additions and 0 deletions.
55 changes: 55 additions & 0 deletions eng/ci/host/official-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
trigger:
batch: true
branches:
include:
- main
- release/*
paths:
include:
- host/src/

# CI only, does not trigger on PRs.
pr: none

resources:
repositories:
- repository: 1es
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
- repository: eng
type: git
name: engineering
ref: refs/tags/release

variables:
- template: ci/variables/build.yml@eng
- template: ci/variables/cfs.yml@eng
- template: /eng/ci/templates/variables/build.yml@self

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1es
parameters:
pool:
name: 1es-pool-azfunc
image: 1es-ubuntu-22.04
os: linux
sdl:
sourceAnalysisPool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows

stages:
- stage: Build

jobs:
- template: /eng/ci/templates/official/jobs/build-host-prelaunch-artifacts.yml@self
- template: /eng/ci/templates/official/jobs/build-host-artifacts-linux.yml@self
- template: /eng/ci/templates/official/jobs/build-host-artifacts-windows.yml@self

- stage: Pack
dependsOn: Build

jobs:
- template: /eng/ci/templates/official/jobs/pack-host-artifacts.yml@self
52 changes: 52 additions & 0 deletions eng/ci/host/public-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This build is used for public PR and CI builds.

trigger:
batch: true
branches:
include:
- main
- release/*
paths:
include:
- host/src/

pr:
branches:
include:
- main
- release/*
paths:
include:
- host/src/

resources:
repositories:
- repository: 1es
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

variables:
- template: /eng/ci/templates/variables/build.yml@self

extends:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1es
parameters:
pool:
name: 1es-pool-azfunc-public
image: 1es-ubuntu-22.04
os: linux
sdl:
sourceAnalysisPool:
name: 1es-pool-azfunc-public
image: 1es-windows-2022
os: windows

stages:
- stage: Build

jobs:
- template: /eng/ci/templates/official/jobs/build-host-prelaunch-artifacts.yml@self
- template: /eng/ci/templates/official/jobs/build-host-artifacts-linux.yml@self
- template: /eng/ci/templates/official/jobs/build-host-artifacts-windows.yml@self

47 changes: 47 additions & 0 deletions eng/ci/templates/official/jobs/build-host-artifacts-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
jobs:

- job: BuildFunctionsNetHostLinux
displayName: '[Linux] Build FunctionsNetHost'

templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- output: pipelineArtifact
displayName: Publish FunctionsNetHost packages
path: $(Build.ArtifactStagingDirectory)/_functionsNetHostPackagesLinux
artifact: _functionsNetHostPackagesLinux

pool:
name: 1es-pool-azfunc
image: 1es-ubuntu-22.04
os: linux

steps:
- task: UseDotNet@2
displayName: Install .NET SDK from global.json
inputs:
useGlobalJson: true

- script: |
sudo apt-get install clang zlib1g-dev
displayName: Install dependencies
- task: DotnetCoreCLI@2
displayName: Dotnet Publish
inputs:
command: publish
publishWebProjects: false
zipAfterPublish: false
arguments: -c Release -r linux-x64 -o $(Build.SourcesDirectory)/pkg_output/linux
workingDirectory: $(Build.SourcesDirectory)/host/src/FunctionsNetHost

- task: CopyFiles@2
displayName: Copy files
inputs:
SourceFolder: $(Build.SourcesDirectory)/pkg_output/linux
# Publish output will include many other files. We only need the FunctionsNetHost, FunctionsNetHost.dbg & libnethost.so
Contents: |
FunctionsNetHost
FunctionsNetHost.dbg
libnethost.so
TargetFolder: $(Build.ArtifactStagingDirectory)/_functionsNetHostPackagesLinux
43 changes: 43 additions & 0 deletions eng/ci/templates/official/jobs/build-host-artifacts-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
jobs:

- job: BuildFunctionsNetHostWindows
displayName: '[Windows] Build FunctionsNetHost'

templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- output: pipelineArtifact
displayName: Publish FunctionsNetHost packages
path: $(Build.ArtifactStagingDirectory)/_functionsNetHostPackagesWindows
artifact: _functionsNetHostPackagesWindows

pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows

steps:
- task: UseDotNet@2
displayName: Install .NET SDK from global.json
inputs:
useGlobalJson: true

- task: DotnetCoreCLI@2
displayName: Dotnet Publish
inputs:
command: publish
publishWebProjects: false
zipAfterPublish: false
arguments: -c Release -r win-x64 -o $(Build.SourcesDirectory)/pkg_output/windows
workingDirectory: $(Build.SourcesDirectory)/host/src/FunctionsNetHost

- task: CopyFiles@2
displayName: Copy files
inputs:
SourceFolder: $(Build.SourcesDirectory)/pkg_output/windows
# Publish output will include many other files. We only need FunctionsNetHost.exe, pdb & nethost.dll
Contents: |
FunctionsNetHost.exe
FunctionsNetHost.pdb
nethost.dll
TargetFolder: $(Build.ArtifactStagingDirectory)/_functionsNetHostPackagesWindows
34 changes: 34 additions & 0 deletions eng/ci/templates/official/jobs/build-host-prelaunch-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
jobs:

- job: BuildPrelaunchApp
displayName: Build PrelaunchApp

templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- output: pipelineArtifact
displayName: Publish PrelaunchApp packages
path: $(Build.ArtifactStagingDirectory)/_preLaunchAppPackages
artifact: _preLaunchAppPackages

pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows

variables:
dotnetVersions: 'net8.0,net7.0,net6.0'

steps:
- template: /eng/ci/templates/steps/install-dotnet.yml@self

- ${{ each version in split(variables.dotnetVersions, ',') }}:
- task: DotNetCoreCLI@2
displayName: Publish prelaunch App.csproj
inputs:
command: publish
publishWebProjects: false
zipAfterPublish: false
modifyOutputPath: false
arguments: -c Release -o $(Build.ArtifactStagingDirectory)/_preLaunchAppPackages/${{ version }} -f ${{ version }} -p:UseAppHost=false
projects: host/src/PrelaunchApp/App.csproj
50 changes: 50 additions & 0 deletions eng/ci/templates/official/jobs/pack-host-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
jobs:

- job: PackArtifacts
displayName: Pack artifacts

templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- output: pipelineArtifact
displayName: Publish nuget packages
path: $(Build.ArtifactStagingDirectory)/NugetPackages
artifact: NugetPackages

pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows

steps:
- task: UseDotNet@2
displayName: Install .NET SDK from global.json
inputs:
useGlobalJson: true

- task: DownloadPipelineArtifact@2
displayName: Download prelaunch artifacts
inputs:
artifactName: _preLaunchAppPackages
path: $(Build.SourcesDirectory)/host/dist/portable

- task: DownloadPipelineArtifact@2
displayName: Download host artifacts - linux
inputs:
artifactName: _functionsNetHostPackagesLinux
path: $(Build.SourcesDirectory)/host/dist/linux

- task: DownloadPipelineArtifact@2
displayName: Download host artifacts - windows
inputs:
artifactName: _functionsNetHostPackagesWindows
path: $(Build.SourcesDirectory)/host/dist/windows

- task: NuGetCommand@2
displayName: Nuget pack
inputs:
command: pack
packagesToPack: $(Build.SourcesDirectory)/host/tools/build/Microsoft.Azure.Functions.DotnetIsolatedNativeHost.nuspec
versioningScheme: off
packDestination: $(Build.ArtifactStagingDirectory)/NugetPackages
basePath: $(Build.SourcesDirectory)/host/tools/build

0 comments on commit b8db3dd

Please sign in to comment.