Update xDS client/server image per-branch tag after build (#26955)

* Update xDS client/server image per-branch tag after build

* Address reviewers' comments

* Replace the entire string instead of only prefix

* Update regex

* Update tools/internal_ci/linux/grpc_xds_k8s_install_test_driver.sh

Co-authored-by: Sergii Tkachenko <hi@sergii.org>

Co-authored-by: Sergii Tkachenko <hi@sergii.org>
pull/26964/head
Lidi Zheng 3 years ago committed by GitHub
parent 404e56b2d9
commit 42e30a26d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      tools/internal_ci/linux/grpc_xds_k8s.sh
  2. 17
      tools/internal_ci/linux/grpc_xds_k8s_install_test_driver.sh
  3. 6
      tools/internal_ci/linux/grpc_xds_k8s_python.sh

@ -45,6 +45,11 @@ build_test_app_docker_images() {
gcloud -q auth configure-docker gcloud -q auth configure-docker
docker push "${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" docker push "${CLIENT_IMAGE_NAME}:${GIT_COMMIT}"
docker push "${SERVER_IMAGE_NAME}:${GIT_COMMIT}" docker push "${SERVER_IMAGE_NAME}:${GIT_COMMIT}"
if [[ -n $KOKORO_JOB_NAME ]]; then
branch_name=$(echo "$KOKORO_JOB_NAME" | sed -E 's|^grpc/core/([^/]+)/.*|\1|')
tag_and_push_docker_image "${CLIENT_IMAGE_NAME}" "${GIT_COMMIT}" "${branch_name}"
tag_and_push_docker_image "${SERVER_IMAGE_NAME}" "${GIT_COMMIT}" "${branch_name}"
fi
} }
####################################### #######################################

@ -361,3 +361,20 @@ local_setup_test_driver() {
mkdir -p "${TEST_XML_OUTPUT_DIR}" mkdir -p "${TEST_XML_OUTPUT_DIR}"
} }
#######################################
# Tag and push the given Docker image
# Arguments:
# The Docker image name
# The Docker image original tag name
# The Docker image new tag name
# Outputs:
# Writes the output to stdout, stderr, files
#######################################
tag_and_push_docker_image() {
local image_name="$1"
local from_tag="$2"
local to_tag="$3"
docker tag "${image_name}:${from_tag}" "${image_name}:${to_tag}"
docker push "${image_name}:${to_tag}"
}

@ -59,6 +59,12 @@ build_test_app_docker_images() {
docker push "${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" docker push "${CLIENT_IMAGE_NAME}:${GIT_COMMIT}"
docker push "${SERVER_IMAGE_NAME}:${GIT_COMMIT}" docker push "${SERVER_IMAGE_NAME}:${GIT_COMMIT}"
if [[ -n $KOKORO_JOB_NAME ]]; then
branch_name=$(echo "$KOKORO_JOB_NAME" | sed -E 's|^grpc/core/([^/]+)/.*|\1|')
tag_and_push_docker_image "${CLIENT_IMAGE_NAME}" "${GIT_COMMIT}" "${branch_name}"
tag_and_push_docker_image "${SERVER_IMAGE_NAME}" "${GIT_COMMIT}" "${branch_name}"
fi
} }
####################################### #######################################

Loading…
Cancel
Save