Skip to content

Commit

Permalink
implemented rerun_ci --list, --clean, --remove
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-luedtke committed May 23, 2018
1 parent ccbd1a8 commit fe4505b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
6 changes: 6 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,12 @@ This will run the tests and commit the result to a Docker image `industrial-ci/r
The hash is unique for each argument list, so `rerun_ci . ROS_DISTRO=melodic` and `rerun_ci . ROS_DISTRO=kinetic` do not mix up.
However, it will keep consuming disk space with each new combination.

The cached images can be listed with
::

$ rosrun industrial_ci rerun_ci --list


For maintainers of industrial_ci repository
================================================

Expand Down
34 changes: 33 additions & 1 deletion industrial_ci/scripts/rerun_ci
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,33 @@

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

function show_help {
cat - <<'EOF'
Usage:
rerun_ci --list|-l
rerun_ci [--clean|-c] TARGET_PATH [PARAM=VALUE>]...]
rerun_ci --rm TARGET_PATH [PARAM=VALUE>]...]
EOF
}

case "$1" in
"-l" | "--list")
exec docker image inspect --format '{{index .RepoTags 0}} - {{.Comment}}' $(docker images -q industrial-ci/rerun_ci/*)
;;
"--rm")
remove=true
;;
"-c" | "--clean")
clean=true
;;
"-h" | "--help" | "")
show_help
exit 0
;;
esac

if [ ! -d "$1" ]; then
echo "First argument need to be the target directory"
show_help
exit 1
fi

Expand All @@ -29,6 +54,13 @@ _COMMIT_IMAGE_MSG="$repo_dir $*"
env_hash=($(sha256sum <<< "$_COMMIT_IMAGE_MSG"))
_COMMIT_IMAGE="industrial-ci/rerun_ci/$(basename "$repo_dir"):${env_hash:0:12}"

if [ "$remove" ]; then
exec docker rmi $_COMMIT_IMAGE
elif [ "$clean" ]; then
docker rmi $_COMMIT_IMAGE
fi


force_env=(_COMMIT_IMAGE=$_COMMIT_IMAGE _COMMIT_IMAGE_MSG=$_COMMIT_IMAGE_MSG)
keep_env=(DOCKER_PORT=$DOCKER_PORT SSH_AUTH_SOCK=$SSH_AUTH_SOCK TERM=$TERM)

Expand Down

0 comments on commit fe4505b

Please sign in to comment.