Changes to propagate errors in package build.

This commit is contained in:
Bryan Thornbury 2015-12-02 19:52:19 +00:00
parent f67a247252
commit c2d04d51b1
6 changed files with 49 additions and 14 deletions

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# Copyright (c) .NET Foundation and contributors. All rights reserved. # Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -9,6 +9,8 @@
# $2 = Output Directory # $2 = Output Directory
# $3 = Package Version # $3 = Package Version
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
## Load Functions ## ## Load Functions ##

View file

@ -5,6 +5,14 @@
# Source this to add some fancy stuff to your scripts # Source this to add some fancy stuff to your scripts
COMMONSOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
COMMONDIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
COMMONSOURCE="$(readlink "$COMMONSOURCE")"
[[ $COMMONSOURCE != /* ]] && COMMONSOURCE="$COMMONDIR/$COMMONSOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
COMMONDIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
# Detect build servers # Detect build servers
if [[ ! -z "$JENKINS_URL" || ! -z "$BUILD_BUILDID" ]]; then if [[ ! -z "$JENKINS_URL" || ! -z "$BUILD_BUILDID" ]]; then
# Jenkins or VSO build, disable colors because they make things gross. # Jenkins or VSO build, disable colors because they make things gross.
@ -79,6 +87,7 @@ if [ -z "$RID" ]; then
fi fi
fi fi
export REPOROOT=$(cd $COMMONDIR/.. && pwd)
export OUTPUT_ROOT=$REPOROOT/artifacts/$RID export OUTPUT_ROOT=$REPOROOT/artifacts/$RID
export DNX_DIR=$OUTPUT_ROOT/dnx export DNX_DIR=$OUTPUT_ROOT/dnx
export STAGE1_DIR=$OUTPUT_ROOT/stage1 export STAGE1_DIR=$OUTPUT_ROOT/stage1

View file

@ -4,6 +4,8 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
# #
set -e
SOURCE="${BASH_SOURCE[0]}" SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -6,6 +6,8 @@
# Debian Packaging Script # Debian Packaging Script
# Currently Intended to build on ubuntu14.04 # Currently Intended to build on ubuntu14.04
set -e
SOURCE="${BASH_SOURCE[0]}" SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@ -21,21 +23,25 @@ if [ "$UNAME" != "Linux" ]; then
exit 1 exit 1
fi fi
REPO_ROOT=$(readlink -f $DIR/../..) PACKAGING_ROOT=$REPOROOT/packaging/debian
PACKAGING_ROOT=$REPO_ROOT/packaging/debian
OUTPUT_DIR="$REPO_ROOT/artifacts" OUTPUT_DIR="$REPOROOT/artifacts"
PACKAGE_LAYOUT_DIR="$OUTPUT_DIR/deb_intermediate" PACKAGE_LAYOUT_DIR="$OUTPUT_DIR/deb_intermediate"
PACKAGE_OUTPUT_DIR="$OUTPUT_DIR/packages/debian" PACKAGE_OUTPUT_DIR="$OUTPUT_DIR/packages/debian"
REPO_BINARIES_DIR="$REPO_ROOT/artifacts/ubuntu.14.04-x64/stage2" TEST_STAGE_DIR="$PACKAGE_OUTPUT_DIR/test"
REPO_BINARIES_DIR="$REPOROOT/artifacts/ubuntu.14.04-x64/stage2"
execute(){ execute_build(){
create_empty_debian_layout create_empty_debian_layout
copy_files_to_debian_layout copy_files_to_debian_layout
create_debian_package create_debian_package
test_debian_package test_debian_package
} }
execute_test(){
test_debian_package
}
create_empty_debian_layout(){ create_empty_debian_layout(){
header "Creating empty debian package layout" header "Creating empty debian package layout"
@ -69,15 +75,30 @@ create_debian_package(){
test_debian_package(){ test_debian_package(){
header "Testing debian package" header "Testing debian package"
git clone https://github.com/sstephenson/bats.git /tmp/bats git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR
pushd /tmp/bats
./install.sh /usr/local $TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats
popd
bats $PACKAGE_OUTPUT_DIR/test_package.bats # E2E Testing of package surface area
run_e2e_test
} }
execute run_e2e_test(){
set +e
sudo dpkg -i $DEBIAN_FILE
$REPOROOT/scripts/test/e2e-test.sh
result=$?
sudo dpkg -r dotnet
set -e
return result
}
execute_build
DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb") DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb")
$DIR/../publish/publish.sh $DEBIAN_FILE
execute_test
# Publish
$REPOROOT/scripts/publish/publish.sh $DEBIAN_FILE

View file

@ -4,6 +4,8 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information. # Licensed under the MIT license. See LICENSE file in the project root for full license information.
# #
set -e
SOURCE="${BASH_SOURCE[0]}" SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

View file

@ -13,7 +13,6 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$DIR/../.." && pwd )"
source "$DIR/../_common.sh" source "$DIR/../_common.sh"