Skip to content

Commit

Permalink
Add depends on to CI
Browse files Browse the repository at this point in the history
Given that snafu CI uses ripsaw, we needed a depends-on functionality
so that we can checkout a ripsaw pr in the CI.

Depends-On: 286
  • Loading branch information
aakarshg committed Feb 20, 2020
1 parent 0320188 commit 6d83924
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ full index name, and posts document **my__doc** to it.

## how do I integrate snafu wrapper into my ripsaw benchmark?

You just replace the commands to run the workload in your ripsaw benchmark
You just replace the commands to run the workload in your ripsaw benchmark
(often in roles/Your_Workload/templates/workload.yml.j2) with the command below.

First, you have to define environment variables used to pass information to
Expand Down Expand Up @@ -165,7 +165,7 @@ The remaining parameters are defined and parsed by the workload-specific wrapper

## how do I run my snafu wrapper in CI?

add the ci_test.sh script to your wrapper directory - the SNAFU CI (Continuous Integration) test harness
add the ci_test.sh script to your wrapper directory - the SNAFU CI (Continuous Integration) test harness
will automatically find it and run it. This assumes that your wrapper supports ripsaw, for now.
At present, the CI does not test SNAFU on baremetal but this may be added in the future.

Expand All @@ -176,11 +176,11 @@ every ci_test.sh script makes use of environment variables defined in ci/common.
* SNAFU_IMAGE_TAG (defaults to snafu_ci)
* SNAFU_IMAGE_BUILDER (defaults to podman, can be set to docker)

You, the wrapper developer, can override these variables to use any container image repository
You, the wrapper developer, can override these variables to use any container image repository
supported by ripsaw (quay.io is at present the only location tested).

NOTE: at present, you need to force these images to be public images so that minikube can
load them. A better method is needed.
load them. A better method is needed.

In your CI script, ci_test.sh, you can make use of these 2 environment variables:

Expand All @@ -194,7 +194,7 @@ And here is a simple example of a ci_test.sh (they all look very similar):
source ci/common.sh
default_image_spec="quay.io/cloud-bulldozer/your_wrapper:master"
image_spec=$SNAFU_WRAPPER_IMAGE_PREFIX/your_wrapper:$SNAFU_IMAGE_TAG
build_and_push your_wrapper/Dockerfile $image_spec
build_and_push your_wrapper/Dockerfile $image_spec
cd ripsaw
sed -i "s#$default_image_spec#$image_spec#" roles/your_wrapper_in_ripsaw/templates/*
Expand All @@ -215,6 +215,11 @@ check_es "${uuid}" "${index}"
exit $?
```

Note: If your PR requires a PR in ripsaw to be merged, you can ask CI to
checkout that PR by adding a `Depends-On: <ripsaw_pr_number>` to the end of
your snafu commit message.


## Style guide
Max line length is 110 to avoid linting issues.

Expand All @@ -228,4 +233,4 @@ Run ``` flake8 ``` command.

This will show the code quality errors. Fix them before making a PR.

To ignore an error, use ``` # noqa ``` at the end of that code line.
To ignore an error, use ``` # noqa ``` at the end of that code line.
10 changes: 10 additions & 0 deletions ci/run_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ kubectl create namespace my-ripsaw
rm -rf ripsaw
git clone https://github.com/cloud-bulldozer/ripsaw.git

if [[ $ghprbPullLongDescription = *"Depends-On:"* ]]; then
ripsaw_change_id="$(echo $ghprbPullLongDescription | sed -n -e 's/^.*Depends-On: //p')"
echo $ripsaw_change_id
cd ripsaw
git fetch origin pull/$ripsaw_change_id/head:local_change
git checkout local_change
cd ..
fi


# Prep results.markdown file
echo "Results for SNAFU CI Test" > results.markdown
echo "" >> results.markdown
Expand Down

0 comments on commit 6d83924

Please sign in to comment.