Skip to content

Commit c69151a

Browse files
committed
fix(builder): validate that properly formed slugs are added correctly
1 parent 7f4ff24 commit c69151a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

builder/templates/builder

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ fi
105105
# if no Dockerfile is present, use slugbuilder to compile a heroku slug
106106
# and write out a Dockerfile to use that slug
107107
if [ ! -f Dockerfile ]; then
108+
# FIXME: validate slugs were added correctly to the image
109+
VALIDATE_IMAGE=1
108110
# build option string to send to slugbuilder
109111
BUILD_OPTS=("$CONFIG")
110112

@@ -137,6 +139,15 @@ echo "ENV GIT_SHA $GIT_SHA" >> Dockerfile
137139
echo
138140
puts-step "Building Docker image"
139141
docker build -t $TMP_IMAGE . 2>&1
142+
143+
# FIXME: validate Docker image to ensure slug is not malformed
144+
if [[ $VALIDATE_IMAGE ]]; then
145+
if [[ "$(docker history $TMP_IMAGE | grep ADD | head -n1 | awk {'print $11'})" == "0" ]]; then
146+
puts-warn "Malformed Docker image, aborting build."
147+
exit 1
148+
fi
149+
fi
150+
140151
puts-step "Pushing image to private registry"
141152
docker push $TMP_IMAGE &>/dev/null
142153
echo

0 commit comments

Comments
 (0)