Skip to content

Commit

Permalink
Update script to run application in cloud run
Browse files Browse the repository at this point in the history
  • Loading branch information
psx95 committed Sep 17, 2024
1 parent 73c95b5 commit 8faa8f7
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions examples/metrics/run_as_cloud-run-job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,10 @@
ARTIFACT_REPOSITORY=cloud-run-applications
JOB_NAME=job-metrics-export

if [[ -z "${GOOGLE_CLOUD_PROJECT}" ]]; then
echo "GOOGLE_CLOUD_PROJECT environment variable not set"
exit 1
fi

if [[ -z "${GOOGLE_APPLICATION_CREDENTIALS}" ]]; then
echo "GOOGLE_APPLICATION_CREDENTIALS environment variable not set"
exit 1
fi

if [[ -z "${GOOGLE_CLOUD_RUN_REGION}" ]]; then
echo "GOOGLE_CLOUD_RUN_REGION environment variable not set"
exit 1
fi
# Verify necessary environment variables are set
echo "${GOOGLE_CLOUD_PROJECT:?${UNSET_WARNING}}"
echo "${GOOGLE_APPLICATION_CREDENTIALS:?${UNSET_WARNING}}"
echo "${GOOGLE_CLOUD_RUN_REGION:?${UNSET_WARNING}}"

echo "ENVIRONMENT VARIABLES VERIFIED"

Expand All @@ -55,9 +45,9 @@ then
else
echo "CREATING A CLOUD RUN JOB TO RUN THE CONTAINER"
gcloud run jobs create job-metrics-export \
--image "${GOOGLE_CLOUD_RUN_REGION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${ARTIFACT_REPOSITORY}/metrics-export-java" \
--max-retries 5 \
--region ${GOOGLE_CLOUD_RUN_REGION} \
--image="${GOOGLE_CLOUD_RUN_REGION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${ARTIFACT_REPOSITORY}/metrics-export-java" \
--max-retries=5 \
--region="${GOOGLE_CLOUD_RUN_REGION}" \
--project="${GOOGLE_CLOUD_PROJECT}"
fi

Expand Down

0 comments on commit 8faa8f7

Please sign in to comment.