@@ -21,13 +21,15 @@ if [ -n "$JIB" ]; then
2121 # Register post-test cleanup.
2222 # Only needed if deploy completed.
2323 function cleanup {
24+ mvn -q -B clean
2425 set -x
25- gcloud container images delete " ${CONTAINER_IMAGE} " --quiet --no-user-output-enabled || true
26+ sha=$( gcloud artifacts docker images describe $CONTAINER_IMAGE --format=" value(image_summary.digest)" )
27+ gcloud artifacts docker images delete $BASE_IMAGE @$sha --quiet --delete-tags --no-user-output-enabled || true
2628 gcloud run services delete ${SERVICE_NAME} \
2729 --platform=managed \
2830 --region=" ${REGION:- us-central1} " \
2931 --quiet --no-user-output-enabled
30- mvn -q -B clean
32+ set +x
3133 }
3234 trap cleanup EXIT
3335
@@ -45,17 +47,16 @@ if [ -n "$JIB" ]; then
4547 export SERVICE_NAME=" ${SAMPLE_NAME} -${SUFFIX} "
4648 # Remove "/" from the Cloud Run service name
4749 export SERVICE_NAME=" ${SERVICE_NAME// \/ / $' -' } "
48- export CONTAINER_IMAGE=" gcr.io/${GOOGLE_CLOUD_PROJECT} /run-${SAMPLE_NAME} :${SAMPLE_VERSION} "
49- export SPECIAL_BASE_IMAGE=" gcr.io/${GOOGLE_CLOUD_PROJECT} /imagemagick"
50+ export BASE_IMAGE=" us-central1-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT} /containers/run-${SAMPLE_NAME} "
51+ export CONTAINER_IMAGE=" ${BASE_IMAGE} :${SAMPLE_VERSION} "
52+ export SPECIAL_BASE_IMAGE=" us-central1-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT} /containers/imagemagick"
5053 BASE_IMAGE_SAMPLES=(" image-processing" " system-packages" )
5154
5255 # Build the service
5356 set -x
54-
5557 mvn -q -B jib:build -Dimage=" ${CONTAINER_IMAGE} " \
5658 ` if [[ " ${BASE_IMAGE_SAMPLES[@]} " =~ " ${SAMPLE_NAME} " ]]; then echo " -Djib.from.image=${SPECIAL_BASE_IMAGE} " ; fi`
5759
58-
5960 export MEMORY_NEEDED=(" image-processing" " idp-sql" ); # Samples that need more memory
6061
6162 gcloud run deploy " ${SERVICE_NAME} " \
@@ -64,8 +65,7 @@ if [ -n "$JIB" ]; then
6465 --platform=managed \
6566 --quiet --no-user-output-enabled \
6667 ` if [[ " ${MEMORY_NEEDED[@]} " =~ " ${SAMPLE_NAME} " ]]; then echo " --memory 512M" ; fi` \
67- ` if [ $SAMPLE_NAME = " idp-sql" ]; then echo " --update-env-vars CLOUD_SQL_CREDENTIALS_SECRET=projects/${GOOGLE_CLOUD_PROJECT} /secrets/idp-sql-secret/versions/latest" ; fi`
68-
68+ ` if [ $SAMPLE_NAME = " idp-sql" ]; then echo " --update-secrets CLOUD_SQL_CREDENTIALS_SECRET=idp-sql-secret:latest" ; fi`
6969
7070 set +x
7171
0 commit comments