2023-12-07 04:17:01 +08:00
|
|
|
# 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: jobName
|
|
|
|
type: string
|
|
|
|
- name: dockerImage
|
|
|
|
type: string
|
|
|
|
- name: tripletPattern
|
|
|
|
displayName: 'Enable the triplets which contain this substring'
|
|
|
|
type: string
|
|
|
|
default: ''
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
- job: ${{ parameters.jobName }}
|
2024-04-26 09:25:03 +08:00
|
|
|
condition: and(succeeded(), contains('^${{ replace(parameters.jobName, '_', '-') }}$', '${{ parameters.tripletPattern }}'))
|
2023-12-07 04:17:01 +08:00
|
|
|
pool:
|
2024-03-06 04:35:00 +08:00
|
|
|
name: 'PrAnd-1ES-Pool'
|
|
|
|
demands:
|
|
|
|
- ImageOverride -equals vcpkg-mariner-docker-gen1
|
2023-12-07 04:17:01 +08:00
|
|
|
workspace:
|
|
|
|
clean: resources
|
|
|
|
timeoutInMinutes: 1440 # 1 day
|
|
|
|
cancelTimeoutInMinutes: 1
|
2024-04-26 09:25:03 +08:00
|
|
|
dependsOn: mintsas
|
2023-12-07 04:17:01 +08:00
|
|
|
variables:
|
|
|
|
- name: WORKING_ROOT
|
|
|
|
value: /mnt/vcpkg-ci
|
|
|
|
- name: VCPKG_DOWNLOADS
|
|
|
|
value: /mnt/vcpkg-ci/downloads
|
|
|
|
- name: X_VCPKG_ASSET_SOURCES
|
2024-04-26 09:25:03 +08:00
|
|
|
value: $[ dependencies.mintsas.outputs['mintsasstep.X_VCPKG_ASSET_SOURCES'] ]
|
2023-12-07 04:17:01 +08:00
|
|
|
- name: X_VCPKG_BINARY_SOURCE_STUB
|
2024-04-26 09:25:03 +08:00
|
|
|
value: $[ dependencies.mintsas.outputs['mintsasstep.X_VCPKG_BINARY_SOURCE_STUB'] ]
|
2023-12-07 04:17:01 +08:00
|
|
|
steps:
|
|
|
|
# Note: /mnt is the Azure machines' temporary disk.
|
|
|
|
- bash: |
|
|
|
|
az login --identity
|
2024-02-22 08:30:42 +08:00
|
|
|
az acr login --name vcpkgandroidwus3
|
2023-12-07 04:17:01 +08:00
|
|
|
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'
|
2024-03-06 04:35:00 +08:00
|
|
|
- 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'
|
2023-12-07 04:17:01 +08:00
|
|
|
- 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 }}')
|
|
|
|
- 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 \
|
2024-04-26 09:25:03 +08:00
|
|
|
--env X_VCPKG_ASSET_SOURCES="$(X_VCPKG_ASSET_SOURCES)" \
|
2023-12-07 04:17:01 +08:00
|
|
|
${{ parameters.dockerImage }} \
|
|
|
|
pwsh \
|
|
|
|
-File /vcpkg/scripts/azure-pipelines/test-modified-ports.ps1 \
|
2024-04-26 09:25:03 +08:00
|
|
|
-Triplet ${{ replace(parameters.jobName, '_', '-') }} \
|
2023-12-07 04:17:01 +08:00
|
|
|
-BuildReason $(Build.Reason) \
|
|
|
|
-BinarySourceStub "$(X_VCPKG_BINARY_SOURCE_STUB)" \
|
2024-04-26 09:25:03 +08:00
|
|
|
-WorkingRoot ${{ variables.WORKING_ROOT }}
|
2023-12-07 04:17:01 +08:00
|
|
|
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
|
2024-04-26 09:25:03 +08:00
|
|
|
displayName: "Publish Artifact: failure logs for ${{ replace(parameters.jobName, '_', '-') }}"
|
2023-12-07 04:17:01 +08:00
|
|
|
inputs:
|
|
|
|
PathtoPublish: '$(WORKING_ROOT)/failure-logs'
|
2024-04-26 09:25:03 +08:00
|
|
|
ArtifactName: "failure logs for ${{ replace(parameters.jobName, '_', '-') }}"
|
2023-12-07 04:17:01 +08:00
|
|
|
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
|
2024-04-26 09:25:03 +08:00
|
|
|
displayName: "Publish Artifact: file lists for ${{ replace(parameters.jobName, '_', '-') }}"
|
2023-12-07 04:17:01 +08:00
|
|
|
condition: always()
|
|
|
|
inputs:
|
|
|
|
PathtoPublish: scripts/list_files
|
2024-04-26 09:25:03 +08:00
|
|
|
ArtifactName: "file lists for ${{ replace(parameters.jobName, '_', '-') }}"
|
2023-12-07 04:17:01 +08:00
|
|
|
- task: PublishTestResults@2
|
|
|
|
displayName: 'Publish Test Results'
|
|
|
|
condition: ne(variables['XML_RESULTS_FILE'], '')
|
|
|
|
inputs:
|
2024-04-26 09:25:03 +08:00
|
|
|
testRunTitle: ${{ replace(parameters.jobName, '_', '-') }}
|
2023-12-07 04:17:01 +08:00
|
|
|
testResultsFormat: xUnit
|
|
|
|
testResultsFiles: $(XML_RESULTS_FILE)
|
2024-04-26 09:25:03 +08:00
|
|
|
platform: ${{ replace(parameters.jobName, '_', '-') }}
|