Skip to content

Commit

Permalink
Lowercase service name by default
Browse files Browse the repository at this point in the history
  • Loading branch information
heubeck committed Jul 15, 2022
1 parent f2f0e6f commit 3382ea0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ fi

REVISION_SUFFIX=${REVISION_PREFIX}${REVISION_DATE}

echo "Deploying $FQ_IMAGE as service $INPUT_SERVICE_NAME to $INPUT_GCP_REGION in revision $REVISION_SUFFIX."
# lowercase service name and suffix to be DNS compliant
SERVICE_NAME="${INPUT_SERVICE_NAME,,}"
REVISION_SUFFIX="${REVISION_SUFFIX,,}"

echo "Deploying $FQ_IMAGE as service $SERVICE_NAME to $INPUT_GCP_REGION in revision $REVISION_SUFFIX."

# turn off globbing
set -f
Expand Down Expand Up @@ -132,7 +136,7 @@ fi
NO_TRAFFIC=""
set +e
enableDebug
gcloud beta run services describe --region="$INPUT_GCP_REGION" "$INPUT_SERVICE_NAME" 2>&1 > /dev/null
gcloud beta run services describe --region="$INPUT_GCP_REGION" "$SERVICE_NAME" 2>&1 > /dev/null
if [ $? -eq 0 ]; then
# 'describe' command results in an error, if service dows not exist
NO_TRAFFIC="--no-traffic"
Expand All @@ -141,7 +145,7 @@ disableDebug
set -e

enableDebug
gcloud beta run deploy "$INPUT_SERVICE_NAME" \
gcloud beta run deploy "$SERVICE_NAME" \
--platform="managed" \
--region="$INPUT_GCP_REGION" \
--image="$FQ_IMAGE" \
Expand All @@ -164,7 +168,7 @@ disableDebug

if [ "$INPUT_NO_TRAFFIC" != "true" ]; then
enableDebug
gcloud beta run services update-traffic "$INPUT_SERVICE_NAME" \
gcloud beta run services update-traffic "$SERVICE_NAME" \
--to-latest \
--platform=managed \
--region="$INPUT_GCP_REGION" \
Expand All @@ -179,6 +183,6 @@ else
fi

echo ::set-output name=gcloud_log::"<pre>$(sed ':a;N;$!ba;s/\n/<br>/g' gcloud.log)</pre><hr><pre>$(sed ':a;N;$!ba;s/\n/<br>/g' traffic.log)</pre>"
echo ::set-output name=cloud_run_revision::"${INPUT_SERVICE_NAME}-${REVISION_SUFFIX}"
echo ::set-output name=cloud_run_revision::"${SERVICE_NAME}-${REVISION_SUFFIX}"
echo ::set-output name=cloud_run_endpoint::"${ENDPOINT}"
echo ::set-output name=deployed_image_tag::"${IMAGE_TAG}"

0 comments on commit 3382ea0

Please sign in to comment.