From 8f71fce660a6d54efe07da2acdc839bc409af9d8 Mon Sep 17 00:00:00 2001 From: infogulch Date: Fri, 30 Apr 2021 21:43:40 -0500 Subject: [PATCH] Adjust output formatting --- README.md | 15 ++++++++------- docker-artifact.sh | 6 +++--- example/Dockerfile | 4 ---- example/example.sh | 11 ++++------- example/testfile.txt | 1 - 5 files changed, 15 insertions(+), 22 deletions(-) delete mode 100644 example/Dockerfile delete mode 100644 example/testfile.txt diff --git a/README.md b/README.md index 794200d..edf0a77 100644 --- a/README.md +++ b/README.md @@ -52,13 +52,14 @@ Options > See the `example/` directory for a complete working example, summarized below: ``` -> printf 'FROM busybox \n RUN mkdir app && echo "Hello World!" > /app/testfile.txt' | docker build -t infogulch/test-image - -... -> docker artifact label infogulch/test-image /app/testfile.txt -Successfully added labels to 'infogulch/test-image': -{ - "/app/testfile.txt": "sha256:..." -} +> printf 'FROM busybox \n RUN mkdir app && echo "Hello World!" > /app/testfile.txt' | docker build -t infogulch/artifact-test - + => [internal] load build definition from Dockerfile + ... + => => writing image sha256:bc8ff9e88a0908f50f3c39b640a2f5a39f6cb5b7bce60510673d5da4f3e6e704 + => => naming to docker.io/infogulch/artifact-test +> docker artifact label infogulch/artifact-test /app/testfile.txt + ** Rebuilt image 'infogulch/artifact-test' to add 1 labels + ** Run 'docker push infogulch/artifact-test' to push it to your container repository > docker push infogulch/test-image ... > docker artifact download infogulch/test-image /app/testfile.txt diff --git a/docker-artifact.sh b/docker-artifact.sh index 591b76c..4b1c114 100755 --- a/docker-artifact.sh +++ b/docker-artifact.sh @@ -122,8 +122,8 @@ function label { LOG "All image labels:"$'\n'"$(docker image inspect "$image" | jq '.[0].Config.Labels' | sed 's_^_ _' )" # Remind user to push image - echo " [*] Rebuilt image '$image' to add $foundcount labels" - echo " [*] Run 'docker push $image' to push it to your container repository" + echo " ** Rebuilt image '$image' to add $foundcount labels" + echo " ** Run 'docker push $image' to push it to your container repository" } function delete_files { @@ -133,7 +133,7 @@ function delete_files { export verbose=1 function LOG { - [ $verbose ] && >&2 echo -e "$(tput setaf 4) ==> $@$(tput sgr0)" + [ $verbose ] && >&2 echo -e "$(tput setaf 4) => $@$(tput sgr0)" } # Export functions used in subshells diff --git a/example/Dockerfile b/example/Dockerfile deleted file mode 100644 index 145e6cf..0000000 --- a/example/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM busybox -ADD testfile.txt . -RUN rm testfile.txt && mkdir app && echo "hello" > /app/othertestfile.txt - diff --git a/example/example.sh b/example/example.sh index e31e2ee..39dd9ac 100755 --- a/example/example.sh +++ b/example/example.sh @@ -1,16 +1,13 @@ #!/usr/bin/env bash -set -e -source=$(dirname "${BASH_SOURCE[0]}") -pushd "$source" &> /dev/null +pushd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null # Build example image echo "Rebuilding docker image for example" -docker build . -t infogulch/test-image &> /dev/null +printf 'FROM busybox \n RUN mkdir app && echo "Hello World!" > /app/testfile.txt' | docker build -t infogulch/artifact-test - &> /dev/null -# Execute docker artifact to add a label to /app/othertestfile.txt -set +e -../docker-artifact.sh artifact label infogulch/test-image /app/othertestfile.txt +# Execute docker artifact to add a label that identifies /app/testfile.txt +../docker-artifact.sh artifact label infogulch/artifact-test /app/testfile.txt popd &> /dev/null diff --git a/example/testfile.txt b/example/testfile.txt deleted file mode 100644 index 45b983b..0000000 --- a/example/testfile.txt +++ /dev/null @@ -1 +0,0 @@ -hi