From 79c9068d006fb150f76e1611ab098f2219d5da31 Mon Sep 17 00:00:00 2001 From: David Robson Date: Wed, 21 Aug 2019 15:18:01 -0700 Subject: [PATCH 1/2] Add a task to build iotedged with feature=runtime-kuberenetes during checkin. --- builds/checkin/edgelet.yaml | 2 + edgelet/build/linux/build-k8s.sh | 68 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100755 edgelet/build/linux/build-k8s.sh diff --git a/builds/checkin/edgelet.yaml b/builds/checkin/edgelet.yaml index 469e74b1f96..627b7431639 100644 --- a/builds/checkin/edgelet.yaml +++ b/builds/checkin/edgelet.yaml @@ -25,6 +25,8 @@ jobs: displayName: Check submodules - bash: edgelet/build/linux/build.sh displayName: Build + - bash: edgelet/build/linux/build-k8s.sh + displayName: Build (runtime-kubernetes) - bash: edgelet/build/linux/test.sh displayName: Test diff --git a/edgelet/build/linux/build-k8s.sh b/edgelet/build/linux/build-k8s.sh new file mode 100755 index 00000000000..75d057e44ef --- /dev/null +++ b/edgelet/build/linux/build-k8s.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +############################################################################### +# This script builds the project +############################################################################### + +set -e + +############################################################################### +# Define Environment Variables +############################################################################### +# Get directory of running script +DIR=$(cd "$(dirname "$0")" && pwd) + +BUILD_REPOSITORY_LOCALPATH=${BUILD_REPOSITORY_LOCALPATH:-$DIR/../../..} +PROJECT_ROOT=${BUILD_REPOSITORY_LOCALPATH}/edgelet +IOTEDGED_MANIFEST=${PROJECT_ROOT}/iotedged/Cargo.toml +SCRIPT_NAME=$(basename "$0") +CARGO="${CARGO_HOME:-"$HOME/.cargo"}/bin/cargo" +TOOLCHAIN="stable-x86_64-unknown-linux-gnu" +RELEASE= + +############################################################################### +# Print usage information pertaining to this script and exit +############################################################################### +usage() +{ + echo "$SCRIPT_NAME [options]" + echo "" + echo "options" + echo " -h, --help Print this help and exit." + echo " -t, --toolchain Toolchain (default: stable-x86_64-unknown-linux-gnu)" + echo " -r, --release Release build? (flag, default: false)" + exit 1; +} + +############################################################################### +# Obtain and validate the options supported by this script +############################################################################### +process_args() +{ + save_next_arg=0 + for arg in "$@" + do + if [ $save_next_arg -eq 1 ]; then + TOOLCHAIN="$arg" + save_next_arg=0 + elif [ $save_next_arg -eq 2 ]; then + RELEASE="true" + save_next_arg=0 + else + case "$arg" in + "-h" | "--help" ) usage;; + "-t" | "--toolchain" ) save_next_arg=1;; + "-r" | "--release" ) save_next_arg=2;; + * ) usage;; + esac + fi + done +} + +process_args "$@" + +if [[ -z ${RELEASE} ]]; then + cd "$PROJECT_ROOT" && $CARGO "+$TOOLCHAIN" build --manifest-path=${IOTEDGED_MANIFEST} --no-default-features --features runtime-kubernetes +else + cd "$PROJECT_ROOT" && $CARGO "+$TOOLCHAIN" build --manifest-path=${IOTEDGED_MANIFEST} --no-default-features --features runtime-kubernetes --release +fi From 5b6515bc890e9a84fdc56ab444e15d1d04d0cf80 Mon Sep 17 00:00:00 2001 From: David Robson Date: Thu, 22 Aug 2019 14:47:43 -0700 Subject: [PATCH 2/2] Build packages instead of "all" which limits what gets compiled, listed are all the projects which do not require features set. --- edgelet/build/linux/build.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/edgelet/build/linux/build.sh b/edgelet/build/linux/build.sh index 48ec3bbaf8c..fb346f0b85c 100755 --- a/edgelet/build/linux/build.sh +++ b/edgelet/build/linux/build.sh @@ -6,6 +6,11 @@ set -e +############################################################################### +# These are the packages this script will build. +############################################################################### +packages=(iotedge iotedged iotedge-diagnostics iotedge-proxy) + ############################################################################### # Define Environment Variables ############################################################################### @@ -78,8 +83,14 @@ codegen-units = 1 incremental = false EOF +PACKAGES= +for p in "${packages[@]}" +do + PACKAGES="${PACKAGES} -p ${p}" +done + if [[ -z ${RELEASE} ]]; then - cd "$PROJECT_ROOT" && $CARGO "+$TOOLCHAIN" build --all + cd "$PROJECT_ROOT" && $CARGO "+$TOOLCHAIN" build ${PACKAGES} else - cd "$PROJECT_ROOT" && $CARGO "+$TOOLCHAIN" build --all --release + cd "$PROJECT_ROOT" && $CARGO "+$TOOLCHAIN" build ${PACKAGES} --release fi