Skip to content

Commit 48a6787

Browse files
committed
feat(builder): use mc to upload tarball to minio
future work will add support for S3
1 parent 3bcd226 commit 48a6787

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

rootfs/etc/confd/templates/builder

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ else
9595
fi
9696
fi
9797

98+
git archive --format=tar.gz ${GIT_SHA} > ${APP_NAME}.tar.gz
99+
98100
# if minio is in the cluster, use it. otherwise use fetcher
101+
# TODO: figure out something for using S3 also
99102
if [[ -n "$DEIS_MINIO_SERVICE_HOST" && -n "$DEIS_MINIO_SERVICE_PORT" ]]; then
100103
S3EP=${DEIS_MINIO_SERVICE_HOST}:${DEIS_MINIO_SERVICE_PORT}
101104
elif [ -z "$S3EP" ]; then
@@ -109,6 +112,16 @@ sed -i -- "s#repo_name#$META_NAME#g" /etc/${SLUG_NAME}.yaml
109112
sed -i -- "s#puturl#$PUSH_URL#g" /etc/${SLUG_NAME}.yaml
110113
sed -i -- "s#tar-url#$TAR_URL#g" /etc/${SLUG_NAME}.yaml
111114

115+
ACCESS_KEY=`cat /var/run/secrets/object/store/access-key-id`
116+
ACCESS_SECRET=`cat /var/run/secrets/object/store/access-secret-key`
117+
mkdir -p /var/minio-conf
118+
CONFIG_DIR=/var/minio-conf
119+
echo "/bin/mc -C $CONFIG_DIR config host add "http://$S3EP" $ACCESS_KEY $ACCESS_SECRET"
120+
/bin/mc -C $CONFIG_DIR --quiet config host add "http://$S3EP" $ACCESS_KEY $ACCESS_SECRET
121+
/bin/mc -C $CONFIG_DIR --quiet mb "${S3EP}/git"
122+
/bin/mc -C $CONFIG_DIR --quiet cp ${APP_NAME}.tar.gz $TAR_URL
123+
echo "stored tarfile in $TAR_URL"
124+
112125
kubectl create -f /etc/${SLUG_NAME}.yaml
113126

114127
#check for image creation or slug existence in S3EP

0 commit comments

Comments
 (0)