[Devops] Move to use provisionator to get xcode. (#8570)

Move to use the provisionator and add a make file to generat the script
so that we only have to bump xcode in a single place.

Move all deps to provisionator and make provisionator download and
install the xi pkg that has been built to be tested in the pipeline, we
do not longer use curl to do it.
This commit is contained in:
Manuel de la Pena 2020-05-12 10:59:53 -04:00 коммит произвёл GitHub
Родитель 29dc484922
Коммит 9f380e257e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 43 добавлений и 73 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -32,3 +32,4 @@ tests/bcl-test/SystemCoreXunit*.csproj
tests/bcl-test/SystemXunit.csproj
global.json
.idea
device-tests-provisioning.csx

10
tools/devops/Makefile Normal file
Просмотреть файл

@ -0,0 +1,10 @@
TOP=../..
include $(TOP)/Make.config
device-tests-provisioning.csx: device-tests-provisioning.csx.in Makefile $(TOP)/Make.config
$(Q_GEN) sed \
-e 's#@XCODE_VERSION@#$(XCODE_VERSION)#g' \
-e 's#@XI_PACKAGE@#$(XI_PACKAGE)#g' \
-e 's#@MONO_PACKAGE@#$(MIN_MONO_URL)#g' \
-e 's#@VS_PACKAGE@#$(MIN_VISUAL_STUDIO_URL)#g' \
$< > $@;

Просмотреть файл

@ -76,25 +76,15 @@ jobs:
env:
LOGIN_KEYCHAIN_PASSWORD: $(OSX_KEYCHAIN_PASS)
- bash: |
set -x
set -e
- bash: make -C $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/ device-tests-provisioning.csx
displayName: 'Generate Provisionator csx file'
EC=0
./xamarin-macios/system-dependencies.sh --ignore-all --provision-xcode --provision-xamarin-studio --provision-mono --provision-7z || EC=$?
if [ $EC -eq 0 ]; then
echo "##vso[task.setvariable variable=ProvisioningStatus]success"
else
echo "##vso[task.setvariable variable=ProvisioningStatus]failure"
fi
exit $EC
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provision dependencies'
timeoutInMinutes: 240
- bash: ./xamarin-macios/tools/devops/install-xi-pkg.sh
displayName: 'Install XI PKG'
timeoutInMinutes: 15
inputs:
provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/device-tests-provisioning.csx
provisioning_extra_args: '-vvvv'
timeoutInMinutes: 250
- bash: |
set -x

Просмотреть файл

@ -0,0 +1,22 @@
#r "_provisionator/provisionator.dll"
using System.IO;
using System.Linq;
using static Xamarin.Provisioning.ProvisioningScript;
Xcode ("@XCODE_VERSION@").XcodeSelect (allowUntrusted: true);
// provisionator knows how to deal with this items
Item ("@MONO_PACKAGE@");
Item ("@VS_PACKAGE@");
Item ("@XI_PACKAGE@");
BrewPackage ("p7zip");
void BrewPackage (string name)
{
// Assumes brew is already installed.
// All Macs provisioned by Xamarin, VSEng, or DDFUN should have brew by default!
Item (name).Action (i => Exec ("brew", "install", i.Name));
}

Просмотреть файл

@ -9,6 +9,9 @@ resources:
ref: refs/heads/device-tests-yaml # should this be on a branch and not on master???
endpoint: xamarin
variables:
- group: xamops-azdev-secrets
jobs:
- template: device-tests-common.yml # all the smart stuff happens in the template, just needed to set the params
parameters:

Просмотреть файл

@ -1,56 +0,0 @@
#!/bin/bash -ex
XI_PKG=$XI_PACKAGE
XI_NAME=$(basename $XI_PKG)
if test -z "$XI_NAME"; then
echo "No XI_NAME. XI_PACKAGE: $XI_PACKAGE"
exit 1
fi
RETRIES=10
while true; do
RV=0
curl -LO --fail $XI_PKG || RV=$?
if [[ $RV == 0 ]]; then
# Yay, download succeeded
break;
fi
# Sometimes this happens:
#
# [...]
# 2017-08-15T07:29:26.7901630Z 59 454M 59 270M 0 0 5919k 0 0:01:18 0:00:46 0:00:32 2462k
# 2017-08-15T07:29:26.7923300Z curl: (56) SSLRead() return error -36
# 2017-08-15T07:29:26.8258480Z /bin/bash failed with return code: 56
#
# This is random, and if trying again it works.
# So if curl exits with exit code 56, we try again a few times.
#
if [[ ( $RV == 56 ) && ( $RETRIES > 0 )]]; then
echo "A hopefully transient error occurred. Trying again."
# Wait a little bit before trying again. Wait a little bit longer each time.
sleep 0.$(echo "10 - $RETRIES" | bc)
# Make sure nothing is left to interfere with the next download attempt
rm -f $XI_PKG
# Make sure we don't loop forever if the internet goes down
let RETRIES--;
continue
fi
# All hope is lost.
echo "Failed to download $XI_NAME from $XI_PACKAGE."
exit $RV
done
sudo /usr/sbin/installer -pkg "$XI_NAME" -target / -verbose -dumplog
# Print versions
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch --version
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono --version
cat /Library/Frameworks/Mono.framework/Versions/Current/updateinfo