From f0bb8fc51dd60aa8806c9e66a3db7b45057b0e1a Mon Sep 17 00:00:00 2001 From: scherniavsky Date: Thu, 14 Jun 2018 18:33:03 +0200 Subject: [PATCH 1/2] export shell vars used in multiple steps, formatting --- delivery.yaml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/delivery.yaml b/delivery.yaml index 3168759..ba4cb91 100644 --- a/delivery.yaml +++ b/delivery.yaml @@ -16,22 +16,23 @@ pipeline: curl -fLOsS https://delivery.cloud.zalando.com/utils/ensure-docker && sh ensure-docker && rm ensure-docker - desc: Build docker image cmd: | - GIT_TAG=$(git describe --tags --always --dirty) - IMAGE=registry-write.opensource.zalan.do/tip/docker-locust:$GIT_TAG + export GIT_TAG=$(git describe --tags --always --dirty) + export IMAGE=registry-write.opensource.zalan.do/tip/docker-locust:$GIT_TAG echo "Image: $IMAGE" echo "Build docker image" docker build -t $IMAGE --build-arg DL_IMAGE_VERSION=$GIT_TAG . - desc: Run smoke test cmd: | - echo "Deploy image locally and run simple scenario" - ./local.sh deploy --target=https://google.com --locust-file=./example/simple.py --slaves=2 --mode=auto --users=2 --hatch-rate=1 --duration=5 - # check if json report exists and has non-zero size - [ -s reports/requests.json ] || exit 1 - # check if html report exists and has non-zero size - [ -s reports/reports.html ] || exit 1 - # check if RPS value is greater than 0 - cat reports/reports.html | grep 'RPS:' | cut -c 17- | awk -F'0)}' | grep 1 || exit 1 + echo "Deploy image locally and run simple scenario" + ./local.sh deploy --target=https://google.com --locust-file=./example/simple.py --slaves=2 --mode=auto --users=2 --hatch-rate=1 --duration=5 + # check if json report exists and has non-zero size + [ -s reports/requests.json ] || exit 1 + # check if html report exists and has non-zero size + [ -s reports/reports.html ] || exit 1 + # check if RPS value is greater than 0 + cat reports/reports.html | grep 'RPS:' | cut -c 17- | awk -F'0)}' | grep 1 || exit 1 + # - desc: Push docker image cmd: | - echo "Push docker image" - docker push $IMAGE + echo "Push docker image" + docker push $IMAGE From a893e43f2eb4a341fd90c3cbc2ec8863223d2802 Mon Sep 17 00:00:00 2001 From: scherniavsky Date: Thu, 14 Jun 2018 18:46:13 +0200 Subject: [PATCH 2/2] vars canot be used across build steps - merged them --- delivery.yaml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/delivery.yaml b/delivery.yaml index ba4cb91..d033c36 100644 --- a/delivery.yaml +++ b/delivery.yaml @@ -10,19 +10,15 @@ pipeline: event: push branch: master commands: - - desc: Install Docker - cmd: | - # Docker - curl -fLOsS https://delivery.cloud.zalando.com/utils/ensure-docker && sh ensure-docker && rm ensure-docker - - desc: Build docker image + - desc: Build, test & push the Docker image cmd: | export GIT_TAG=$(git describe --tags --always --dirty) export IMAGE=registry-write.opensource.zalan.do/tip/docker-locust:$GIT_TAG echo "Image: $IMAGE" echo "Build docker image" docker build -t $IMAGE --build-arg DL_IMAGE_VERSION=$GIT_TAG . - - desc: Run smoke test - cmd: | + + # Smoke test echo "Deploy image locally and run simple scenario" ./local.sh deploy --target=https://google.com --locust-file=./example/simple.py --slaves=2 --mode=auto --users=2 --hatch-rate=1 --duration=5 # check if json report exists and has non-zero size @@ -31,8 +27,7 @@ pipeline: [ -s reports/reports.html ] || exit 1 # check if RPS value is greater than 0 cat reports/reports.html | grep 'RPS:' | cut -c 17- | awk -F'0)}' | grep 1 || exit 1 - # - - desc: Push docker image - cmd: | + + # Push docker image echo "Push docker image" docker push $IMAGE