Update Android base image to 2023-12-05. (#35526)

Also tells Docker to invalidate caches so that our apt-get update attempt actually does something.
This commit is contained in:
Billy O'Neal 2023-12-06 12:17:01 -08:00 committed by GitHub
parent b051745c68
commit 24d884e1b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 242 additions and 230 deletions

View File

@ -1,55 +1,65 @@
FROM ubuntu:20.04 # syntax=docker/dockerfile:1.4
ENV DEBIAN_FRONTEND noninteractive FROM ubuntu:20.04
RUN \ ADD https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb /packages-microsoft-prod.deb
apt-get update && \ ADD https://dl.google.com/android/repository/android-ndk-r25c-linux.zip /android-ndk-r25c-linux.zip
apt-get -y upgrade && \
apt-get -y --no-install-recommends install git g++ wget curl zip vim \ # Add apt packages
pkg-config tar cmake unzip ca-certificates
## vcpkg prerequisites
# Download Android NDK ENV APT_PACKAGES="git curl zip unzip tar"
RUN \
wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip && \ ## Common build prereqs
unzip android-ndk-r25c-linux.zip && \ ENV APT_PACKAGES="$APT_PACKAGES g++ vim pkg-config cmake ca-certificates"
rm -rf android-ndk-r25c-linux.zip
ENV APT_PACKAGES="$APT_PACKAGES autoconf nasm bison python2 flex build-essential libtool libtool-bin gettext automake autoconf-archive"
ENV ANDROID_NDK_HOME /android-ndk-r25c
## Python related
# Download Powershell ENV APT_PACKAGES="$APT_PACKAGES python3-setuptools python3-pip python3-venv"
RUN \
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb && \ ## freeglut
dpkg -i packages-microsoft-prod.deb && \ ENV APT_PACKAGES="$APT_PACKAGES libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev"
rm -f packages-microsoft-prod.deb && \
apt-get -y install software-properties-common && \ # glfw3
apt-get update && \ ENV APT_PACKAGES="$APT_PACKAGES libxinerama-dev libxcursor-dev"
add-apt-repository universe && \
apt-get -y install powershell # qt5-base
ENV APT_PACKAGES="$APT_PACKAGES libxext-dev libxfixes-dev libxrender-dev \
RUN \ libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev \
apt-get -y --no-install-recommends install autoconf nasm bison python2 \ libxkbcommon-dev libxcb-keysyms1-dev \
flex build-essential libtool libtool-bin gettext automake autoconf-archive libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev \
libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev \
# python related libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev \
RUN \ libxcb-cursor-dev libxkbcommon-x11-dev"
apt-get -y --no-install-recommends install python3-setuptools python3-pip python3-venv
## PowerShell
# freeglut ENV APT_PACKAGES="$APT_PACKAGES powershell"
RUN \
apt-get -y --no-install-recommends install libxi-dev libgl1-mesa-dev \ RUN <<END_OF_SCRIPT bash
libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev export DEBIAN_FRONTEND=noninteractive
# glfw3 # Apt prereqs itself
RUN \ apt-get -y update
apt-get -y --no-install-recommends install libxinerama-dev libxcursor-dev apt-get -y --no-install-recommends install ca-certificates
# required by qt5-base # Add apt repos
RUN \
apt-get -y --no-install-recommends install libxext-dev libxfixes-dev libxrender-dev \ ## PowerShell
libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev \ dpkg -i packages-microsoft-prod.deb
libxkbcommon-dev libxcb-keysyms1-dev \ rm -f packages-microsoft-prod.deb
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev \ add-apt-repository universe
libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev \
libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev \ # Run apt things
libxcb-cursor-dev libxkbcommon-x11-dev apt-get -y update
apt-get -y dist-upgrade
WORKDIR /vcpkg
apt-get -y --no-install-recommends install $APT_PACKAGES
# Android NDK
unzip /android-ndk-r25c-linux.zip
rm -f android-ndk-r25c-linux.zip
END_OF_SCRIPT
ENV ANDROID_NDK_HOME /android-ndk-r25c
WORKDIR /vcpkg

View File

@ -1,136 +1,136 @@
# Copyright (c) Microsoft Corporation. # Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# #
parameters: parameters:
- name: vcpkgToolSha - name: vcpkgToolSha
displayName: 'Custom SHA of vcpkg-tool to use rather than bootstrap' displayName: 'Custom SHA of vcpkg-tool to use rather than bootstrap'
type: string type: string
default: 'use default' default: 'use default'
- name: triplet - name: triplet
type: string type: string
- name: jobName - name: jobName
type: string type: string
- name: poolName - name: poolName
type: string type: string
- name: dockerImage - name: dockerImage
type: string type: string
- name: tripletPattern - name: tripletPattern
displayName: 'Enable the triplets which contain this substring' displayName: 'Enable the triplets which contain this substring'
type: string type: string
default: '' default: ''
jobs: jobs:
- job: ${{ parameters.jobName }} - job: ${{ parameters.jobName }}
condition: and(succeeded(), contains('^${{ parameters.triplet }}$', '${{ parameters.tripletPattern }}')) condition: and(succeeded(), contains('^${{ parameters.triplet }}$', '${{ parameters.tripletPattern }}'))
pool: pool:
name: ${{ parameters.poolName }} name: ${{ parameters.poolName }}
workspace: workspace:
clean: resources clean: resources
timeoutInMinutes: 1440 # 1 day timeoutInMinutes: 1440 # 1 day
cancelTimeoutInMinutes: 1 cancelTimeoutInMinutes: 1
variables: variables:
- name: WORKING_ROOT - name: WORKING_ROOT
value: /mnt/vcpkg-ci value: /mnt/vcpkg-ci
- name: VCPKG_DOWNLOADS - name: VCPKG_DOWNLOADS
value: /mnt/vcpkg-ci/downloads value: /mnt/vcpkg-ci/downloads
- group: vcpkg-asset-caching-credentials - group: vcpkg-asset-caching-credentials
- name: X_VCPKG_ASSET_SOURCES - name: X_VCPKG_ASSET_SOURCES
value: "x-azurl,$(root-url-ea),$(sas-ea),readwrite" value: "x-azurl,$(root-url-ea),$(sas-ea),readwrite"
- group: vcpkg-binary-caching-credentials - group: vcpkg-binary-caching-credentials
- name: X_VCPKG_BINARY_SOURCE_STUB - name: X_VCPKG_BINARY_SOURCE_STUB
value: "x-azblob,$(root-bin-url-wus3),$(sas-bin-wus3)" value: "x-azblob,$(root-bin-url-wus3),$(sas-bin-wus3)"
steps: steps:
# Note: /mnt is the Azure machines' temporary disk. # Note: /mnt is the Azure machines' temporary disk.
- bash: | - bash: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az login --identity az login --identity
az acr login --name AndContainerRegistry az acr login --name AndContainerRegistry
displayName: 'Set up managed identity' displayName: 'Set up managed identity'
- bash: | - bash: |
sudo mkdir /home/agent -m=777 sudo mkdir /home/agent -m=777
sudo chown `id -u` /home/agent sudo chown `id -u` /home/agent
sudo mkdir ${{ variables.WORKING_ROOT }} -m=777 sudo mkdir ${{ variables.WORKING_ROOT }} -m=777
sudo rm -rf ${{ variables.WORKING_ROOT }}/failure-logs sudo rm -rf ${{ variables.WORKING_ROOT }}/failure-logs
sudo mkdir ${{ variables.WORKING_ROOT }}/failure-logs -m=777 sudo mkdir ${{ variables.WORKING_ROOT }}/failure-logs -m=777
sudo mkdir ${{ variables.VCPKG_DOWNLOADS }} -m=777 sudo mkdir ${{ variables.VCPKG_DOWNLOADS }} -m=777
exit 0 exit 0
displayName: 'Create working directories' displayName: 'Create working directories'
- bash: | - bash: |
docker run --rm \ docker run --rm \
--mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \ --mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \
${{ parameters.dockerImage }} \ ${{ parameters.dockerImage }} \
./bootstrap-vcpkg.sh ./bootstrap-vcpkg.sh
displayName: 'Bootstrap vcpkg' displayName: 'Bootstrap vcpkg'
condition: eq('use default', '${{ parameters.vcpkgToolSha }}') condition: eq('use default', '${{ parameters.vcpkgToolSha }}')
- bash: | - bash: |
docker run --rm \ docker run --rm \
--mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \ --mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \
${{ parameters.dockerImage }} \ ${{ parameters.dockerImage }} \
./scripts/azure-pipelines/bootstrap-from-source.sh ${{ parameters.vcpkgToolSha }} ./scripts/azure-pipelines/bootstrap-from-source.sh ${{ parameters.vcpkgToolSha }}
displayName: "Build vcpkg with CMake" displayName: "Build vcpkg with CMake"
condition: ne('use default', '${{ parameters.vcpkgToolSha }}') condition: ne('use default', '${{ parameters.vcpkgToolSha }}')
- bash: | - bash: |
CONTAINERS=$(docker ps -a -q) CONTAINERS=$(docker ps -a -q)
if [ -n "$CONTAINERS" ]; then if [ -n "$CONTAINERS" ]; then
docker rm -f $CONTAINERS docker rm -f $CONTAINERS
fi fi
displayName: 'Stop and remove all docker containers' displayName: 'Stop and remove all docker containers'
- bash: | - bash: |
docker pull ${{ parameters.dockerImage }} docker pull ${{ parameters.dockerImage }}
displayName: 'Pull Docker Container' displayName: 'Pull Docker Container'
- task: Bash@3 - task: Bash@3
inputs: inputs:
targetType: inline targetType: inline
script: | script: |
USER=$(id --user) USER=$(id --user)
docker run --init -i \ docker run --init -i \
-a stderr \ -a stderr \
-a stdout \ -a stdout \
--user $USER \ --user $USER \
--mount type=bind,source=$(Build.Repository.LocalPath),target=/vcpkg \ --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=$(WORKING_ROOT)/failure-logs,target=/vcpkg/failure-logs \
--mount type=bind,source=/mnt/vcpkg-ci,target=/mnt/vcpkg-ci \ --mount type=bind,source=/mnt/vcpkg-ci,target=/mnt/vcpkg-ci \
--env X_VCPKG_ASSET_SOURCES="x-azurl,$(root-url-ea),$(sas-ea),readwrite" \ --env X_VCPKG_ASSET_SOURCES="x-azurl,$(root-url-ea),$(sas-ea),readwrite" \
${{ parameters.dockerImage }} \ ${{ parameters.dockerImage }} \
pwsh \ pwsh \
-File /vcpkg/scripts/azure-pipelines/test-modified-ports.ps1 \ -File /vcpkg/scripts/azure-pipelines/test-modified-ports.ps1 \
-Triplet ${{ parameters.triplet }} \ -Triplet ${{ parameters.triplet }} \
-BuildReason $(Build.Reason) \ -BuildReason $(Build.Reason) \
-BinarySourceStub "$(X_VCPKG_BINARY_SOURCE_STUB)" \ -BinarySourceStub "$(X_VCPKG_BINARY_SOURCE_STUB)" \
-WorkingRoot ${{ variables.WORKING_ROOT }} \ -WorkingRoot ${{ variables.WORKING_ROOT }} \
-IsLinuxHost -IsLinuxHost
failOnStderr: true failOnStderr: true
displayName: '*** Test Modified Ports' displayName: '*** Test Modified Ports'
- bash: | - bash: |
CONTAINERS=$(docker ps -a -q) CONTAINERS=$(docker ps -a -q)
if [ -n "$CONTAINERS" ]; then if [ -n "$CONTAINERS" ]; then
docker rm -f $CONTAINERS docker rm -f $CONTAINERS
fi fi
displayName: 'Stop and remove all docker containers' displayName: 'Stop and remove all docker containers'
condition: always() condition: always()
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: failure logs for ${{ parameters.triplet }}' displayName: 'Publish Artifact: failure logs for ${{ parameters.triplet }}'
inputs: inputs:
PathtoPublish: '$(WORKING_ROOT)/failure-logs' PathtoPublish: '$(WORKING_ROOT)/failure-logs'
ArtifactName: 'failure logs for ${{ parameters.triplet }}' ArtifactName: 'failure logs for ${{ parameters.triplet }}'
condition: ne(variables['FAILURE_LOGS_EMPTY'], 'True') condition: ne(variables['FAILURE_LOGS_EMPTY'], 'True')
- bash: | - bash: |
python3 scripts/file_script.py /mnt/vcpkg-ci/installed/vcpkg/info/ python3 scripts/file_script.py /mnt/vcpkg-ci/installed/vcpkg/info/
displayName: 'Build a file list for all packages' displayName: 'Build a file list for all packages'
condition: always() condition: always()
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: file lists for ${{ parameters.triplet }}' displayName: 'Publish Artifact: file lists for ${{ parameters.triplet }}'
condition: always() condition: always()
inputs: inputs:
PathtoPublish: scripts/list_files PathtoPublish: scripts/list_files
ArtifactName: 'file lists for ${{ parameters.triplet }}' ArtifactName: 'file lists for ${{ parameters.triplet }}'
- task: PublishTestResults@2 - task: PublishTestResults@2
displayName: 'Publish Test Results' displayName: 'Publish Test Results'
condition: ne(variables['XML_RESULTS_FILE'], '') condition: ne(variables['XML_RESULTS_FILE'], '')
inputs: inputs:
testRunTitle: ${{ parameters.triplet }} testRunTitle: ${{ parameters.triplet }}
testResultsFormat: xUnit testResultsFormat: xUnit
testResultsFiles: $(XML_RESULTS_FILE) testResultsFiles: $(XML_RESULTS_FILE)
platform: ${{ parameters.triplet }} platform: ${{ parameters.triplet }}

View File

@ -1,37 +1,39 @@
# Create Docker image for Android # Create Docker image for Android
$Location = 'westus3' $Location = 'westus3'
$Date = (Get-Date -Format 'yyyy-MM-dd') $Date = (Get-Date -Format 'yyyy-MM-dd')
$ResourceGroupName = "And-Registry" $ResourceGroupName = "And-Registry"
$ContainerRegistryName = "AndContainerRegistry" $ContainerRegistryName = "AndContainerRegistry"
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
Get-AzResourceGroup -Name $ResourceGroupName -ErrorVariable error -ErrorAction SilentlyContinue Get-AzResourceGroup -Name $ResourceGroupName -ErrorVariable error -ErrorAction SilentlyContinue
if ($error) { if ($error) {
New-AzResourceGroup -Name $ResourceGroupName -Location $Location New-AzResourceGroup -Name $ResourceGroupName -Location $Location
New-AzContainerRegistry -ResourceGroupName $ResourceGroupName -Name $ContainerRegistryName -EnableAdminUser -Sku Basic New-AzContainerRegistry -ResourceGroupName $ResourceGroupName -Name $ContainerRegistryName -EnableAdminUser -Sku Basic
} }
$registry = Get-AzContainerRegistry -ResourceGroupName $ResourceGroupName -Name $ContainerRegistryName $registry = Get-AzContainerRegistry -ResourceGroupName $ResourceGroupName -Name $ContainerRegistryName
Connect-AzContainerRegistry -Name $registry.Name Connect-AzContainerRegistry -Name $registry.Name
$imageName = "vcpkg-android" $imageName = "vcpkg-android"
Push-Location $PSScriptRoot Push-Location $PSScriptRoot
try { try {
docker build . -t $imageName docker builder prune -f --filter "until=24h"
$remote = [string]::Format('andcontainerregistry.azurecr.io/{0}:{1}', $imageName, $Date) docker build . -t $imageName
docker tag $imageName $remote
$remote = [string]::Format('andcontainerregistry.azurecr.io/{0}:{1}', $imageName, $Date)
docker push $remote docker tag $imageName $remote
#removes from local environment docker push $remote
docker rmi --force $remote $imageName
#removes from local environment
# pulls and runs ... docker rmi --force $remote $imageName
docker logout
} finally { # pulls and runs ...
Pop-Location docker logout
} } finally {
Pop-Location
Write-Host "Remote: $remote" }
Write-Host "Remote: $remote"

View File

@ -13,4 +13,4 @@ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update apt-get update
apt-get -y --no-install-recommends install docker-ce docker-ce-cli apt-get -y --no-install-recommends install docker-ce docker-ce-cli

View File

@ -6,7 +6,7 @@ variables:
linux-pool: 'PrLin-1ES-Pool' linux-pool: 'PrLin-1ES-Pool'
windows-pool: 'PrWin-2023-10-11' windows-pool: 'PrWin-2023-10-11'
osx-pool: 'PrOsx-2023-09-11' osx-pool: 'PrOsx-2023-09-11'
linux-docker-image: 'andcontainerregistry.azurecr.io/vcpkg-android:2023-10-11' linux-docker-image: 'andcontainerregistry.azurecr.io/vcpkg-android:2023-12-05'
parameters: parameters:
- name: vcpkgToolSha - name: vcpkgToolSha