sudo/.pipelines/PR.Pipeline.yml

113 lines
4.5 KiB
YAML

#################################################################################
# OneBranch Pipelines - Buddy #
# This pipeline was created by EasyStart from a sample located at: #
# https://aka.ms/obpipelines/easystart/samples #
# Documentation: https://aka.ms/obpipelines #
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
# Retail Tasks: https://aka.ms/obpipelines/tasks #
# Support: https://aka.ms/onebranchsup #
#################################################################################
trigger: none
# - main
parameters: # parameters are shown up in ADO UI in a build queue time
# buildPlatforms: This controls which Rust triples we build sudo for.
# These three defaults correspond to x64, x86 and ARM64.
# They're used by:
# - The OneBranch.Common.yml, to control which --target's we build in release
# - The vpack task, below.
- name: buildPlatforms
type: object
default:
- x86_64-pc-windows-msvc # x64
- i686-pc-windows-msvc # x86
- aarch64-pc-windows-msvc # arm64
# Hourly builds: you may want to change these to nightly ("0 3 * * *" - run at 3am).
schedules:
- cron: 0 * * * *
displayName: Hourly build
branches:
include:
- master
always: true
variables:
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest'
# LOAD BEARING - the vpack task fails without these
ROOT: $(Build.SourcesDirectory)
REPOROOT: $(Build.SourcesDirectory)
OUTPUTROOT: $(REPOROOT)\out
NUGET_XMLDOC_MODE: none
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
extends:
# We're an official build, so we need to extend from the _Official_ build template.
template: v2/Microsoft.NonOfficial.yml@templates
parameters:
platform:
name: 'windows_undocked'
product: 'sudo'
cloudvault: # https://aka.ms/obpipelines/cloudvault
enabled: false
globalSdl: # https://aka.ms/obpipelines/sdl
binskim:
# Rust build scripts will not be built with spectre-mitigations enabled,
# so only scan the actual output binaries.
scanOutputDirectoryOnly: true
stages:
# Our Build stage will build all three targets in one job, so we don't need
# to repeat most of the boilerplate work in three separate jobs.
- stage: Build
jobs:
- job: Windows
pool:
type: windows
variables:
# Binaries will go here
ob_outputDirectory: '$(Build.SourcesDirectory)/out' # More settings at https://aka.ms/obpipelines/yaml/jobs
additionalTargets: $(parameters.buildPlatforms)
# For details on this cargo_target_dir setting, see https://eng.ms/docs/more/rust/topics/onebranch-workaround
cargo_target_dir: C:\cargo_target_dir
# The "standard" pipeline has a bunch of other variables it sets here
# to control vpack creation. However, for a PR build, we don't really
# need any of that.
steps:
# The actual build is over in Onebranch.Common.yml
- template: .pipelines/OneBranch.Common.yml@self
parameters:
buildPlatforms: ${{ parameters.buildPlatforms }}
# branding will use the default, which is set to build all of them.
# tracingGuid will use the default placeholder for PR builds
# This is very shamelessly stolen from curl's pipeline. Small
# modification: since our cargo.toml has a bunch of lines with "version",
# bail after the first.
- script: |-
rem Parse the version out of cargo.toml
for /f "tokens=3 delims=- " %%x in ('findstr /c:"version = " sudo\cargo.toml') do (@echo ##vso[task.setvariable variable=SudoVersion]%%~x & goto :EOF)
displayName: 'Set SudoVersion'
# Codesigning. Cribbed directly from the curl codesign task
- task: onebranch.pipeline.signing@1
displayName: 'Sign files'
inputs:
command: 'sign'
signing_profile: 'external_distribution'
files_to_sign: '**/*.exe'
search_root: '$(ob_outputDirectory)'
use_testsign: false
in_container: true