Skip to content

Commit 696322a

Browse files
committed
Merge pull request #47 from arschles/nofile
fix(builder): ping remote storage to determine when builds are done
2 parents 2ff8853 + 36607fa commit 696322a

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

rootfs/etc/confd/templates/builder

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,16 @@ fi
9898
git archive --format=tar.gz ${GIT_SHA} > ${APP_NAME}.tar.gz
9999

100100
HTTP_PREFIX="http"
101+
REMOTE_STORAGE="0"
101102
# if minio is in the cluster, use it. otherwise use fetcher
102103
# TODO: figure out something for using S3 also
103104
if [[ -n "$DEIS_MINIO_SERVICE_HOST" && -n "$DEIS_MINIO_SERVICE_PORT" ]]; then
104105
S3EP=${DEIS_MINIO_SERVICE_HOST}:${DEIS_MINIO_SERVICE_PORT}
106+
REMOTE_STORAGE="1"
105107
elif [[ -n "$DEIS_OUTSIDE_STORAGE_HOST" && -n "$DEIS_OUTSIDE_STORAGE_PORT" ]]; then
106108
HTTP_PREFIX="https"
107109
S3EP=${DEIS_OUTSIDE_STORAGE_HOST}:${DEIS_OUTSIDE_STORAGE_PORT}
110+
REMOTE_STORAGE="1"
108111
elif [ -z "$S3EP" ]; then
109112
S3EP=${HOST}:3000
110113
fi
@@ -136,11 +139,23 @@ kubectl --namespace=$POD_NAMESPACE create -f /etc/${SLUG_NAME}.yaml
136139

137140
#check for image creation or slug existence in S3EP
138141

139-
while [ ! -f /apps/${SLUG_NAME}/slug.tgz ]
140-
do
141-
sleep 2
142-
echo "no file"
143-
done
142+
if [[ "$REMOTE_STORAGE" == "1" ]]; then
143+
LS_CMD="$MC_PREFIX ls $PUSH_URL"
144+
echo "Waiting for build to complete..."
145+
until $LS_CMD &> /dev/null; do
146+
echo -ne "."
147+
sleep 2
148+
done
149+
else
150+
echo -ne "Waiting for build to complete..."
151+
while [ ! -f /apps/${SLUG_NAME}/slug.tgz ]
152+
do
153+
echo -ne "."
154+
sleep 2
155+
done
156+
fi
157+
echo ""
158+
echo "Build complete."
144159

145160
URL="http://$DEIS_WORKFLOW_SERVICE_HOST:$DEIS_WORKFLOW_SERVICE_PORT/v2/hooks/config"
146161
RESPONSE=$(get-app-config -url="$URL" -key="{{ getv "/deis/controller/builderKey" }}" -user=$USER -app=$APP_NAME)

0 commit comments

Comments
 (0)