-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to esp full version script (#1191)
Co-authored-by: Ashley Davies <[email protected]>
- Loading branch information
Showing
14 changed files
with
73 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
terraform/modules/google/cloud-run-endpoint/scripts/esp_full_version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
# Get the full tag of latest ESP image for use in terraform. | ||
# This is required as the gcloud_build_image script tags its built image with | ||
# the version number. | ||
# Optional argument ./esp_full_version <ESP_TAG> | ||
# which is equivalent to setting the -v flag of gcloud_build_image. | ||
|
||
set -e | ||
|
||
BASE_IMAGE_NAME="gcr.io/endpoints-release/endpoints-runtime-serverless" | ||
|
||
function error_exit() { | ||
# ${BASH_SOURCE[1]} is the file name of the caller. | ||
echo "${BASH_SOURCE[1]}: line ${BASH_LINENO[0]}: ${1:-Unknown Error.} (exit ${2:-1})" 1>&2 | ||
exit ${2:-1} | ||
} | ||
|
||
# Use 1st command line arg as ESP_TAG, default to "2" as in gcloud_build_image | ||
ESP_TAG=${1:-"2"} | ||
|
||
ALL_TAGS=$(gcloud container images list-tags "${BASE_IMAGE_NAME}" \ | ||
--filter="tags~^${ESP_TAG}$" \ | ||
--format="value(tags)") | ||
IFS=',' read -ra TAGS_ARRAY <<< "${ALL_TAGS}" | ||
|
||
if [ ${#TAGS_ARRAY[@]} -eq 0 ]; then | ||
error_exit "Did not find ESP version: ${ESP_TAG}" | ||
fi; | ||
|
||
# Find the tag with the longest length. | ||
ESP_FULL_VERSION="" | ||
for tag in "${TAGS_ARRAY[@]}"; do | ||
if [ ${#tag} -gt ${#ESP_FULL_VERSION} ]; then | ||
ESP_FULL_VERSION=${tag} | ||
fi | ||
done | ||
|
||
# Produce JSON object containing esp_full_version | ||
cat <<END | ||
{"esp_full_version": "${ESP_FULL_VERSION}"} | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters