Skip to content

Commit 29b6138

Browse files
committed
fix(builder): fix race condition in /bin/boot
Commit b0572ef seemed to introduce a race condition. It seems that etcdctl will return before the key that was set has fully persisted to the key/value store, so a subsequent get will not always see the new value of the key. This resulted in builder often failing to start up, but restarting it made it come up immediately. This is because the keys `/deis/slugbuilder/image` and `/deis/slugrunner/image` were populated by the second time the component was started. This commit refactors this logic to remove the race condition.
1 parent 85f7b3b commit 29b6138

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

builder/bin/boot

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,12 @@ docker load -i /progrium_cedarish.tar
6060
# pull required images
6161

6262
# Custom slugbuilder?
63-
etcdctl --no-sync -C $ETCD mk /deis/slugbuilder/image deis/slugbuilder:latest >/dev/null 2>&1 || true
64-
SLUGBUILDER=`etcdctl --no-sync -C $ETCD get /deis/slugbuilder/image`
63+
SLUGBUILDER=`etcdctl --no-sync -C $ETCD get /deis/slugbuilder/image 2>/dev/null || etcdctl --no-sync -C $ETCD mk /deis/slugbuilder/image deis/slugbuilder:latest 2>/dev/null`
6564
docker pull ${SLUGBUILDER}
6665
docker tag ${SLUGBUILDER} deis/slugbuilder:latest
6766

6867
# Custom slugrunner?
69-
etcdctl --no-sync -C $ETCD mk /deis/slugrunner/image deis/slugrunner:latest >/dev/null 2>&1 || true
70-
SLUGRUNNER=`etcdctl --no-sync -C $ETCD get /deis/slugrunner/image`
68+
SLUGRUNNER=`etcdctl --no-sync -C $ETCD get /deis/slugrunner/image 2>/dev/null || etcdctl --no-sync -C $ETCD mk /deis/slugrunner/image deis/slugrunner:latest 2>/dev/null`
7169
docker pull ${SLUGRUNNER}
7270
docker tag ${SLUGRUNNER} deis/slugrunner:latest
7371

0 commit comments

Comments
 (0)