mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-15 22:59:04 +08:00
ba1465e584
* Cherry-pick infrastructure changes from https://github.com/microsoft/vcpkg/pull/36081 as authored by @dg0yt * Suppress warnings for the monthly docker mint as suggested by Toddy Mladenov ( MS internal conversation https://teams.microsoft.com/l/message/19:f498f444e97f40b2a2027d015a9047ab@thread.tacv2/1707520630587?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=2080ccbe-0cfb-49e6-a9c1-ea6a6bf82722&parentMessageId=1707520630587&teamName=Containers%20Secure%20Supply%20Chain&channelName=3P%20Registry%20and%20Images%20Guidance&createdTime=1707520630587 ) * Move Azure Container Registry for Android to WestUS3; with this we are officially entirely within one Azure region again :D * Explicitly grant Azure DevOps permissions to touch the scale set rather than relying on subscription-level assignments.
137 lines
4.8 KiB
YAML
137 lines
4.8 KiB
YAML
# Copyright (c) Microsoft Corporation.
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
|
|
parameters:
|
|
- name: vcpkgToolSha
|
|
displayName: 'Custom SHA of vcpkg-tool to use rather than bootstrap'
|
|
type: string
|
|
default: 'use default'
|
|
- name: triplet
|
|
type: string
|
|
- name: jobName
|
|
type: string
|
|
- name: poolName
|
|
type: string
|
|
- name: dockerImage
|
|
type: string
|
|
- name: tripletPattern
|
|
displayName: 'Enable the triplets which contain this substring'
|
|
type: string
|
|
default: ''
|
|
|
|
jobs:
|
|
- job: ${{ parameters.jobName }}
|
|
condition: and(succeeded(), contains('^${{ parameters.triplet }}$', '${{ parameters.tripletPattern }}'))
|
|
pool:
|
|
name: ${{ parameters.poolName }}
|
|
workspace:
|
|
clean: resources
|
|
timeoutInMinutes: 1440 # 1 day
|
|
cancelTimeoutInMinutes: 1
|
|
variables:
|
|
- name: WORKING_ROOT
|
|
value: /mnt/vcpkg-ci
|
|
- name: VCPKG_DOWNLOADS
|
|
value: /mnt/vcpkg-ci/downloads
|
|
- group: vcpkg-asset-caching-credentials
|
|
- name: X_VCPKG_ASSET_SOURCES
|
|
value: "x-azurl,$(root-url-wus3),$(sas-wus3),readwrite"
|
|
- group: vcpkg-binary-caching-credentials
|
|
- name: X_VCPKG_BINARY_SOURCE_STUB
|
|
value: "x-azblob,$(root-bin-url-wus3),$(sas-bin-wus3)"
|
|
|
|
steps:
|
|
# Note: /mnt is the Azure machines' temporary disk.
|
|
- bash: |
|
|
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
|
az login --identity
|
|
az acr login --name vcpkgandroidwus3
|
|
displayName: 'Set up managed identity'
|
|
- bash: |
|
|
sudo mkdir /home/agent -m=777
|
|
sudo chown `id -u` /home/agent
|
|
sudo mkdir ${{ variables.WORKING_ROOT }} -m=777
|
|
sudo rm -rf ${{ variables.WORKING_ROOT }}/failure-logs
|
|
sudo mkdir ${{ variables.WORKING_ROOT }}/failure-logs -m=777
|
|
sudo mkdir ${{ variables.VCPKG_DOWNLOADS }} -m=777
|
|
exit 0
|
|
displayName: 'Create working directories'
|
|
- bash: |
|
|
docker run --rm \
|
|
--mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \
|
|
${{ parameters.dockerImage }} \
|
|
./bootstrap-vcpkg.sh
|
|
displayName: 'Bootstrap vcpkg'
|
|
condition: eq('use default', '${{ parameters.vcpkgToolSha }}')
|
|
- bash: |
|
|
docker run --rm \
|
|
--mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \
|
|
${{ parameters.dockerImage }} \
|
|
./scripts/azure-pipelines/bootstrap-from-source.sh ${{ parameters.vcpkgToolSha }}
|
|
displayName: "Build vcpkg with CMake"
|
|
condition: ne('use default', '${{ parameters.vcpkgToolSha }}')
|
|
- bash: |
|
|
CONTAINERS=$(docker ps -a -q)
|
|
if [ -n "$CONTAINERS" ]; then
|
|
docker rm -f $CONTAINERS
|
|
fi
|
|
displayName: 'Stop and remove all docker containers'
|
|
- bash: |
|
|
docker pull ${{ parameters.dockerImage }}
|
|
displayName: 'Pull Docker Container'
|
|
- task: Bash@3
|
|
inputs:
|
|
targetType: inline
|
|
script: |
|
|
USER=$(id --user)
|
|
docker run --init -i \
|
|
-a stderr \
|
|
-a stdout \
|
|
--user $USER \
|
|
--mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \
|
|
--mount type=bind,source=$(WORKING_ROOT)/failure-logs,target=/vcpkg/failure-logs \
|
|
--mount type=bind,source=/mnt/vcpkg-ci,target=/mnt/vcpkg-ci \
|
|
--env X_VCPKG_ASSET_SOURCES="x-azurl,$(root-url-wus3),$(sas-wus3),readwrite" \
|
|
${{ parameters.dockerImage }} \
|
|
pwsh \
|
|
-File /vcpkg/scripts/azure-pipelines/test-modified-ports.ps1 \
|
|
-Triplet ${{ parameters.triplet }} \
|
|
-BuildReason $(Build.Reason) \
|
|
-BinarySourceStub "$(X_VCPKG_BINARY_SOURCE_STUB)" \
|
|
-WorkingRoot ${{ variables.WORKING_ROOT }} \
|
|
-IsLinuxHost
|
|
failOnStderr: true
|
|
displayName: '*** Test Modified Ports'
|
|
- bash: |
|
|
CONTAINERS=$(docker ps -a -q)
|
|
if [ -n "$CONTAINERS" ]; then
|
|
docker rm -f $CONTAINERS
|
|
fi
|
|
displayName: 'Stop and remove all docker containers'
|
|
condition: always()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish Artifact: failure logs for ${{ parameters.triplet }}'
|
|
inputs:
|
|
PathtoPublish: '$(WORKING_ROOT)/failure-logs'
|
|
ArtifactName: 'failure logs for ${{ parameters.triplet }}'
|
|
condition: ne(variables['FAILURE_LOGS_EMPTY'], 'True')
|
|
- bash: |
|
|
python3 scripts/file_script.py /mnt/vcpkg-ci/installed/vcpkg/info/
|
|
displayName: 'Build a file list for all packages'
|
|
condition: always()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish Artifact: file lists for ${{ parameters.triplet }}'
|
|
condition: always()
|
|
inputs:
|
|
PathtoPublish: scripts/list_files
|
|
ArtifactName: 'file lists for ${{ parameters.triplet }}'
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results'
|
|
condition: ne(variables['XML_RESULTS_FILE'], '')
|
|
inputs:
|
|
testRunTitle: ${{ parameters.triplet }}
|
|
testResultsFormat: xUnit
|
|
testResultsFiles: $(XML_RESULTS_FILE)
|
|
platform: ${{ parameters.triplet }}
|