Skip to content

Commit

Permalink
Don't release when there's no build (plushu/plusku#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartpb committed Aug 20, 2014
1 parent c58def0 commit 5a3f690
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions hooks/release-app
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
set -eo pipefail; [[ -n "$PLUSHU_TRACE" ]] && set -x

app_dir="$PLUSHU_ROOT/apps/$1"
cidfile="$app_dir/release.cid"

# Load the release environment into the built app image
"$PLUSHU_ROOT/lib/plushook" app-env $1 |
docker run -i --cidfile="$cidfile" $(<"$app_dir/build.iid") /bin/bash -c \
"mkdir -p /app/.profile.d
printf 'set -a\n\n' >/app/.profile.d/app-env.sh
cat >>/app/.profile.d/app-env.sh
printf '\nset +a\n' >>/app/.profile.d/app-env.sh"
# If there's a build to base a release on
if [[ -f "$app_dir/build.iid" ]]; then

# Convert the release to an image
docker commit $(<"$cidfile") >"$app_dir/release.iid"
docker rm $(<"$cidfile") > /dev/null && rm -f "$cidfile"
cidfile="$app_dir/release.cid"

# Load the release environment into the built app image
"$PLUSHU_ROOT/lib/plushook" app-env $1 |
docker run -i --cidfile="$cidfile" $(<"$app_dir/build.iid") /bin/bash -c \
"mkdir -p /app/.profile.d
printf 'set -a\n\n' >/app/.profile.d/app-env.sh
cat >>/app/.profile.d/app-env.sh
printf '\nset +a\n' >>/app/.profile.d/app-env.sh"

# Convert the release to an image
docker commit $(<"$cidfile") >"$app_dir/release.iid"
docker rm $(<"$cidfile") > /dev/null && rm -f "$cidfile"
fi

0 comments on commit 5a3f690

Please sign in to comment.