From 54703c0848a7f50925fe9b1aaf9b289b4dc0929b Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Tue, 26 Sep 2017 12:45:50 -0700 Subject: [PATCH 1/4] ci: fix coverage and alpine image Signed-off-by: Matt Klein --- ci/Dockerfile-envoy-alpine | 3 ++ ci/Dockerfile-envoy-alpine-debug | 3 ++ ci/Dockerfile-envoy-image | 4 -- .../Dockerfile-envoy-alpine | 5 -- .../Dockerfile-envoy-alpine-debug | 5 -- ci/build_alpine_container/Makefile | 38 --------------- .../run_alpine_binary_verification.sh | 48 ------------------- ci/coverage_publish.sh | 2 +- ci/do_ci.sh | 3 ++ ci/docker_push.sh | 18 +++---- 10 files changed, 19 insertions(+), 110 deletions(-) create mode 100644 ci/Dockerfile-envoy-alpine create mode 100644 ci/Dockerfile-envoy-alpine-debug delete mode 100644 ci/build_alpine_container/Dockerfile-envoy-alpine delete mode 100644 ci/build_alpine_container/Dockerfile-envoy-alpine-debug delete mode 100644 ci/build_alpine_container/Makefile delete mode 100755 ci/build_alpine_container/run_alpine_binary_verification.sh diff --git a/ci/Dockerfile-envoy-alpine b/ci/Dockerfile-envoy-alpine new file mode 100644 index 0000000000000..82d8287264a39 --- /dev/null +++ b/ci/Dockerfile-envoy-alpine @@ -0,0 +1,3 @@ +FROM frolvlad/alpine-glibc + +ADD build_release_stripped/envoy /usr/local/bin/envoy diff --git a/ci/Dockerfile-envoy-alpine-debug b/ci/Dockerfile-envoy-alpine-debug new file mode 100644 index 0000000000000..7cef9e93f99cb --- /dev/null +++ b/ci/Dockerfile-envoy-alpine-debug @@ -0,0 +1,3 @@ +FROM frolvlad/alpine-glibc + +ADD build_release/envoy /usr/local/bin/envoy diff --git a/ci/Dockerfile-envoy-image b/ci/Dockerfile-envoy-image index bd84854292677..98da70b258da3 100644 --- a/ci/Dockerfile-envoy-image +++ b/ci/Dockerfile-envoy-image @@ -1,7 +1,3 @@ FROM ubuntu:14.04 ADD build_release/envoy /usr/local/bin/envoy -RUN apt-get update && apt-get install -y \ - build-essential -RUN strip /usr/local/bin/envoy -RUN apt-get purge -y build-essential diff --git a/ci/build_alpine_container/Dockerfile-envoy-alpine b/ci/build_alpine_container/Dockerfile-envoy-alpine deleted file mode 100644 index d9ca3c2cb8710..0000000000000 --- a/ci/build_alpine_container/Dockerfile-envoy-alpine +++ /dev/null @@ -1,5 +0,0 @@ -FROM frolvlad/alpine-glibc - -RUN mkdir -p /usr/local/conf/envoy -COPY ./bin/stripped/envoy /usr/local/bin/envoy -COPY ./bin/configs/google_com_proxy.json /usr/local/conf/envoy/ diff --git a/ci/build_alpine_container/Dockerfile-envoy-alpine-debug b/ci/build_alpine_container/Dockerfile-envoy-alpine-debug deleted file mode 100644 index ea7b348813568..0000000000000 --- a/ci/build_alpine_container/Dockerfile-envoy-alpine-debug +++ /dev/null @@ -1,5 +0,0 @@ -FROM frolvlad/alpine-glibc - -RUN mkdir -p /usr/local/conf/envoy -COPY ./bin/debug/envoy /usr/local/bin/envoy -COPY ./bin/configs/google_com_proxy.json /usr/local/conf/envoy/ diff --git a/ci/build_alpine_container/Makefile b/ci/build_alpine_container/Makefile deleted file mode 100644 index 400a4f664a6f8..0000000000000 --- a/ci/build_alpine_container/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -PHONY: all - -ENVOY_TAG ?= "latest" -ENVOY_BUILD_DIR ?= "/tmp/envoy-docker-build" -ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) - -all: binary container test - -binary: - echo "CWD: ${ROOT_DIR}" - rm -rf ./bin - mkdir -p ./bin/stripped - mkdir -p ./bin/debug - mkdir -p ./bin/configs - docker run -t -i --name build-envoy-alpine-ct -v ${ROOT_DIR}/../../:/source -v $(ENVOY_BUILD_DIR):/build lyft/envoy-build:latest /bin/bash -c \ - "set -x && cd /source && \ - cp /build/envoy/source/exe/envoy /source/ci/build_alpine_container/bin/stripped/ && \ - strip /source/ci/build_alpine_container/bin/stripped/envoy && \ - cp /build/envoy/source/exe/envoy /source/ci/build_alpine_container/bin/debug/ && \ - cp /source/configs/google_com_proxy.json /source/ci/build_alpine_container/bin/configs/" - docker rm -f build-envoy-alpine-ct - # Fail build if a core file gets generated during the build. - if [ -f "../../core" ]; \ - then \ - echo "Core dumped, failing build"; \ - exit 1; \ - fi - -container: - docker build -f ./Dockerfile-envoy-alpine -t lyft/envoy-alpine:${ENVOY_TAG} . - docker build -f ./Dockerfile-envoy-alpine-debug -t lyft/envoy-alpine-debug:${ENVOY_TAG} . - -test: - ./run_alpine_binary_verification.sh debug - ./run_alpine_binary_verification.sh stripped - -clean: - rm -rf ./bin diff --git a/ci/build_alpine_container/run_alpine_binary_verification.sh b/ci/build_alpine_container/run_alpine_binary_verification.sh deleted file mode 100755 index a7a7866ef2071..0000000000000 --- a/ci/build_alpine_container/run_alpine_binary_verification.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -set -e - -usage() { - echo "Usage: $0 [debug|stripped]" - exit 1 -} - -check_args() { - if [ $# -lt 1 ]; then - usage - fi - - type=$1 - - if [ "$type" != "debug" ] && [ "$type" != "stripped" ]; then - usage - fi -} - -main() { - check_args $* - if [ -z "${ENVOY_TAG}" ]; then - ENVOY_TAG="latest" - fi - - if [ "${type}" == "debug" ]; then - ENVOY_IMAGE=lyft/envoy-alpine-debug:${ENVOY_TAG} - else - ENVOY_IMAGE=lyft/envoy-alpine:${ENVOY_TAG} - fi - TEST_CONTAINER=alpine_envoy_test_ct - - # Spin up a test container for the smoke test. - set +e - docker rm -fv ${TEST_CONTAINER} - set -e - docker run -d --name ${TEST_CONTAINER} ${ENVOY_IMAGE} /usr/local/bin/envoy -c /usr/local/conf/envoy/google_com_proxy.json - output=`docker exec alpine_envoy_test_ct ps aux | grep google_com_proxy` - if [ -z "$output" ]; then - echo "Failed to detect envoy binary to be running!" - exit 1 - fi - echo "Successfully started envoy in container ${TEST_CONTAINER}" - #TODO - add more tests, like a health check. -} - -main $* diff --git a/ci/coverage_publish.sh b/ci/coverage_publish.sh index c1f607476d358..4ba8d43e87f4d 100755 --- a/ci/coverage_publish.sh +++ b/ci/coverage_publish.sh @@ -25,9 +25,9 @@ then COVERAGE_DIR="$(dirname "${COVERAGE_FILE}")" S3_LOCATION="lyft-envoy/coverage/report-${BRANCH_NAME}" + pip install awscli --upgrade aws s3 cp "${COVERAGE_DIR}" "s3://${S3_LOCATION}" --recursive --profile coverage --acl public-read --quiet --sse echo "Coverage report for branch '${BRANCH_NAME}': https://s3.amazonaws.com/${S3_LOCATION}/coverage.html" - else echo "Coverage report will not be uploaded for this build." fi diff --git a/ci/do_ci.sh b/ci/do_ci.sh index a97ca045c6f48..140db233dae2f 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -21,6 +21,9 @@ function bazel_release_binary_build() { echo "Copying release binary for image build..." mkdir -p "${ENVOY_SRCDIR}"/build_release cp -f "${ENVOY_DELIVERY_DIR}"/envoy "${ENVOY_SRCDIR}"/build_release + mkdir -p "${ENVOY_SRCDIR}"/build_release_stripped + cp -f "${ENVOY_DELIVERY_DIR}"/envoy "${ENVOY_SRCDIR}"/build_release_stripped + strip "${ENVOY_SRCDIR}"/build_release_stripped/envoy } function bazel_debug_binary_build() { diff --git a/ci/docker_push.sh b/ci/docker_push.sh index 1f0d0443b18cf..7ed9341401215 100755 --- a/ci/docker_push.sh +++ b/ci/docker_push.sh @@ -28,17 +28,17 @@ then docker build -f ci/Dockerfile-envoy-image -t lyft/envoy:latest . docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD" docker push lyft/envoy:latest - docker tag lyft/envoy:latest lyft/envoy:$CIRCLE_SHA1 - docker push lyft/envoy:$CIRCLE_SHA1 - docker rm $(docker ps -a -q) || true - docker rmi $(docker images -a -q) || true + docker tag lyft/envoy:latest lyft/envoy:"$CIRCLE_SHA1" + docker push lyft/envoy:"$CIRCLE_SHA1" - make -C ci/build_alpine_container - docker tag lyft/envoy-alpine:latest lyft/envoy-alpine:$CIRCLE_SHA1 - docker push lyft/envoy-alpine:$CIRCLE_SHA1 + docker build -f ./Dockerfile-envoy-alpine -t lyft/envoy-alpine:latest . + docker tag lyft/envoy-alpine:latest lyft/envoy-alpine:"$CIRCLE_SHA1" + docker push lyft/envoy-alpine:"$CIRCLE_SHA1" docker push lyft/envoy-alpine:latest - docker tag lyft/envoy-alpine-debug:latest lyft/envoy-alpine-debug:$CIRCLE_SHA1 - docker push lyft/envoy-alpine-debug:$CIRCLE_SHA1 + + docker build -f ./Dockerfile-envoy-alpine-debug -t lyft/envoy-alpine-debug:latest . + docker tag lyft/envoy-alpine-debug:latest lyft/envoy-alpine-debug:"$CIRCLE_SHA1" + docker push lyft/envoy-alpine-debug:"$CIRCLE_SHA1" docker push lyft/envoy-alpine-debug:latest # This script tests the docker examples. From 3beacf4f5d9ba9940d857fffbc16f1f6eb7b3fa0 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Tue, 26 Sep 2017 12:46:51 -0700 Subject: [PATCH 2/4] fix Signed-off-by: Matt Klein --- ci/Dockerfile-envoy-image | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Dockerfile-envoy-image b/ci/Dockerfile-envoy-image index 98da70b258da3..db5618ec4b7cf 100644 --- a/ci/Dockerfile-envoy-image +++ b/ci/Dockerfile-envoy-image @@ -1,3 +1,3 @@ FROM ubuntu:14.04 -ADD build_release/envoy /usr/local/bin/envoy +ADD build_release_stripped/envoy /usr/local/bin/envoy From 4be35e6c16f971fdf50b1d18f5a050e0b42a1a99 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Tue, 26 Sep 2017 12:47:53 -0700 Subject: [PATCH 3/4] fix Signed-off-by: Matt Klein --- ci/docker_push.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/docker_push.sh b/ci/docker_push.sh index 7ed9341401215..3d0a5e42d6918 100755 --- a/ci/docker_push.sh +++ b/ci/docker_push.sh @@ -31,12 +31,12 @@ then docker tag lyft/envoy:latest lyft/envoy:"$CIRCLE_SHA1" docker push lyft/envoy:"$CIRCLE_SHA1" - docker build -f ./Dockerfile-envoy-alpine -t lyft/envoy-alpine:latest . + docker build -f ci/Dockerfile-envoy-alpine -t lyft/envoy-alpine:latest . docker tag lyft/envoy-alpine:latest lyft/envoy-alpine:"$CIRCLE_SHA1" docker push lyft/envoy-alpine:"$CIRCLE_SHA1" docker push lyft/envoy-alpine:latest - docker build -f ./Dockerfile-envoy-alpine-debug -t lyft/envoy-alpine-debug:latest . + docker build -f ci/Dockerfile-envoy-alpine-debug -t lyft/envoy-alpine-debug:latest . docker tag lyft/envoy-alpine-debug:latest lyft/envoy-alpine-debug:"$CIRCLE_SHA1" docker push lyft/envoy-alpine-debug:"$CIRCLE_SHA1" docker push lyft/envoy-alpine-debug:latest From 5969c8ac38405d48d0194d1d17ba1bd6769a2f51 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Tue, 26 Sep 2017 13:14:05 -0700 Subject: [PATCH 4/4] fix Signed-off-by: Matt Klein --- ci/coverage_publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/coverage_publish.sh b/ci/coverage_publish.sh index 4ba8d43e87f4d..f273d6cd9eec0 100755 --- a/ci/coverage_publish.sh +++ b/ci/coverage_publish.sh @@ -26,7 +26,7 @@ then S3_LOCATION="lyft-envoy/coverage/report-${BRANCH_NAME}" pip install awscli --upgrade - aws s3 cp "${COVERAGE_DIR}" "s3://${S3_LOCATION}" --recursive --profile coverage --acl public-read --quiet --sse + aws s3 cp "${COVERAGE_DIR}" "s3://${S3_LOCATION}" --recursive --acl public-read --quiet --sse echo "Coverage report for branch '${BRANCH_NAME}': https://s3.amazonaws.com/${S3_LOCATION}/coverage.html" else echo "Coverage report will not be uploaded for this build."