Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[devops] Move bash script from yaml to it's own bash file. #15861

Merged
merged 2 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions tools/devops/automation/scripts/bash/install-workloads.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -eux

set -o pipefail
IFS=$'\n\t '

env | sort

make global.json
make -C builds dotnet

var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable VARIABLE=DOTNET)
DOTNET=${var#*=}
echo "Using dotnet found at $DOTNET"

var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable VARIABLE=DOTNET_PLATFORMS)
DOTNET_PLATFORMS=${var#*=}
echo "Dotnet platforms are '$DOTNET_PLATFORMS'"

var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-abspath-variable VARIABLE=DOTNET_NUPKG_DIR)
DOTNET_NUPKG_DIR=${var#*=}
echo "Using nuget dir $DOTNET_NUPKG_DIR"

ROLLBACK_PATH="$BUILD_SOURCESDIRECTORY/artifacts/WorkloadRollback/WorkloadRollback.json"

echo "Rollback file contents:"
cat "$ROLLBACK_PATH"

mkdir -p "$DOTNET_NUPKG_DIR"
ls -R "$BUILD_SOURCESDIRECTORY/artifacts/not-signed-package"
cp "$BUILD_SOURCESDIRECTORY/artifacts/not-signed-package/"*.nupkg "$DOTNET_NUPKG_DIR"
cp "$BUILD_SOURCESDIRECTORY/artifacts/not-signed-package/"*.pkg "$DOTNET_NUPKG_DIR"
ls -R "$DOTNET_NUPKG_DIR"

NUGET_SOURCES=$(grep https://pkgs.dev.azure.com ./NuGet.config | sed -e 's/.*value="//' -e 's/".*//')
SOURCES=()
for source in $NUGET_SOURCES; do
SOURCES+=(--source)
SOURCES+=("$source")
done

PLATFORMS=()
for platform in $DOTNET_PLATFORMS; do
CURRENT=$(echo "$platform" | tr "[:upper:]" "[:lower:]")
PLATFORMS+=("$CURRENT")
done

$DOTNET workload install --from-rollback-file "$ROLLBACK_PATH" --source "$DOTNET_NUPKG_DIR" "${SOURCES[@]}" --verbosity diag "${PLATFORMS[@]}"

var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable VARIABLE=DOTNET_DIR)
DOTNET_DIR=${var#*=}
ls -lR "$DOTNET_DIR"
57 changes: 2 additions & 55 deletions tools/devops/automation/templates/tests/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,6 @@ steps:
allowFailedBuilds: true
path: $(Build.SourcesDirectory)/artifacts

- bash: |
set -x
set -e

make global.json
make -C builds dotnet
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios
displayName: Bootstrap dotnet
timeoutInMinutes: 30

- pwsh: |
$workloadPath = "$(Build.SourcesDirectory)/artifacts/WorkloadRollback/WorkloadRollback.json"
$versionData = Get-Content $workloadPath | ConvertFrom-Json
Expand All @@ -100,53 +90,10 @@ steps:
Write-Host "##vso[task.setvariable variable=MACCATALYST_WORKLOAD_VERSION;]$catalystVersion"
displayName: 'Set workload versions for xtro'

- bash: |
set -x
set -e

var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=DOTNET)
DOTNET=${var#*=}
echo "Using dotnet found at $DOTNET"

var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=DOTNET_PLATFORMS)
DOTNET_PLATFORMS=${var#*=}
echo "Dotnet platforms are '$DOTNET_PLATFORMS'"

var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-abspath-variable VARIABLE=DOTNET_NUPKG_DIR)
DOTNET_NUPKG_DIR=${var#*=}
echo "Using nuget dir $DOTNET_NUPKG_DIR"

ROLLBACK_PATH="$(Build.SourcesDirectory)/artifacts/WorkloadRollback/WorkloadRollback.json"

echo "Rollback file contents:"
echo "$(cat $ROLLBACK_PATH)"

mkdir -p $DOTNET_NUPKG_DIR
ls -R $(Build.SourcesDirectory)/artifacts/not-signed-package
cp $(Build.SourcesDirectory)/artifacts/not-signed-package/*.nupkg $DOTNET_NUPKG_DIR
cp $(Build.SourcesDirectory)/artifacts/not-signed-package/*.pkg $DOTNET_NUPKG_DIR
ls -R $DOTNET_NUPKG_DIR

NUGET_SOURCES=$(grep https://pkgs.dev.azure.com ./NuGet.config | sed -e 's/.*value="//' -e 's/".*//')
SOURCES=""
for source in $NUGET_SOURCES; do
SOURCES="$SOURCES --source $source"
done

PLATFORMS=""
for platform in $DOTNET_PLATFORMS; do
CURRENT=$(echo $platform | tr A-Z a-z)
PLATFORMS="$PLATFORMS $CURRENT"
done

$DOTNET workload install --from-rollback-file $ROLLBACK_PATH --source $DOTNET_NUPKG_DIR $SOURCES --verbosity diag $PLATFORMS

var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=DOTNET_DIR)
DOTNET_DIR=${var#*=}
ls -lR $DOTNET_DIR

- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/install-workloads.sh
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios
displayName: 'Install dotnet workloads'
timeoutInMinutes: 45

- bash: |
set -x
Expand Down