Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Davis <[email protected]>
  • Loading branch information
Doug Davis committed Sep 27, 2020
1 parent 7e9322f commit 0ff7e9d
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 16 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ followed is:
your own you'll need to set the `REPOSITORY` environment variable.
This means that you should be able to just execute `run` without running
`build` first, and it'll just use the pre-built images from `ibmcom`.
- invoking `run clean` should clean up from any previous execution without
re-running the sample.

Most samples will try to be relatively small to focus on one particular
task so that it can be re-used easily and integrated into a larger use-case.
Expand Down
11 changes: 9 additions & 2 deletions hello/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
# REPOSITORY: name of the image registry/namespace to get the images

# Clean up previous run
ic ce app delete -n hello -f --wait=true > /dev/null 2>&1 || true
function clean() {
set +x
echo Cleaning...
ic ce app delete -n hello -f --wto=0 > /dev/null 2>&1 || true
}

clean
[[ "$1" == "clean" ]] && exit 0

set -ex
export REPOSITORY=${REPOSITORY:-ibmcom}
Expand All @@ -24,4 +31,4 @@ if ! [[ "$(curl -s $URL)" == "Hello World" ]]; then
fi

# Clean up
ic ce app delete -n hello -f
clean
11 changes: 9 additions & 2 deletions helloworld/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
# REPOSITORY: name of the image registry/namespace to get the images

# Clean up previous run
ic ce app delete -n helloworld -f --wait=true > /dev/null 2>&1 || true
function clean() {
set +x
echo Cleaning...
ic ce app delete -n helloworld -f --wto=0 > /dev/null 2>&1 || true
}

clean
[[ "$1" == "clean" ]] && exit 0

set -ex
export REPOSITORY=${REPOSITORY:-ibmcom}
Expand All @@ -24,4 +31,4 @@ if ! [[ "$(curl -s $URL -d "Hi")" == "Hi" ]]; then
fi

# Clean up
ic ce app delete -n helloworld -f
clean
14 changes: 10 additions & 4 deletions job/run
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
# REPOSITORY: name of the image registry/namespace to get the images

# Clean up previous run
ic ce jobrun delete -n job -f > /dev/null 2>&1 || true
ic ce app delete -n app -f > /dev/null 2>&1 || true
function clean() {
set +x
echo Cleaning...
ic ce jobrun delete -n job -f > /dev/null 2>&1 || true
ic ce app delete -n app -f --wto=0 > /dev/null 2>&1 || true
}

clean
[[ "$1" == "clean" ]] && exit 0

set -ex
export REPOSITORY=${REPOSITORY:-ibmcom}
Expand All @@ -33,5 +40,4 @@ if ! [[ "Count: $((COUNT*10))" == "$(curl -s $URL)" ]]; then
fi

# Clean up
ic ce jobrun delete -n job -f
ic ce app delete -n app -f
clean
7 changes: 5 additions & 2 deletions run-all
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ for file in `find . -name run | sort` ; do (
echo -e "\n### `dirname $file`\n"
cd `dirname $file`

# Run the sample
./run
# Skip this dir
[[ -e ./SKIP ]] && echo "SKIPPING $file " && continue

# Run the sample with whatever REPOSITORY we're pointing to
./run "$@"

) done

Expand Down
3 changes: 2 additions & 1 deletion s2i-buildpacks/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# Clean up previous run
function clean() {
set +x
echo Cleaning...
Expand All @@ -16,8 +17,8 @@ function clean() {
ID=$(ic account show | grep "Account ID:" | sed "s/^.*: *//")
ICR_NS=s2i-${ID:0:25}

# Clean up previous run
clean
[[ "$1" == "clean" ]] && exit 0

set -ex

Expand Down
3 changes: 2 additions & 1 deletion s2i-dockerfile/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# Clean up previous run
function clean() {
set +x
echo Cleaning...
Expand All @@ -16,8 +17,8 @@ function clean() {
ID=$(ic account show | grep "Account ID:" | sed "s/^.*: *//")
ICR_NS=s2i-${ID:0:25}

# Clean up previous run
clean
[[ "$1" == "clean" ]] && exit 0

set -ex

Expand Down
14 changes: 10 additions & 4 deletions sessions/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
# REPOSITORY: name of the image registry/namespace to get the images

# Clean up previous run
ic ce app delete -n redis -f --wait=true > /dev/null 2>&1 || true
ic ce app delete -n myapp -f --wait=true > /dev/null 2>&1 || true
function clean() {
set +x
echo Cleaning...
ic ce app delete -n redis -f --wto=0 > /dev/null 2>&1 || true
ic ce app delete -n myapp -f --wto=0 > /dev/null 2>&1 || true
}

clean
[[ "$1" == "clean" ]] && exit 0

set -ex
export REPOSITORY=${REPOSITORY:-ibmcom}
Expand Down Expand Up @@ -43,5 +50,4 @@ if ! [[ "$(curl -s $URL)" == "Counter: 100 "* ]]; then
fi

# Clean up
ic ce app delete -n redis -f
ic ce app delete -n myapp -f
clean

0 comments on commit 0ff7e9d

Please sign in to comment.