-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add kokoro job for verifying presence of docker image (#664)
* chore: add kokoro job for verifying presence of docker image
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
# Configure the docker image for kokoro-trampoline. | ||
env_vars: { | ||
key: "TRAMPOLINE_IMAGE" | ||
value: "gcr.io/cloud-devrel-kokoro-resources/java8" | ||
} | ||
|
||
env_vars: { | ||
key: "TRAMPOLINE_BUILD_FILE" | ||
value: "github/java-shared-config/.kokoro/verify-docker-images.sh" | ||
} |
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,37 @@ | ||
#!/bin/bash | ||
|
||
# Script to verify the presence of GraalVM docker test images tagged with the latest java-shared-config version. | ||
|
||
function fetch_image_names() { | ||
imageNames="$(grep " - gcr.io/cloud-devrel-public-resources/" .cloudbuild/cloudbuild.yaml | cut -d "/" -f 3 | cut -d ":" -f 1)" | ||
export imageNames | ||
echo "$imageNames" | ||
} | ||
|
||
# Get the directory of the build script | ||
scriptDir=$(realpath "$(dirname "${BASH_SOURCE[0]}")") | ||
# cd to the parent directory, i.e. the root of the git repo | ||
cd ${scriptDir}/.. || exit | ||
|
||
# Fetch the java-shared-config version in source of the current commit. | ||
javaSharedConfigVersion="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | ||
|
||
branchName=$(git name-rev "$KOKORO_GIT_COMMIT" | sed 's/.* //') | ||
gitCommitMessage=$(git log -1 "$(git rev-parse --short "$KOKORO_GIT_COMMIT")" | grep "chore(main): release *") | ||
|
||
# GraalVM docker images are not tagged with SNAPSHOT versions. | ||
if [[ "${branchName}" == *"release-please--branches--main"* ]] && [[ ! $gitCommitMessage =~ "SNAPSHOT" ]]; then | ||
imageNames=$(fetch_image_names) | ||
for name in $imageNames; do | ||
fullContainerName="gcr.io/cloud-devrel-public-resources/${name}:${javaSharedConfigVersion}" | ||
echo "Verifying presence of ${fullContainerName}." | ||
gcloud container images describe "${fullContainerName}" > /dev/null; exit_status=$? | ||
if [[ $exit_status = 0 ]]; then | ||
echo "Success. Found $fullContainerName." | ||
fi | ||
done | ||
RETURN_CODE=$? | ||
else | ||
echo "Skipping check for non-release and SNAPSHOT update branches" | ||
exit 0 | ||
fi |