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

Add a task to build iotedged with feature=runtime-kubernetes during checkin. #1606

Merged
merged 7 commits into from
Aug 29, 2019
2 changes: 2 additions & 0 deletions builds/checkin/edgelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
68 changes: 68 additions & 0 deletions edgelet/build/linux/build-k8s.sh
Original file line number Diff line number Diff line change
@@ -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
arsing marked this conversation as resolved.
Show resolved Hide resolved
else
cd "$PROJECT_ROOT" && $CARGO "+$TOOLCHAIN" build --manifest-path=${IOTEDGED_MANIFEST} --no-default-features --features runtime-kubernetes --release
fi
15 changes: 13 additions & 2 deletions edgelet/build/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

set -e

###############################################################################
# These are the packages this script will build.
###############################################################################
packages=(iotedge iotedged iotedge-diagnostics iotedge-proxy)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need iotedge-proxy for non-Kubernetes?

Copy link
Contributor Author

@darobs darobs Aug 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iotedge-proxy is not build with the feature "runtime-kubernetes" - it's built with the default features.

I've gone back and forth on this. It was easier to add to the list of packages, and where it is placed does not impact build time, but it is not required for non-k8s work. If other people have strong opinions on placement, I'll gladly move it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it was meant for non-Kubernetes I would've liked to be on the code review for when it was merged. Just from a quick glance I see it's not doing error-handling correctly.

Anyway, what features it's built with isn't the way we should differentiate. Was it planned to ship in iotedge.deb ? Then it's part of the regular build. If it wasn't, then it's not.

I'm fine with leaving it where it is, but in the future if you're planning on doing non-Kubernetes work, please involve the non-Kubernetes team in the code reviews.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a bug to our backlog to get our error handling in sync with the rest of the project.


###############################################################################
# Define Environment Variables
###############################################################################
Expand Down Expand Up @@ -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