From c398509aff32dd6db0b99c5b94ede3aef8cbd9cc Mon Sep 17 00:00:00 2001 From: UDIT GAURAV <35391335+uditgaurav@users.noreply.github.com> Date: Sun, 17 May 2020 17:54:50 +0530 Subject: [PATCH] (fix): Export variables from entrypoint.sh and multiple chaos action support in a single github job (#2) * (fix): Export variables from entrypoint.sh file Signed-off-by: Udit Gaurav * Add support for multiple experiments in single github job Signed-off-by: Udit Gaurav --- Dockerfile | 6 +++--- entrypoint.sh | 9 ++++++--- experiments/pod-network-latency/README.md | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d5c774d..8d9c87d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,9 @@ LABEL com.github.actions.description="Different Chaos Experiment for Kubernetes" LABEL com.github.actions.icon="terminal" LABEL com.github.actions.color="blue" +ENV GOPATH=/github/home/go +ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin + ARG KUBECTL_VERSION=1.17.0 ADD https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl /usr/local/bin/kubectl RUN chmod +x /usr/local/bin/kubectl @@ -18,9 +21,6 @@ RUN apt-get update && apt-get install -y git && \ apt-get install -y ssh && \ apt install ssh rsync -RUN export GOPATH=$HOME/go -RUN export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin - COPY README.md / COPY entrypoint.sh /entrypoint.sh COPY experiments ./experiments diff --git a/entrypoint.sh b/entrypoint.sh index 5448a62..fb96d62 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,13 +9,16 @@ export KUBECONFIG=${HOME}/.kube/config ##Setup mkdir -p $HOME/go/src/github.com/mayadata-io -rsync -az --delete ${GOPATH}/src/github.com/mayadata-io/ cd ${GOPATH}/src/github.com/mayadata-io/ +dir=${GOPATH}/src/github.com/mayadata-io/chaos-ci-lib +if [ ! -d $dir ] +then git clone https://github.com/mayadata-io/chaos-ci-lib.git +fi cd chaos-ci-lib ##Install litmus if it is not already installed -if [ $INSTALL_LITMUS = true ] +if [ "$INSTALL_LITMUS" = "true" ] then go test tests/install-litmus_test.go -v -count=1 fi @@ -24,7 +27,7 @@ fi go test tests/${EXPERIMENT_NAME}_test.go -v -count=1 ##litmus cleanup -if [ $LITMUS_CLEANUP = true ] +if [ "$LITMUS_CLEANUP" = "true" ] then go test tests/uninstall-litmus_test.go -v -count=1 fi diff --git a/experiments/pod-network-latency/README.md b/experiments/pod-network-latency/README.md index 7a6d31c..6cc17ab 100644 --- a/experiments/pod-network-latency/README.md +++ b/experiments/pod-network-latency/README.md @@ -39,7 +39,7 @@ jobs: TARGET_CONTAINER: nginx TOTAL_CHAOS_DURATION: 60 NETWORK_INTERFACE: eth0 - NETWORK_LATENCY: 60000 + NETWORK_LATENCY: 60000 ##Select true if you want to uninstall litmus after chaos LITMUS_CLEANUP: true ```