From e98ad1bb46cf232cdf397c1b86d073f2fc30b2f8 Mon Sep 17 00:00:00 2001 From: Lauren Yu <6631887+laurenyu@users.noreply.github.com> Date: Fri, 24 Jan 2020 16:26:14 -0800 Subject: [PATCH] infra: properly fail build if has-matching-changes fails --- buildspec.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/buildspec.yml b/buildspec.yml index 97839941..66d43cb7 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -76,9 +76,11 @@ phases: - create-key-pair - launch-ec2-instance --instance-type $instance_type --ami-name dlami-ubuntu + - HAS_MATCHING_CHANGES_OUTPUT=$(has-matching-changes "test/" "tests/" "src/*.py" "setup.py" "setup.cfg" "docker/*" "buildspec.yml") + # run cpu integration tests - | - if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then + if [ "$HAS_MATCHING_CHANGES" = "Changes Found" ] ; then pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY3_VERSION --processor cpu --tag $CPU_PY3_TAG pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY2_VERSION --processor cpu --tag $CPU_PY2_TAG else @@ -87,7 +89,7 @@ phases: # run gpu integration tests - | - if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then + if [ "$HAS_MATCHING_CHANGES" = "Changes Found" ] ; then printf "$SETUP_CMDS" > $SETUP_FILE py3_cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY3_VERSION --processor gpu --tag $GPU_PY3_TAG" py2_cmd="pytest test/integration/local --region $AWS_DEFAULT_REGION --docker-base-name $PREPROD_IMAGE --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY2_VERSION --processor gpu --tag $GPU_PY2_TAG" @@ -99,7 +101,7 @@ phases: # run cpu sagemaker tests - | - if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then + if [ "$HAS_MATCHING_CHANGES" = "Changes Found" ] ; then pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY3_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $CPU_PY3_TAG pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY2_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $CPU_PY2_TAG else @@ -108,7 +110,7 @@ phases: # run gpu sagemaker tests - | - if has-matching-changes "test/" "tests/" "src/*.py" "docker/*" "buildspec.yml"; then + if [ "$HAS_MATCHING_CHANGES" = "Changes Found" ] ; then pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $GPU_PY3_VERSION --processor gpu --instance-type $GPU_INSTANCE_TYPE --tag $GPU_PY3_TAG pytest test/integration/sagemaker --region $AWS_DEFAULT_REGION --docker-base-name $ECR_REPO --aws-id $ACCOUNT --framework-version $FRAMEWORK_VERSION --py-version $CPU_PY2_VERSION --processor cpu --instance-type $CPU_INSTANCE_TYPE --tag $GPU_PY2_TAG else