Commit fb62c881 authored by Javier Diaz's avatar Javier Diaz
Browse files

Updated tfs.sh deployment exists to control building of docker images

parent dde6c4ed
Loading
Loading
Loading
Loading
+61 −52
Original line number Diff line number Diff line
@@ -45,6 +45,10 @@ export TFS_GRAFANA_PASSWORD=${TFS_GRAFANA_PASSWORD:-"admin123+"}
# If TFS_SKIP_BUILD is "YES", the containers are not rebuilt-retagged-repushed and existing ones are used.
export TFS_SKIP_BUILD=${TFS_SKIP_BUILD:-""}

# If not already set, disable build-if-exists flag to skip building Docker images if they already exist.
# If TFS_BUILD_IF_EXISTS is "NO", the containers are not rebuilt if they already exist.
export TFS_BUILD_IF_EXISTS=${TFS_BUILD_IF_EXISTS:-"NO"}


# ----- CockroachDB ------------------------------------------------------------

@@ -208,6 +212,8 @@ for COMPONENT in $TFS_COMPONENTS; do
    echo "Processing '$COMPONENT' component..."

    if [ "$TFS_SKIP_BUILD" != "YES" ]; then
        IMAGE_EXISTS=$(docker images -q "$COMPONENT:$TFS_IMAGE_TAG")
        if [ -z "$IMAGE_EXISTS" ] || [ "$TFS_BUILD_IF_EXISTS" == "YES" ]; then
            echo "  Building Docker image..."
            BUILD_LOG="$TMP_LOGS_FOLDER/build_${COMPONENT}.log"

@@ -275,6 +281,9 @@ for COMPONENT in $TFS_COMPONENTS; do
                PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}.log"
                docker push "$IMAGE_URL" > "$PUSH_LOG"
            fi
        else
            echo "  Skipping Docker build for '$COMPONENT' as the image already exists and TFS_BUILD_IF_EXISTS is set to 'NO'."
        fi
    fi

    echo "  Adapting '$COMPONENT' manifest file..."