1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-12 19:37:16 +00:00

Implement invalid tag detection

This commit is contained in:
Kristóf Tóth 2018-06-27 14:35:06 +02:00
parent 043ae95801
commit 1507a9338b

View File

@ -23,6 +23,7 @@ run() {
clone_required_repos_ask_ssh_or_https
local tag
tag="${BASEIMAGE_ONLY:-$(remotebase="${REMOTEBASE}" baseimage_latest_upstream_tag)}"
tag=${tag} verify_baseimage_tag
tag=${tag} build_baseimage
if [ -z "${BASEIMAGE_ONLY:-}" ]; then
@ -105,14 +106,6 @@ clone_required_repos() {
echo "Done!"
}
install_frontend_deps() {
echo -n "Installing frontend dependencies... "
pushd "${FRONTEND_REPO}"
spinned logged yarn install
popd
echo "Done!"
}
baseimage_latest_upstream_tag() {
echo -n "$(git ls-remote --tags ${remotebase}/${BASEIMAGE_REPO}.git |
cut -f2 |
@ -121,6 +114,18 @@ baseimage_latest_upstream_tag() {
tail -n 1)"
}
verify_baseimage_tag() {
pushd "${BASEIMAGE_REPO}"
local statuscode
if ! git rev-parse --quiet \
--verify \
"refs/tags/${tag}" &> /dev/null; then
logged echo "${tag} is not a valid tag!"
exit 1
fi
popd
}
pin_baseimage() {
echo -n "Pinning TFW baseimage version... "
echo -n "which is ${tag}... "
@ -137,6 +142,14 @@ build_baseimage() {
echo "Done!"
}
install_frontend_deps() {
echo -n "Installing frontend dependencies... "
pushd "${FRONTEND_REPO}"
spinned logged yarn install
popd
echo "Done!"
}
cleanup_repos() {
rm -rf "${BASEIMAGE_REPO}"
rm -rf "${CHALLENGE}/.git"