Skip to content

Commit

Permalink
Avoid rebuilding operator and checking ES twice
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <rsevilla@redhat.com>
  • Loading branch information
rsevilla87 committed Jul 16, 2020
1 parent 07f7c7d commit e05ef5e
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 193 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/.pydevproject
*.pyc
.tox/
ripsaw
results.markdown
49 changes: 12 additions & 37 deletions ci/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ es_server="marquez.perf.lab.eng.rdu2.redhat.com"
es_port=9200
default_operator_image="quay.io/benchmark-operator/benchmark-operator:master"

default_ripsaw_image_spec="quay.io/cloud-bulldozer"
image_location=${RIPSAW_CI_IMAGE_LOCATION:-quay.io}
image_account=${RIPSAW_CI_IMAGE_ACCOUNT:-rht_perf_ci}
export SNAFU_IMAGE_TAG=${SNAFU_IMAGE_TAG:-snafu_ci}
Expand All @@ -19,6 +20,15 @@ NOTOK=1
# which will be the first thing the wrapper ci_test.sh does to it

function update_operator_image() {
sed -i "s#${default_ripsaw_image_spec}/fio:latest#${SNAFU_WRAPPER_IMAGE_PREFIX}/fio:${SNAFU_IMAGE_TAG}#g" roles/fio_distributed/templates/*
sed -i "s#${default_ripsaw_image_spec}/fs-drift:master#${SNAFU_WRAPPER_IMAGE_PREFIX}/fs-drift:${SNAFU_IMAGE_TAG}#g" roles/fs-drift/templates/* roles/fs-drift/tasks/*
sed -i "s#${default_ripsaw_image_spec}/hammerdb:master#${SNAFU_WRAPPER_IMAGE_PREFIX}/hammerdb:${SNAFU_IMAGE_TAG}#g" roles/hammerdb/templates/*
sed -i "s#${default_ripsaw_image_spec}/iperf3:latest#${SNAFU_WRAPPER_IMAGE_PREFIX}/iperf3:${SNAFU_IMAGE_TAG}#g" roles/iperf3/templates/*
sed -i "s#${default_ripsaw_image_spec}/pgbench:latest#${SNAFU_WRAPPER_IMAGE_PREFIX}/pgbench:${SNAFU_IMAGE_TAG}#g" roles/pgbench/defaults/main.yml
sed -i "s#${default_ripsaw_image_spec}/smallfile:master#${SNAFU_WRAPPER_IMAGE_PREFIX}/smallfile:${SNAFU_IMAGE_TAG}#g" roles/smallfile/templates/* roles/smallfile/tasks/*
sed -i "s#${default_ripsaw_image_spec}/sysbench:latest#${SNAFU_WRAPPER_IMAGE_PREFIX}/sysbench:${SNAFU_IMAGE_TAG}#g" roles/sysbench/templates/*
sed -i "s#${default_ripsaw_image_spec}/uperf:latest#${SNAFU_WRAPPER_IMAGE_PREFIX}/uperf:${SNAFU_IMAGE_TAG}#g" roles/uperf/templates/*
sed -i "s#${default_ripsaw_image_spec}/ycsb-server:latest#${SNAFU_WRAPPER_IMAGE_PREFIX}/ycsb-server:${SNAFU_IMAGE_TAG}#g" roles/ycsb/templates/*
image_spec=$image_location/$image_account/benchmark-operator:$SNAFU_IMAGE_TAG
$SUDO operator-sdk build $image_spec --image-builder $image_builder

Expand All @@ -30,24 +40,11 @@ function update_operator_image() {
exit $NOTOK
fi
done
sed -i \
"s| image: $default_operator_image| image: $image_spec # |" \
resources/operator.yaml
sed -i "s|image: $default_operator_image|image: $image_spec|g" resources/operator.yaml
}

function wait_clean {
kubectl delete benchmark --all -n my-ripsaw
kubectl delete all --all -n my-ripsaw
for i in {1..30}; do
if [ `kubectl get pods --namespace my-ripsaw | wc -l` -ge 1 ]; then
sleep 5
else
break
fi
done
if [[ `kubectl get namespace my-ripsaw` ]]; then
kubectl delete namespace my-ripsaw --wait=true
fi
kubectl delete namespace my-ripsaw --wait=true --ignore-not-found
}

# Takes 2 arguments. $1 is the uuid and $2 is a space-separated list of indexes to check
Expand All @@ -65,28 +62,6 @@ function check_es() {
done
}

# Takes test script as parameter and returns the uuid
function get_uuid() {
my_test=$1

sed -i '/trap finish EXIT/d' tests/$my_test

rm -f uuid
(
source tests/$my_test || :

# Get UUID
uuid=`kubectl -n my-ripsaw get benchmarks -o jsonpath='{.items[0].status.uuid}'`

# while we're here, let's verify that right image location and account got used

kubectl -n my-ripsaw describe pods | grep -i pulled

finish
echo $uuid > uuid
)
}

# Takes 2 argumentes. $1 is the Dockerfile path and $2 is the image name
function build_and_push() {
if ! $SUDO podman build --no-cache --tag=${2} -f ${1} . ; then
Expand Down
3 changes: 3 additions & 0 deletions ci/run_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ source ci/common.sh
# Clone ripsaw so we can use it for testing
rm -rf ripsaw
git clone https://github.com/cloud-bulldozer/ripsaw.git --depth 1
pushd ripsaw
update_operator_image
popd

if [[ $ghprbPullLongDescription = *"Depends-On:"* ]]; then
ripsaw_change_id="$(echo -e $ghprbPullLongDescription | sed -n -e 's/^.*Depends-On: //p' | dos2unix)"
Expand Down
21 changes: 2 additions & 19 deletions fio_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image_spec="quay.io/cloud-bulldozer/fio:latest"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/fio:$SNAFU_IMAGE_TAG
build_and_push fio_wrapper/Dockerfile $image_spec

cd ripsaw

sed -i "s#$default_ripsaw_image_spec#$image_spec#g" roles/fio_distributed/templates/*

update_operator_image

get_uuid test_fiod.sh
uuid=`cat uuid`

cd ..

# Define index
index="ripsaw-fio-results ripsaw-fio-log ripsaw-fio-analyzed-result"

check_es "${uuid}" "${index}"
exit $?

pushd ripsaw
source tests/test_fiod.sh
19 changes: 2 additions & 17 deletions fs_drift_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image_spec="quay.io/cloud-bulldozer/fs-drift:master"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/fs-drift:$SNAFU_IMAGE_TAG
build_and_push fs_drift_wrapper/Dockerfile $image_spec

cd ripsaw

sed -i "s#$default_ripsaw_image_spec#$image_spec#g" roles/fs-drift/templates/* roles/fs-drift/tasks/*

# Build new ripsaw image
update_operator_image

get_uuid test_fs_drift.sh
uuid=`cat uuid`

cd ..

indexes="ripsaw-fs-drift-results ripsaw-fs-drift-rsptimes ripsaw-fs-drift-rates-over-time"
check_es "${uuid}" "${indexes}"
exit $?
pushd ripsaw
source tests/test_fs_drift.sh
20 changes: 2 additions & 18 deletions hammerdb/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image_spec="quay.io/cloud-bulldozer/hammerdb:master"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/hammerdb:$SNAFU_IMAGE_TAG
build_and_push hammerdb/Dockerfile $image_spec

cd ripsaw

sed -i "s#$default_ripsaw_image_spec#$image_spec#g" roles/hammerdb/templates/*

# Build new ripsaw image
update_operator_image

get_uuid test_hammerdb.sh
uuid=`cat uuid`

cd ..

index="ripsaw-hammerdb-results"

check_es "${uuid}" "${index}"
exit $?
pushd ripsaw
source tests/test_hammerdb.sh
15 changes: 2 additions & 13 deletions iperf/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image_spec="quay.io/cloud-bulldozer/iperf3:latest"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/iperf3:$SNAFU_IMAGE_TAG
build_and_push iperf/Dockerfile $image_spec

cd ripsaw

sed -i "s#$default_ripsaw_image_spec#$image_spec#g" roles/iperf3/templates/*

# Build new ripsaw image
update_operator_image

# iperf does not utilize a wrapper from snafu, only the Dockerfile
# We will confirm that the test_iperf passes only
bash tests/test_iperf3.sh

pushd ripsaw
source tests/test_iperf3.sh
26 changes: 4 additions & 22 deletions pgbench_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image="quay.io/cloud-bulldozer/pgbench"
default_ripsaw_tag="latest"
image=$SNAFU_WRAPPER_IMAGE_PREFIX/pgbench
build_and_push pgbench_wrapper/Dockerfile $image:snafu_ci

cd ripsaw

sed -i "s#$default_ripsaw_image#$image#" roles/pgbench/defaults/main.yml
sed -i "s#$default_ripsaw_tag#$SNAFU_IMAGE_TAG#" roles/pgbench/defaults/main.yml

# Build new ripsaw image
update_operator_image

get_uuid test_pgbench.sh
uuid=`cat uuid`

cd ..

index="ripsaw-pgbench-summary ripsaw-pgbench-raw"

check_es "${uuid}" "${index}"
exit $?
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/pgbench:$SNAFU_IMAGE_TAG
build_and_push pgbench_wrapper/Dockerfile $image_spec
pushd ripsaw
source tests/test_pgbench.sh
21 changes: 2 additions & 19 deletions smallfile_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image_spec="quay.io/cloud-bulldozer/smallfile:master"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/smallfile:$SNAFU_IMAGE_TAG
build_and_push smallfile_wrapper/Dockerfile $image_spec

cd ripsaw

sed -i "s#$default_ripsaw_image_spec#$image_spec#g" roles/smallfile/templates/* roles/smallfile/tasks/*

# Build new ripsaw image
update_operator_image

get_uuid test_smallfile.sh
uuid=`cat uuid`

cd ..

index="ripsaw-smallfile-results ripsaw-smallfile-rsptimes"

check_es "${uuid}" "${index}"
exit $?

pushd ripsaw
source tests/test_smallfile.sh
14 changes: 2 additions & 12 deletions sysbench/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image_spec="quay.io/cloud-bulldozer/sysbench:latest"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/sysbench:$SNAFU_IMAGE_TAG
build_and_push sysbench/Dockerfile $image_spec

cd ripsaw

sed -i "s#$default_ripsaw_image_spec#$image_spec#g" roles/sysbench/templates/*

# Build new ripsaw image
update_operator_image

# sysbench does not utilize a wrapper from snafu, only the Dockerfile
# We will confirm that the test_sysbench passes only
bash tests/test_sysbench.sh
pushd ripsaw
source tests/test_sysbench.sh
20 changes: 2 additions & 18 deletions uperf_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image_spec="quay.io/cloud-bulldozer/uperf:latest"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/uperf:$SNAFU_IMAGE_TAG
build_and_push uperf_wrapper/Dockerfile $image_spec

cd ripsaw

sed -si "s#$default_ripsaw_image_spec#$image_spec#g" roles/uperf/templates/*

# Build new ripsaw image
update_operator_image

get_uuid test_uperf.sh
uuid=`cat uuid`

cd ..

index="ripsaw-uperf-results"

check_es "${uuid}" "${index}"
exit $?
pushd ripsaw
source tests/test_uperf.sh
20 changes: 2 additions & 18 deletions ycsb_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,7 @@ set -x
source ci/common.sh

# Build image for ci
default_ripsaw_image_spec="quay.io/cloud-bulldozer/ycsb-server:latest"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/ycsb-server:$SNAFU_IMAGE_TAG
build_and_push ycsb_wrapper/Dockerfile $image_spec

cd ripsaw

sed -i "s#$default_ripsaw_image_spec#$image_spec#g" roles/ycsb/templates/*

# Build new ripsaw image
update_operator_image

get_uuid test_ycsb.sh
uuid=`cat uuid`

cd ..

index="ripsaw-ycsb-summary ripsaw-ycsb-results"

check_es "${uuid}" "${index}"
exit $?
pushd ripsaw
source tests/test_ycsb.sh

0 comments on commit e05ef5e

Please sign in to comment.