[jenkins] Jenkins is dead, long live ~Wrench~ Azure Devops. (#16396)
Remove all Jenkins logic that's no longer being used.
This commit is contained in:
Родитель
bc881f49ee
Коммит
1c4ac4564d
|
@ -64,7 +64,6 @@ MAC_PACKAGE_VERSION=8.13.0.$(MAC_COMMIT_DISTANCE)
|
|||
# numbers (major.minor) changes.
|
||||
|
||||
# WARNING: Do **not** use versions higher than the available Xcode SDK or else we will have issues with mtouch (See https://github.com/xamarin/xamarin-macios/issues/7705)
|
||||
# When bumping the major macOS version in MACOS_NUGET_VERSION also update the macOS version where we execute on bots in jenkins/Jenkinsfile (in the 'node' element)
|
||||
|
||||
IOS_NUGET_OS_VERSION=15.4
|
||||
TVOS_NUGET_OS_VERSION=15.4
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
failure-stamp
|
||||
pr-comments.md
|
||||
build-failure.md
|
||||
.tmp-labels*
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,8 +0,0 @@
|
|||
TOP=..
|
||||
include $(TOP)/Make.config
|
||||
|
||||
all check:
|
||||
shellcheck *.sh
|
||||
|
||||
print-abspath-variable:
|
||||
@echo $(VARIABLE)=$(abspath $($(VARIABLE)))
|
|
@ -1,35 +0,0 @@
|
|||
# Jenkins
|
||||
|
||||
This directory contains all the scripts to be executed as steps in the jenkins build bots for each of the PR in the project. The expected order in which they have to
|
||||
be executed is as follows:
|
||||
|
||||
* provision-deps.sh : Downloads and installs the project dependencies.
|
||||
* build.sh : Builds the project.
|
||||
* run-tests.sh : Runs the tests.
|
||||
* build-api-diff.sh : Builds the API diff.
|
||||
|
||||
# Jenkinsfile
|
||||
|
||||
This file contains the logic to run on our internal Jenkins, available here: http://xamarin-jenkins/blue/organizations/jenkins/macios/activity
|
||||
|
||||
The Jenkins job is a multi-branch pipeline job, it will execute in the
|
||||
following conditions:
|
||||
|
||||
* For all branches in the xamarin org (not forks) that has a
|
||||
jenkins/Jenkinsfile file.
|
||||
* For all pull requests from people with write access (also conditional on
|
||||
having a jenkins/Jenkinsfile file).
|
||||
|
||||
In very broad strokes, the Jenkins job will:
|
||||
|
||||
* Checkout xamarin-macios
|
||||
* Build
|
||||
* Create packages, upload them to Azure and publish the links to the packages
|
||||
as GitHub statuses.
|
||||
* Run our test suite.
|
||||
* Run selected Xamarin.Mac tests on all macOS versions we support. This is
|
||||
done in parallel with the normal test run.
|
||||
|
||||
If a particular macOS version must be excluded temporarily from testing,
|
||||
search Jenkinsfile for `excludedOSes` and follow the instructions you'll
|
||||
find.
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
report_error ()
|
||||
{
|
||||
printf "🔥 [Failed to create API Diff](%s/console) 🔥\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
}
|
||||
trap report_error ERR
|
||||
|
||||
# SC2154: ghprbPullId is referenced but not assigned.
|
||||
# shellcheck disable=SC2154
|
||||
if test -n "$ghprbPullId" && ./jenkins/fetch-pr-labels.sh --check=skip-public-jenkins; then
|
||||
echo "Skipping API diff because the label 'skip-public-jenkins' was found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export BUILD_REVISION=jenkins
|
||||
make -j8 -C tools/apidiff jenkins-api-diff
|
||||
|
||||
if [[ "x$1" == "x--publish" ]]; then
|
||||
URL_PREFIX=$(./jenkins/publish-results.sh | grep "^Url Prefix: " | sed 's/^Url Prefix: //')
|
||||
URL="$URL_PREFIX/api-diff/index.html"
|
||||
else
|
||||
URL="$BUILD_URL/API_20diff_20_28from_20stable_29"
|
||||
fi
|
||||
|
||||
printf "✅ [API Diff (from stable)](%s)\\n" "$URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
140
jenkins/build.sh
140
jenkins/build.sh
|
@ -1,140 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# Script that builds xamarin-macios for CI
|
||||
#
|
||||
# --configure-flags=<flags>: Flags to pass to --configure. Optional
|
||||
# --timeout=<timeout>: Time out the build after <timeout> seconds.
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
export FAILURE_REASON_PATH="$WORKSPACE/jenkins/build-failure.md"
|
||||
|
||||
report_error ()
|
||||
{
|
||||
printf "🔥 [Build failed](%s/console) 🔥\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
if test -f "$FAILURE_REASON_PATH"; then
|
||||
sed 's/^/* /' "$FAILURE_REASON_PATH" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
fi
|
||||
}
|
||||
trap report_error ERR
|
||||
|
||||
timeout ()
|
||||
{
|
||||
# create a subprocess that kills this process after a certain number of seconds
|
||||
SELF_PID=$$
|
||||
(
|
||||
sleep "$1"
|
||||
echo "Execution timed out after $1 seconds."
|
||||
printf "❌ [Build timed out](%s/console)\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
kill -9 $SELF_PID
|
||||
)&
|
||||
# kill the subprocess timeout if we exit before we time out
|
||||
TIMEOUT_PID=$!
|
||||
trap 'kill -9 $TIMEOUT_PID' EXIT
|
||||
}
|
||||
|
||||
while ! test -z "$1"; do
|
||||
case "$1" in
|
||||
--configure-flags=*)
|
||||
CONFIGURE_FLAGS="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--configure-flags)
|
||||
CONFIGURE_FLAGS="$2"
|
||||
shift 2
|
||||
;;
|
||||
--timeout=*)
|
||||
TIMEOUT="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--timeout)
|
||||
TIMEOUT="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -n "$TIMEOUT"; then
|
||||
timeout "$TIMEOUT"
|
||||
fi
|
||||
|
||||
ls -la "$WORKSPACE/jenkins"
|
||||
echo "$WORKSPACE/jenkins/pr-comments.md:"
|
||||
cat "$WORKSPACE/jenkins/pr-comments.md" || true
|
||||
|
||||
export BUILD_REVISION=jenkins
|
||||
|
||||
ENABLE_DEVICE_BUILD=
|
||||
|
||||
# SC2154: ghprbPullId is referenced but not assigned.
|
||||
# shellcheck disable=SC2154
|
||||
if test -z "$ghprbPullId"; then
|
||||
echo "Could not find the environment variable ghprbPullId, so forcing a device build."
|
||||
ENABLE_DEVICE_BUILD=1
|
||||
else
|
||||
if ./jenkins/fetch-pr-labels.sh --check=skip-public-jenkins; then
|
||||
echo "Skipping execution because the label 'skip-public-jenkins' was found."
|
||||
printf "ℹ️ [Skipped execution](%s/console)\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
exit 0
|
||||
fi
|
||||
echo "Listing modified files for pull request #$ghprbPullId..."
|
||||
if git diff-tree --no-commit-id --name-only -r "origin/pr/$ghprbPullId/merge^..origin/pr/$ghprbPullId/merge" > .tmp-files; then
|
||||
echo "Modified files found":
|
||||
sed 's/^/ /' .tmp-files || true
|
||||
if grep 'mk/mono.mk' .tmp-files > /dev/null; then
|
||||
echo "Enabling device build because mono was bumped."
|
||||
ENABLE_DEVICE_BUILD=1
|
||||
else
|
||||
echo "Not enabling device build; mono wasn't bumped."
|
||||
fi
|
||||
fi
|
||||
rm -f .tmp-files
|
||||
|
||||
if test -z "$ENABLE_DEVICE_BUILD"; then
|
||||
if ./jenkins/fetch-pr-labels.sh --check=enable-device-build; then
|
||||
ENABLE_DEVICE_BUILD=1
|
||||
echo "Enabling device build because the label 'enable-device-build' was found."
|
||||
else
|
||||
echo "Not enabling device build; no label named 'enable-device-build' was found."
|
||||
fi
|
||||
fi
|
||||
|
||||
if ./jenkins/fetch-pr-labels.sh --check=run-sample-tests; then
|
||||
echo "The sample tests won't be triggered from public jenkins even if the 'run-sample-tests' label is set (build on internal Jenkins instead)."
|
||||
printf "ℹ️ The sample tests won't be triggered from public jenkins even if the 'run-sample-tests' label is set (build on internal Jenkins instead).\\n" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
fi
|
||||
|
||||
if ./jenkins/fetch-pr-labels.sh --check=disable-packaged-mono; then
|
||||
echo "Building mono from source because the label 'disable-packaged-mono' was found."
|
||||
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --disable-packaged-mono"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test -z "$ENABLE_DEVICE_BUILD"; then
|
||||
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --disable-ios-device"
|
||||
fi
|
||||
|
||||
# Enable dotnet bits on the bots
|
||||
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-dotnet --enable-install-source"
|
||||
|
||||
echo "Configuring the build with: $CONFIGURE_FLAGS"
|
||||
# shellcheck disable=SC2086
|
||||
./configure $CONFIGURE_FLAGS
|
||||
|
||||
# If we're building mono from source, we might not have it cloned yet
|
||||
make reset
|
||||
|
||||
time make -j8
|
||||
time make install -j8
|
||||
|
||||
printf "✅ [Build succeeded](%s/console)\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
|
||||
if grep MONO_BUILD_FROM_SOURCE=. configure.inc Make.config.inc >& /dev/null; then
|
||||
printf " ⚠️ Mono built from source\\n" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
fi
|
|
@ -1,64 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# SC2154: ghprbPullId is referenced but not assigned.
|
||||
# shellcheck disable=SC2154
|
||||
if test -z "$ghprbPullId"; then
|
||||
echo "Could not find the environment variable ghprbPullId, so it's not possible to fetch the labels for any pull request."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FORCE=
|
||||
CHECK=
|
||||
while ! test -z "$1"; do
|
||||
case "$1" in
|
||||
--force|-f)
|
||||
FORCE=1
|
||||
shift
|
||||
;;
|
||||
--check)
|
||||
if test -z "$2"; then
|
||||
echo "Missing argument to --check"
|
||||
exit 1
|
||||
fi
|
||||
CHECK="$2"
|
||||
shift 2
|
||||
;;
|
||||
--check=*|--check:*)
|
||||
CHECK="${1:8}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
TMPFILE=".tmp-labels-$ghprbPullId"
|
||||
if [[ x"$FORCE" == "x" && ( -f "$TMPFILE" ) ]]; then
|
||||
echo "Not downloading labels for pull request #$ghprbPullId because they've already been downloaded."
|
||||
else
|
||||
echo "Downloading labels for pull request #$ghprbPullId..."
|
||||
if ! curl --silent "https://api.github.com/repos/xamarin/xamarin-macios/issues/$ghprbPullId/labels" > "$TMPFILE.dl"; then
|
||||
echo "Failed to fetch labels for the pull request $ghprbPullId."
|
||||
exit 1
|
||||
fi
|
||||
grep "\"name\":" "$TMPFILE.dl" | sed -e 's/name": \"//' -e 's/.*\"\(.*\)\".*/\1/'> "$TMPFILE" || true
|
||||
fi
|
||||
|
||||
# Find any custom labels
|
||||
grep -v '^[[:space:]]*#' custom-labels.txt | grep -v '^[[:space:]]*$' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' >> "$TMPFILE" || true
|
||||
|
||||
if test -z "$CHECK"; then
|
||||
echo "Labels found:"
|
||||
sed 's/^/ /' "$TMPFILE"
|
||||
else
|
||||
if grep "^$CHECK$" "$TMPFILE" >/dev/null 2>&1; then
|
||||
echo "The pull request $ghprbPullId contains the label $CHECK."
|
||||
else
|
||||
echo "The pull request $ghprbPullId does not contain the label $CHECK."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp
|
||||
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
var args = Environment.GetCommandLineArgs ();
|
||||
var expectedArgumentCount = 1;
|
||||
if (args.Length != expectedArgumentCount + 2 /* 2 default arguments (executable + script) + 'expectedArgumentCount' arguments we're interested in */) {
|
||||
// first arg is "/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/4.5/csharp.exe"
|
||||
// second arg the script itself
|
||||
// then comes the ones we care about
|
||||
Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length - 2}");
|
||||
Environment.Exit (1);
|
||||
return;
|
||||
}
|
||||
|
||||
var plistPath = args [2];
|
||||
var doc = new XmlDocument ();
|
||||
doc.Load (plistPath);
|
||||
var nodes = doc.SelectNodes ($"/plist/dict/key[text()='KnownVersions']/following-sibling::dict[1]/key[text()='macOS']/following-sibling::array[1]/string");
|
||||
|
||||
var sb = new StringBuilder ();
|
||||
foreach (XmlNode n in nodes)
|
||||
sb.Append ($"{n.InnerText} ");
|
||||
Console.WriteLine (sb);
|
||||
|
||||
Environment.Exit (0);
|
|
@ -1,99 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# don't change the current directory here
|
||||
|
||||
if [[ "$1" == "--install-old-mono" ]]; then
|
||||
cd mac-test-package
|
||||
URL=$(grep "^MIN_XM_MONO_URL=" Make.config | sed 's/.*=//')
|
||||
|
||||
COUNTER=0
|
||||
echo "Downloading and installing $URL"
|
||||
while [[ $COUNTER -lt 5 ]]; do
|
||||
EC=0
|
||||
curl -s -L "$URL" --output old-mono.pkg || EC=$?
|
||||
if [[ $EC -eq 56 ]]; then
|
||||
# Sometimes we get spurious "curl: (56) SSLRead() return error -9806" errors. Trying again usually works, so lets try again a few more times.
|
||||
# https://github.com/xamarin/maccore/issues/1098
|
||||
let COUNTER++ || true
|
||||
continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
if [[ "x$EC" != "x0" ]]; then
|
||||
echo "Failed to provision old mono (exit code: $EC)"
|
||||
exit $EC
|
||||
fi
|
||||
|
||||
sudo installer -pkg old-mono.pkg -target /
|
||||
mono --version
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
URL=$1
|
||||
MACCORE_HASH=$2
|
||||
if test -z "$URL"; then
|
||||
echo "First argument must be the url for the packaged mac tests."
|
||||
exit 1
|
||||
fi
|
||||
if test -z "$MACCORE_HASH"; then
|
||||
echo "Second argument must be the maccore hash."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Allow some bot-specific configuration.
|
||||
# Some bots use this to change PATH to where a custom version of ruby is installed.
|
||||
if test -f ~/.jenkins-profile; then
|
||||
# SC1090: Can't follow non-constant source. Use a directive to specify location.
|
||||
# shellcheck disable=SC1090
|
||||
source ~/.jenkins-profile;
|
||||
fi
|
||||
|
||||
# Install 7z. We can't do this from the system-dependencies.sh script, because
|
||||
# we need 7z to decompress the file where the system-dependencies.sh script
|
||||
# resides.
|
||||
# Also ignore any failures, brew may fail if 7z is already installed.
|
||||
brew install p7zip || true
|
||||
|
||||
env
|
||||
rm -f -- ./*.7z
|
||||
curl -fL "$URL" --output mac-test-package.7z
|
||||
rm -rf mac-test-package
|
||||
7z x mac-test-package.7z
|
||||
cd mac-test-package
|
||||
|
||||
COUNTER=0
|
||||
while [[ $COUNTER -lt 5 ]]; do
|
||||
EC=0
|
||||
./system-dependencies.sh --ignore-all --provision-mono || EC=$?
|
||||
if [[ $EC -eq 56 ]]; then
|
||||
# Sometimes we get spurious "curl: (56) SSLRead() return error -9806" errors. Trying again usually works, so lets try again a few more times.
|
||||
# https://github.com/xamarin/maccore/issues/1098
|
||||
let COUNTER++ || true
|
||||
continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
if [[ "x$EC" != "x0" ]]; then
|
||||
echo "Failed to provision dependencies (exit code: $EC)"
|
||||
exit $EC
|
||||
fi
|
||||
|
||||
# fetch script to install provisioning profiles and run it
|
||||
if test -d maccore; then
|
||||
cd maccore
|
||||
if ! git fetch origin; then
|
||||
cd ..
|
||||
rm -Rf maccore
|
||||
fi
|
||||
fi
|
||||
if ! test -d maccore; then
|
||||
git clone git@github.com:xamarin/maccore
|
||||
cd maccore
|
||||
fi
|
||||
git reset --hard "$MACCORE_HASH"
|
||||
cd ..
|
||||
|
||||
./maccore/tools/install-qa-provisioning-profiles.sh --only-create-keychain -v
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
report_error ()
|
||||
{
|
||||
echo "🔥 [Provisioning failed]($BUILD_URL/console) 🔥" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
}
|
||||
trap report_error ERR
|
||||
|
||||
# SC2154: ghprbPullId is referenced but not assigned.
|
||||
# shellcheck disable=SC2154
|
||||
if test -n "$ghprbPullId" && ./jenkins/fetch-pr-labels.sh --check=skip-public-jenkins; then
|
||||
echo "Skipping provisioning diff because the label 'skip-public-jenkins' was found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get all our dependencies
|
||||
make reset
|
||||
|
||||
# Make sure everything is pristine
|
||||
make git-clean-all
|
||||
|
||||
# Print a list of our dpendencies
|
||||
make print-versions
|
||||
|
||||
# Provision external dependencies
|
||||
./system-dependencies.sh --provision-all
|
||||
|
||||
sudo rm -Rf /Developer/MonoTouch
|
||||
sudo rm -Rf /Library/Frameworks/Xamarin.iOS.framework
|
||||
sudo rm -Rf /Library/Frameworks/Xamarin.Mac.framework
|
||||
|
||||
echo "✅ [Provisioning succeeded]($BUILD_URL/console)" >> "$WORKSPACE/jenkins/pr-comments.md"
|
|
@ -1,38 +0,0 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
report_error ()
|
||||
{
|
||||
printf "🔥 [Failed to publish results](%s/console) 🔥\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
}
|
||||
trap report_error ERR
|
||||
|
||||
# SC2154: ghprbPullId is referenced but not assigned.
|
||||
# shellcheck disable=SC2154
|
||||
if test -n "$ghprbPullId"; then
|
||||
BRANCH_NAME="pr$ghprbPullId"
|
||||
elif test -z "$BRANCH_NAME"; then
|
||||
echo "Neither BRANCH_NAME nor ghprbPullId is set"
|
||||
exit 1
|
||||
fi
|
||||
if test -z "$BUILD_NUMBER"; then
|
||||
echo "BUILD_NUMBER is not set"
|
||||
exit 1
|
||||
fi
|
||||
P="jenkins/xamarin-macios/${BRANCH_NAME}/$(git log -1 --pretty=%H)/${BUILD_NUMBER}"
|
||||
|
||||
echo "Url Prefix: http://xamarin-storage/$P/jenkins-results"
|
||||
echo "Periodic Command: --periodic-interval 10 --periodic-command rsync --periodic-command-arguments '-avz --chmod=+r -e ssh $WORKSPACE/jenkins-results builder@xamarin-storage:/volume1/storage/$P'"
|
||||
|
||||
mkdir -p "$WORKSPACE/jenkins-results"
|
||||
|
||||
# Publish
|
||||
|
||||
# Make sure the target directory exists
|
||||
|
||||
# SC2029: Note that, unescaped, this expands on the client side. [Referring to $P]
|
||||
# shellcheck disable=SC2029
|
||||
ssh builder@xamarin-storage "mkdir -p /volume1/storage/$P"
|
||||
rsync -avz --chmod=+r -e ssh "$WORKSPACE/jenkins-results" "builder@xamarin-storage:/volume1/storage/$P"
|
|
@ -1,98 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# Script to publish nugets.
|
||||
#
|
||||
# Arguments (all required):
|
||||
# --apikey=<pat>: The api key to authenticate with the nuget server.
|
||||
# --source=<url>: The nuget server
|
||||
#
|
||||
|
||||
INITIAL_CD=$(pwd)
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
CONFIG_FILE=.nuget.config.tmp
|
||||
|
||||
report_error ()
|
||||
{
|
||||
# remove config
|
||||
rm -f $CONFIG_FILE
|
||||
|
||||
# Show error
|
||||
printf "🔥 [Failed to publish to nuget](%s/console) 🔥\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
}
|
||||
trap report_error ERR
|
||||
|
||||
realpath() {
|
||||
[[ $1 = /* ]] && echo "$1" || echo "$INITIAL_CD/${1#./}"
|
||||
}
|
||||
|
||||
APIKEY=
|
||||
SOURCE=
|
||||
VERBOSITY=()
|
||||
NUGETS=()
|
||||
|
||||
while ! test -z "${1:-}"; do
|
||||
case "$1" in
|
||||
--apikey=*)
|
||||
APIKEY="${1:9}"
|
||||
shift
|
||||
;;
|
||||
--apikey)
|
||||
APIKEY="$2"
|
||||
shift 2
|
||||
;;
|
||||
--source=*)
|
||||
SOURCE="${1:9}"
|
||||
shift
|
||||
;;
|
||||
--source)
|
||||
SOURCE="$2"
|
||||
shift 2
|
||||
;;
|
||||
-v | --verbose)
|
||||
VERBOSITY=("-Verbosity" "detailed")
|
||||
set -x
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
echo "Unknown argument: $1"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
NUGETS+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$APIKEY"; then
|
||||
echo "The API key is required (--apikey=<apikey>)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$SOURCE"; then
|
||||
echo "The source is required (--source=<source>)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "x${#NUGETS[@]}" == "x0" ]]; then
|
||||
echo "No nupkgs provided."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# create empty config for auth
|
||||
echo '<?xml version="1.0" encoding="utf-8"?><configuration></configuration>' > $CONFIG_FILE
|
||||
|
||||
# add the feed
|
||||
nuget sources add -name FEEDME -source "$SOURCE" -username WHATEVER -password "$APIKEY" -config $CONFIG_FILE
|
||||
|
||||
# push
|
||||
for nuget in "${NUGETS[@]}"; do
|
||||
nuget="$(realpath "$nuget")"
|
||||
nuget push "$nuget" -Source FEEDME -ApiKey WHATEVER -NonInteractive "${VERBOSITY[@]}" -ConfigFile $CONFIG_FILE
|
||||
done
|
||||
|
||||
# remove config
|
||||
rm -f $CONFIG_FILE
|
|
@ -1,109 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
WORKSPACE=$(pwd)
|
||||
|
||||
# Print out environment for debug purposes
|
||||
env | sort
|
||||
|
||||
report_error ()
|
||||
{
|
||||
printf "🔥 [Test run failed](%s) 🔥\\n" "$URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
|
||||
if test -f "$WORKSPACE/tests/TestSummary.md"; then
|
||||
printf "\\n" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
cat "$WORKSPACE/tests/TestSummary.md" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
fi
|
||||
|
||||
touch "$WORKSPACE/jenkins/failure-stamp"
|
||||
}
|
||||
trap report_error ERR
|
||||
|
||||
# SC2154: ghprbPullId is referenced but not assigned.
|
||||
# shellcheck disable=SC2154
|
||||
if test -n "$ghprbPullId" && ./jenkins/fetch-pr-labels.sh --check=skip-public-jenkins; then
|
||||
echo "Skipping tests because the label 'skip-public-jenkins' was found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TARGET=jenkins
|
||||
PUBLISH=
|
||||
KEYCHAIN=builder
|
||||
KEYCHAIN_PWD_FILE=~/.config/keychain
|
||||
while ! test -z "$1"; do
|
||||
case "$1" in
|
||||
--target=*)
|
||||
TARGET="${1:9}"
|
||||
shift
|
||||
;;
|
||||
--keychain=*)
|
||||
KEYCHAIN="${1:11}"
|
||||
KEYCHAIN_PWD_FILE=~/.config/$KEYCHAIN-keychain
|
||||
shift
|
||||
;;
|
||||
--publish)
|
||||
PUBLISH=1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -n "$PUBLISH"; then
|
||||
PUBLISH_OUTPUT=$(./jenkins/publish-results.sh)
|
||||
URL_PREFIX=$(echo "$PUBLISH_OUTPUT" | grep "^Url Prefix: " | sed 's/^Url Prefix: //')
|
||||
URL="$URL_PREFIX/tests/index.html"
|
||||
TESTS_PERIODIC_COMMAND=$(echo "$PUBLISH_OUTPUT" | grep "^Periodic Command: " | sed 's/^Periodic Command: //')
|
||||
export TESTS_PERIODIC_COMMAND
|
||||
else
|
||||
URL="$BUILD_URL/Test_20Report"
|
||||
fi
|
||||
|
||||
|
||||
export BUILD_REVISION=jenkins
|
||||
|
||||
# Unlock
|
||||
if ! test -f ~/Library/Keychains/"$KEYCHAIN".keychain-db; then
|
||||
echo "The '$KEYCHAIN' keychain is not available."
|
||||
exit 1
|
||||
fi
|
||||
security default-keychain -s "$KEYCHAIN.keychain"
|
||||
security list-keychains -s "$KEYCHAIN.keychain"
|
||||
echo "Unlock keychain"
|
||||
security unlock-keychain -p "$(cat "$KEYCHAIN_PWD_FILE")"
|
||||
echo "Increase keychain unlock timeout to 6 hours"
|
||||
security set-keychain-settings -lut 21600
|
||||
security -v find-identity "$KEYCHAIN.keychain"
|
||||
|
||||
# Prevent dialogs from asking for permissions.
|
||||
# http://stackoverflow.com/a/40039594/183422
|
||||
# Discard output since there can be a *lot* of it.
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$(cat "$KEYCHAIN_PWD_FILE")" "$KEYCHAIN.keychain" >/dev/null 2>&1
|
||||
|
||||
# clean mono keypairs (used in tests)
|
||||
rm -rf ~/.config/.mono/keypairs/
|
||||
|
||||
# Run tests
|
||||
RC=0
|
||||
make -C tests "$TARGET" || RC=$?
|
||||
|
||||
# upload of the final html report
|
||||
if test -n "$PUBLISH"; then
|
||||
./jenkins/publish-results.sh
|
||||
fi
|
||||
|
||||
if [[ x$RC != x0 ]]; then
|
||||
report_error
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
printf "✅ [Test run succeeded](%s)\\n" "$URL" >> "$WORKSPACE/jenkins/pr-comments.md"
|
||||
|
||||
if test -f "$WORKSPACE/jenkins/failure-stamp"; then
|
||||
echo "Something went wrong:"
|
||||
cat "$WORKSPACE/jenkins/pr-comments.md"
|
||||
exit 1
|
||||
fi
|
|
@ -1,12 +0,0 @@
|
|||
def reportGitHubStatus(commitHash, context, backref, statusResult, statusResultMessage) {
|
||||
step([
|
||||
$class: 'GitHubCommitStatusSetter',
|
||||
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/xamarin/xamarin-macios"],
|
||||
commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitHash],
|
||||
contextSource: [$class: 'ManuallyEnteredCommitContextSource', context: context],
|
||||
statusBackrefSource: [$class: 'ManuallyEnteredBackrefSource', backref: backref],
|
||||
statusResultSource: [$class: 'ConditionalStatusResultSource', results: [[$class: 'AnyBuildResult', state: statusResult, message: statusResultMessage]]]
|
||||
])
|
||||
}
|
||||
|
||||
return this
|
|
@ -1,100 +0,0 @@
|
|||
#!/bin/bash -eux
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
|
||||
TOKEN=
|
||||
START=
|
||||
DEVICE_TYPE=
|
||||
while ! test -z "${1:-}"; do
|
||||
case "$1" in
|
||||
--token=*)
|
||||
TOKEN="${1:8}"
|
||||
shift
|
||||
;;
|
||||
--token)
|
||||
TOKEN="$2"
|
||||
shift 2
|
||||
;;
|
||||
--start)
|
||||
START=1
|
||||
shift
|
||||
;;
|
||||
--device=*)
|
||||
DEVICE_TYPE="${1:9}"
|
||||
shift
|
||||
;;
|
||||
--device)
|
||||
DEVICE_TYPE="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$TOKEN"; then
|
||||
echo "The GitHub token is required (--token=<TOKEN>)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$DEVICE_TYPE"; then
|
||||
# set a default value
|
||||
DEVICE_TYPE="iOS/tvOS"
|
||||
fi
|
||||
|
||||
VSTS_BUILD_URL="${SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${SYSTEM_TEAMPROJECT}/_build/index?buildId=${BUILD_BUILDID}&view=ms.vss-test-web.test-result-details"
|
||||
|
||||
# Add a GitHub status to the commit we're testing
|
||||
GH_STATE=failure
|
||||
DESCRIPTION="Running device tests"
|
||||
RESULT_EMOJII=
|
||||
if test -n "$START"; then
|
||||
GH_STATE=pending
|
||||
DESCRIPTION="Running device tests on $DEVICE_TYPE"
|
||||
else
|
||||
case "$(echo "$AGENT_JOBSTATUS" | tr '[:upper:]' '[:lower:]')" in
|
||||
succeeded)
|
||||
GH_STATE=success
|
||||
DESCRIPTION="Device tests passed on $DEVICE_TYPE"
|
||||
RESULT_EMOJII="✅ "
|
||||
;;
|
||||
failed | canceled | succeededwithissues | *)
|
||||
GH_STATE=error
|
||||
DESCRIPTION="Device tests completed ($AGENT_JOBSTATUS) on $DEVICE_TYPE"
|
||||
RESULT_EMOJII="🔥 "
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
./jenkins/add-commit-status.sh --token="$TOKEN" --hash="$BUILD_REVISION" --state="$GH_STATE" --target-url="$VSTS_BUILD_URL" --description="$DESCRIPTION" --context="VSTS: device tests ($DEVICE_TYPE)"
|
||||
|
||||
if test -z "$START"; then
|
||||
# When we're done, add a GitHub comment to the commit we're testing
|
||||
MESSAGE_FILE=commit-message.txt
|
||||
cleanup ()
|
||||
{
|
||||
rm -f "$MESSAGE_FILE"
|
||||
}
|
||||
trap cleanup ERR
|
||||
trap cleanup EXIT
|
||||
|
||||
HTML_REPORT=""
|
||||
if [[ $DEVICE_TYPE == *"DDFun"* ]]; then
|
||||
printf "### :construction: Experimental DDFun pipeline\\n" > "$MESSAGE_FILE"
|
||||
else
|
||||
P=$(cat tmp.p)
|
||||
HTML_REPORT=": [Html Report](http://xamarin-storage/${P}/jenkins-results/tests/index.html)"
|
||||
fi
|
||||
|
||||
printf "%s%s on [Azure DevOps](%s)($DEVICE_TYPE)%s %s\\n\\n" "$RESULT_EMOJII" "$DESCRIPTION" "$VSTS_BUILD_URL" "$HTML_REPORT" "$RESULT_EMOJII" >> "$MESSAGE_FILE"
|
||||
|
||||
FILE=$PWD/tests/TestSummary.md
|
||||
if ! test -f "$FILE"; then
|
||||
printf "🔥 Tests failed catastrophically on $DEVICE_TYPE (no summary found)\\n" >> "$MESSAGE_FILE"
|
||||
else
|
||||
cat "$FILE" >> "$MESSAGE_FILE"
|
||||
fi
|
||||
|
||||
./jenkins/add-commit-comment.sh --token="$TOKEN" --file="$MESSAGE_FILE" "--hash=$BUILD_REVISION"
|
||||
fi
|
|
@ -221,7 +221,7 @@ namespace Xamarin.Tests {
|
|||
public static string EvaluateVariable (string variable)
|
||||
{
|
||||
var output = new StringBuilder ();
|
||||
var rv = ExecutionHelper.Execute ("/usr/bin/make", new string [] { "-C", Path.Combine (SourceRoot, "jenkins"), "print-abspath-variable", $"VARIABLE={variable}" }, environmentVariables: null, stdout: output, stderr: output, timeout: TimeSpan.FromSeconds (5));
|
||||
var rv = ExecutionHelper.Execute ("/usr/bin/make", new string [] { "-C", Path.Combine (SourceRoot, "tools", "devops"), "print-abspath-variable", $"VARIABLE={variable}" }, environmentVariables: null, stdout: output, stderr: output, timeout: TimeSpan.FromSeconds (5));
|
||||
if (rv != 0)
|
||||
throw new Exception ($"Failed to evaluate variable '{variable}'. Exit code: {rv}. Output:\n{output}");
|
||||
var result = output.ToString ().Split (new char [] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Where (v => v.StartsWith (variable + "=", StringComparison.Ordinal)).SingleOrDefault ();
|
||||
|
|
Загрузка…
Ссылка в новой задаче