From 6fef942e027c7197ed0458574b8140f514ce17d3 Mon Sep 17 00:00:00 2001 From: karampok Date: Mon, 23 Dec 2019 11:06:39 +0100 Subject: [PATCH] ci: add go integration tests with supervisord --- .buildkite/hooks/pre-artifact | 33 ++++++++++++++----------------- .buildkite/hooks/pre-exit | 2 +- .buildkite/pipeline_buildlint.yml | 19 ++++++++++++++++++ .gitignore | 4 ++++ 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.buildkite/hooks/pre-artifact b/.buildkite/hooks/pre-artifact index 20a523a4ea..8df0c3e0b0 100755 --- a/.buildkite/hooks/pre-artifact +++ b/.buildkite/hooks/pre-artifact @@ -2,11 +2,13 @@ set -eo pipefail -# Currently this is only needed for the new pipeline, so if we aren't on the new -# pipeline just exit. -if [ ! "$BUILDKITE_PIPELINE_SLUG" == "scionproto2" ]; then - exit 0 -fi +case ${BUILDKITE_PIPELINE_SLUG:-local} in + scionproto2 | local ) + ;; + *) + exit 0 # If we aren't on the new pipeline, then just exit. + ;; +esac # Now we build the artifact name next, for this we first need TARGET and BUILD, # see below. @@ -24,22 +26,16 @@ BUILD="build-${BUILDKITE_BUILD_NUMBER}" [ -n "$NIGHTLY" ] && BUILD=nightly-"$(date +%s)" echo "\$BUILD=$BUILD" -ARTIFACTS="buildkite.${BUILDKITE_ORGANIZATION_SLUG}.${TARGET}.${BUILD}.${BUILDKITE_STEP_KEY}.${BUILDKITE_JOB_ID}" -echo "\$ARTIFACTS=$ARTIFACTS" - -ARTIFACTS_DIR="artifacts" -echo "\$ARTIFACTS_DIR=$ARTIFACTS_DIR" +ARTIFACTS="buildkite.${BUILDKITE_ORGANIZATION_SLUG}.${TARGET}.${BUILD}.${BUILDKITE_STEP_KEY:-unset}.${BUILDKITE_JOB_ID}" +mkdir -p "artifacts/$ARTIFACTS" artifacts.out function save { - if [ -d "$1" ]; then - echo Found artifacts: "$1" - find "$1" - cp -R "$1" "$ARTIFACTS_DIR/$ARTIFACTS" - fi + if [ -d "$1" ]; then + echo Found artifacts: "$1" + cp -R "$1" "artifacts/$ARTIFACTS" + fi } -mkdir -p "$ARTIFACTS_DIR/$ARTIFACTS" artifacts.out - save "bazel-testlogs" save "logs" save "traces" @@ -47,4 +43,5 @@ save "gen" save "gen-cache" save "$TEST_ARTIFACTS" -tar chaf "artifacts.out/$ARTIFACTS.tar.gz" -C "$ARTIFACTS_DIR" "$ARTIFACTS" +tar chaf "artifacts.out/$ARTIFACTS.tar.gz" -C artifacts "$ARTIFACTS" +echo "Output tar= artifacts.out/$ARTIFACTS.tar.gz" diff --git a/.buildkite/hooks/pre-exit b/.buildkite/hooks/pre-exit index 2a92798fc0..4e2e88711a 100644 --- a/.buildkite/hooks/pre-exit +++ b/.buildkite/hooks/pre-exit @@ -10,4 +10,4 @@ docker network prune -f echo "Remove leftover volumes" docker volume prune -f -rm -rf bazel-testlogs logs/* traces gen gen-cache "$TEST_ARTIFACTS" +rm -rf bazel-testlogs logs/* traces gen gen-cache "$TEST_ARTIFACTS" artifacts diff --git a/.buildkite/pipeline_buildlint.yml b/.buildkite/pipeline_buildlint.yml index 48a9f2cc87..e4a8f3cbd8 100644 --- a/.buildkite/pipeline_buildlint.yml +++ b/.buildkite/pipeline_buildlint.yml @@ -65,3 +65,22 @@ steps: automatic: - exit_status: -1 # Agent was lost - exit_status: 255 # Forced agent shutdown + - label: "Integration: {cert_req,pp,end2end,scmp}_integration" + command: + - bazel --bazelrc=.bazelrc_ci build //:scion //:scion-ci >/dev/null 2>&1 + - tar -kxf bazel-bin/scion.tar -C bin --overwrite + - tar -kxf bazel-bin/scion-ci.tar -C bin --overwrite + - ./scion.sh topology nobuild + - ./scion.sh run nobuild && sleep 10 + - ./bin/cert_req_integration -log.console warn + - ./bin/pp_integration -log.console warn + - ./bin/scmp_integration -log.console warn + - ./bin/end2end_integration -log.console warn + artifact_paths: + - "artifacts.out/**/*" + timeout_in_minutes: 5 + key: integration_tests + retry: + automatic: + - exit_status: -1 # Agent was lost + - exit_status: 255 # Forced agent shutdown diff --git a/.gitignore b/.gitignore index 4e03346273..a9209b1d29 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ Thumbs.db /gen/ /gen-cache/ /gen-certs/ +/gen-test/ /traces/ # Python generated files # @@ -73,3 +74,6 @@ tags # bazel artifacts /bazel-* /.bazel-cache + +# buildkite +artifacts.out