Skip to content

Commit

Permalink
Avoid rebuilding operator and checking ES twice
Browse files Browse the repository at this point in the history
  • Loading branch information
rsevilla87 committed May 29, 2020
1 parent 5fb66a8 commit 4536df6
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 143 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
41 changes: 15 additions & 26 deletions ci/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@ 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}
export SNAFU_WRAPPER_IMAGE_PREFIX="$image_location/$image_account"
echo "posting container images to $image_location with account $image_account"
export image_builder=${SNAFU_IMAGE_BUILDER:-podman}
if [ "$USER" != "root" ] ; then
SUDO=sudo
SUDO=
fi
NOTOK=1

# see kubernetes initialization on last line of this script
# which will be the first thing the wrapper ci_test.sh does to it

function update_operator_image() {
if [[ -f operator-ready ]]; then
echo "Ripsaw image already built"
return 0
fi
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}/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}/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,9 +42,8 @@ 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
touch operator-ready
}

function wait_clean {
Expand Down Expand Up @@ -65,28 +76,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
20 changes: 3 additions & 17 deletions fio_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,10 @@ 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/*

pushd ripsaw
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 $?

source tests/test_fiod.sh
popd
18 changes: 3 additions & 15 deletions fs_drift_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,10 @@ 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
pushd ripsaw
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 $?
source tests/test_fs_drift.sh
popd
19 changes: 3 additions & 16 deletions hammerdb/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@ 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
pushd ripsaw
update_operator_image

get_uuid test_hammerdb.sh
uuid=`cat uuid`

cd ..

index="ripsaw-hammerdb-results"

check_es "${uuid}" "${index}"
exit $?
source tests/test_hammerdb.sh
popd
25 changes: 5 additions & 20 deletions pgbench_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,10 @@ 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
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/pgbench:$SNAFU_IMAGE_TAG
build_and_push pgbench_wrapper/Dockerfile $image_spec
pushd ripsaw
update_operator_image

get_uuid test_pgbench.sh
uuid=`cat uuid`

cd ..

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

check_es "${uuid}" "${index}"
exit $?
source tests/test_pgbench.sh
popd
20 changes: 3 additions & 17 deletions smallfile_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,10 @@ 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
pushd ripsaw
update_operator_image

get_uuid test_smallfile.sh
uuid=`cat uuid`

cd ..

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

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

source tests/test_smallfile.sh
popd
19 changes: 3 additions & 16 deletions uperf_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@ 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
pushd ripsaw
update_operator_image

get_uuid test_uperf.sh
uuid=`cat uuid`

cd ..

index="ripsaw-uperf-results"

check_es "${uuid}" "${index}"
exit $?
source tests/test_uperf.sh
popd
19 changes: 3 additions & 16 deletions ycsb_wrapper/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@ 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
pushd ripsaw
update_operator_image

get_uuid test_ycsb.sh
uuid=`cat uuid`

cd ..

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

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

0 comments on commit 4536df6

Please sign in to comment.