Skip to content

Commit

Permalink
Update pipelines to use 1ES templates
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-long committed Jun 28, 2024
1 parent ec8cba1 commit 161b300
Show file tree
Hide file tree
Showing 2 changed files with 206 additions and 226 deletions.
156 changes: 74 additions & 82 deletions azure-pipeline-merge.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,75 @@
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected.
# This pipeline will be extended to the OneESPT template
# If you are not using the E+D shared hosted pool with windows-2022, replace the pool section with your hosted pool, os, and image name. If you are using a Linux image, you must specify an additional windows image for SDL: https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sdlanalysis/overview#how-to-specify-a-windows-pool-for-the-sdl-source-analysis-stage
trigger:
- main

pool:
vmImage: 'windows-latest'

steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
version: '8.x'
performMultiLevelLookup: true

- script: dotnet workload restore src/EventLogExpert.sln
displayName: 'dotnet workload restore'

- script: dotnet test src/EventLogExpert.sln
displayName: 'dotnet test'

- pwsh: |
$now = [DateTime]::UtcNow
$versionString = "$($now.ToString(`"y.M.d`")).$($now.Hour * 60 + $now.Minute)"
Write-Host "##vso[task.setvariable variable=ReleaseVersion]$versionString"
Write-Host $versionString
displayName: 'create version string'

- pwsh: |
echo "ReleaseVersion: $(ReleaseVersion)"
[xml]$manifest = Get-Content -Raw "src\EventLogExpert\Platforms\Windows\Package.appxmanifest"
$manifest.Package.Identity.Version = "$(ReleaseVersion)"
$manifest.Save("src\EventLogExpert\Platforms\Windows\Package.appxmanifest")
Get-Content "src\EventLogExpert\Platforms\Windows\Package.appxmanifest"
displayName: 'set version in manifest'

- pwsh: >
dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj `
--self-contained `
-c Release `
-o "$(build.artifactStagingDirectory)" `
-p:IncludeNativeLibrariesForSelfExtract=true `
-p:PublishSingleFile=true `
-p:Version=$(ReleaseVersion)
displayName: 'dotnet publish EventDbTool'

- pwsh: >
dotnet publish src/EventLogExpert/EventLogExpert.csproj `
-c Release `
-f net8.0-windows10.0.19041.0 `
-p:AppxBundle=Never `
-p:AppInstallerCheckForUpdateFrequency=OnApplicationRun `
-p:AppInstallerUpdateFrequency=1 `
-p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" `
-p:GenerateAppInstallerFile=true `
-p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" `
-p:RuntimeIdentifierOverride=win10-x64 `
-p:UapAppxPackageBuildMode=SideLoadOnly `
-p:Version=$(ReleaseVersion)
displayName: 'dotnet publish EventLogExpert'

- pwsh: |
Get-ChildItem -Recurse "$(build.artifactStagingDirectory)"
displayName: 'show all files'

- pwsh: |
Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\*.appinstaller" | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
$msixFolder = Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\" -Directory
echo "msixFolder: $msixFolder"
Get-ChildItem $msixFolder *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
Get-ChildItem (Join-Path $msixFolder "\Dependencies\x64\") *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
displayName: 'move msix to staging directory'

- pwsh: |
Get-ChildItem "$(build.artifactStagingDirectory)"
displayName: 'show staging directory'

- pwsh: |
$appInstallerFile = Get-Item "$(build.artifactStagingDirectory)\*.appinstaller"
[xml]$appinstaller = Get-Content -Raw $appInstallerFile
$appInstaller.AppInstaller.MainPackage.Uri = $appInstaller.AppInstaller.MainPackage.Uri -replace "/download/(.*)/", "/download/"
$appInstaller.AppInstaller.Dependencies.Package.Uri = $appInstaller.AppInstaller.Dependencies.Package.Uri -replace "/download/(.*)/", "/download/"
$appInstaller.Save($appInstallerFile)
Get-Content $appInstallerFile
displayName: 'update appinstaller paths'
- main
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: MSSecurity-1ES-Build-Agents-Pool
image: MSSecurity-1ES-Windows-2022
os: windows
customBuildTags:
- ES365AIMigrationTooling
stages:
- stage: stage
jobs:
- job: job
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
version: '8.x'
performMultiLevelLookup: true
- script: dotnet workload restore src/EventLogExpert.sln
displayName: 'dotnet workload restore'
- script: dotnet test src/EventLogExpert.sln
displayName: 'dotnet test'
- pwsh: |
$now = [DateTime]::UtcNow
$versionString = "$($now.ToString(`"y.M.d`")).$($now.Hour * 60 + $now.Minute)"
Write-Host "##vso[task.setvariable variable=ReleaseVersion]$versionString"
Write-Host $versionString
displayName: 'create version string'
- pwsh: |
echo "ReleaseVersion: $(ReleaseVersion)"
[xml]$manifest = Get-Content -Raw "src\EventLogExpert\Platforms\Windows\Package.appxmanifest"
$manifest.Package.Identity.Version = "$(ReleaseVersion)"
$manifest.Save("src\EventLogExpert\Platforms\Windows\Package.appxmanifest")
Get-Content "src\EventLogExpert\Platforms\Windows\Package.appxmanifest"
displayName: 'set version in manifest'
- pwsh: >
dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj ` --self-contained ` -c Release ` -o "$(build.artifactStagingDirectory)" ` -p:IncludeNativeLibrariesForSelfExtract=true ` -p:PublishSingleFile=true ` -p:Version=$(ReleaseVersion)
displayName: 'dotnet publish EventDbTool'
- pwsh: >
dotnet publish src/EventLogExpert/EventLogExpert.csproj ` -c Release ` -f net8.0-windows10.0.19041.0 ` -p:AppxBundle=Never ` -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` -p:AppInstallerUpdateFrequency=1 ` -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` -p:GenerateAppInstallerFile=true ` -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` -p:RuntimeIdentifierOverride=win10-x64 ` -p:UapAppxPackageBuildMode=SideLoadOnly ` -p:Version=$(ReleaseVersion)
displayName: 'dotnet publish EventLogExpert'
- pwsh: |
Get-ChildItem -Recurse "$(build.artifactStagingDirectory)"
displayName: 'show all files'
- pwsh: |
Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\*.appinstaller" | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
$msixFolder = Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\" -Directory
echo "msixFolder: $msixFolder"
Get-ChildItem $msixFolder *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
Get-ChildItem (Join-Path $msixFolder "\Dependencies\x64\") *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
displayName: 'move msix to staging directory'
- pwsh: |
Get-ChildItem "$(build.artifactStagingDirectory)"
displayName: 'show staging directory'
- pwsh: |
$appInstallerFile = Get-Item "$(build.artifactStagingDirectory)\*.appinstaller"
[xml]$appinstaller = Get-Content -Raw $appInstallerFile
$appInstaller.AppInstaller.MainPackage.Uri = $appInstaller.AppInstaller.MainPackage.Uri -replace "/download/(.*)/", "/download/"
$appInstaller.AppInstaller.Dependencies.Package.Uri = $appInstaller.AppInstaller.Dependencies.Package.Uri -replace "/download/(.*)/", "/download/"
$appInstaller.Save($appInstallerFile)
Get-Content $appInstallerFile
displayName: 'update appinstaller paths'
Loading

0 comments on commit 161b300

Please sign in to comment.