Skip to content

Commit

Permalink
refs sparkfabrik-innovation-team/board#2897: add ingress control opt (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
FabrizioCafolla authored Jul 5, 2024
1 parent 47f550d commit 4fc0a5d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions templates/gitlab-ci-template-cloud-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# - CLOUD_RUN_ENV_VARS: the environment variables use to deploy the application in Google Cloud Run (e.g. `SITE_LOCALE=${SITE_LOCALE},COMMIT_SLUG=${CI_COMMIT_REF_SLUG}`) - Default:
# - CLOUD_RUN_DEPLOY_RAW_OPTIONS: the raw options used to deploy the application in Google Cloud Run (e.g. `--memory 100Mi --async`) - Default:
# - UPDATE_TRAFFIC: this toggle controls if the final job enforcing the traffic routing to the latest deployed revision should be executed or not - Default: `1`
# - CLOUD_RUN_INGRESS: the ingress used to deploy the application in Google Cloud Run (e.g. internal). Go to the official documentation here https://cloud.google.com/sdk/gcloud/reference/run/deploy#--ingress to have more information
#
# Autogenerated variables:
# - CI_REGISTRY_IMAGE: the full name of the docker image - Default: ${CI_REGISTRY_IMAGE_BASE_URL}/${DOCKER_IMAGE_NAME}:${CI_REGISTRY_IMAGE_TAG}
Expand All @@ -54,6 +55,7 @@ variables:
CI_REGISTRY_IMAGE_TAG: ${CI_COMMIT_SHORT_SHA}
CI_REGISTRY_IMAGE: ${CI_REGISTRY_IMAGE_BASE_URL}/${DOCKER_IMAGE_NAME}:${CI_REGISTRY_IMAGE_TAG}
DEPLOYMENT_NAME: ${APP_NAME}-${CI_COMMIT_REF_SLUG}
CLOUD_RUN_INGRESS: all
PORT: 80
DOCKERFILE: Dockerfile
UPDATE_TRAFFIC: 1
Expand Down Expand Up @@ -93,14 +95,14 @@ workflow:
printf "\e[1mConfigured variables:\e[0m\n"
for VAR_NAME in "APP_NAME" "GCP_PROJECT_ID" "GCP_REGION" "DEPLOYMENT_MAIN_BRANCH" \
"DOCKER_IMAGE_NAME" "CI_REGISTRY_IMAGE_BASE_URL" "CI_REGISTRY_IMAGE_TAG" "CI_REGISTRY_IMAGE" \
"DEPLOYMENT_NAME" "PORT" "DOCKERFILE" "SERVICE_ACCOUNT" "SERVICE_ACCOUNT_OPT" \
"DEPLOYMENT_NAME" "PORT" "CLOUD_RUN_INGRESS" "DOCKERFILE" "SERVICE_ACCOUNT" "SERVICE_ACCOUNT_OPT" \
"CLOUD_RUN_ENV_VARS" "CLOUD_RUN_ENV_VARS_OPT" "CLOUD_RUN_DEPLOY_RAW_OPTIONS"; do
printf "%-${PAD_LEN}s \e[1m%s\e[0m\n" "${VAR_NAME}" "${!VAR_NAME}"
done
# Please remember to keep the following `gcloud run deploy` command in sync with the one in the `.deploy_template` job.
- |
printf "\e[1mThe final 'gcloud run deploy' command will be:\e[0m\n"
echo "gcloud run deploy ${DEPLOYMENT_NAME} --image=${CI_REGISTRY_IMAGE} --region ${GCP_REGION} --platform managed --allow-unauthenticated --project ${GCP_PROJECT_ID} --port=${PORT} ${SERVICE_ACCOUNT_OPT} ${CLOUD_RUN_ENV_VARS_OPT} ${CLOUD_RUN_DEPLOY_RAW_OPTIONS}"
echo "gcloud run deploy ${DEPLOYMENT_NAME} --image=${CI_REGISTRY_IMAGE} --region ${GCP_REGION} --platform managed --allow-unauthenticated --project ${GCP_PROJECT_ID} --port=${PORT} --ingress=${CLOUD_RUN_INGRESS} ${SERVICE_ACCOUNT_OPT} ${CLOUD_RUN_ENV_VARS_OPT} ${CLOUD_RUN_DEPLOY_RAW_OPTIONS}"
.build_template:
script:
Expand All @@ -124,7 +126,7 @@ workflow:
- !reference [.load_and_push_template, script]
# Please remember to keep the following `gcloud run deploy` command in sync with the one in the `.print_vars` job.
- gcloud run deploy ${DEPLOYMENT_NAME} --image=${CI_REGISTRY_IMAGE}
--region ${GCP_REGION} --platform managed --allow-unauthenticated --project ${GCP_PROJECT_ID} --port=${PORT}
--region ${GCP_REGION} --platform managed --allow-unauthenticated --project ${GCP_PROJECT_ID} --port=${PORT} --ingress=${CLOUD_RUN_INGRESS}
${SERVICE_ACCOUNT_OPT} ${CLOUD_RUN_ENV_VARS_OPT} ${CLOUD_RUN_DEPLOY_RAW_OPTIONS}

.update_traffic_template:
Expand Down

0 comments on commit 4fc0a5d

Please sign in to comment.