Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Make upload test images simpler #263

Merged
merged 1 commit into from
Mar 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions test/upload-test-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@

set -o errexit

# TODO(https://github.com/knative/test-infra/issues/590): Create a common way of uploading images
function upload_test_images() {
echo ">> Publishing test images"
local image_dirs="$(find $(dirname $0)/test_images -mindepth 1 -maxdepth 1 -type d)"
local image_dir="$(dirname $0)/test_images"
local docker_tag=$1
local tag_option=""
if [ -n "${docker_tag}" ]; then
tag_option="--tags $docker_tag,latest"
fi

for image_dir in ${image_dirs}; do
local image_name="$(basename ${image_dir})"
local image="github.com/knative/eventing-sources/test/test_images/${image_name}"
ko publish -B ${image}
if [ -n "$docker_tag" ]; then
image=$KO_DOCKER_REPO/${image_name}
local digest=$(gcloud container images list-tags --filter="tags:latest" --format='get(digest)' ${image})
echo "Tagging ${image}@${digest} with $docker_tag"
gcloud -q container images add-tag ${image}@${digest} ${image}:$docker_tag
fi
done
# ko resolve is being used for the side-effect of publishing images,
# so the resulting yaml produced is ignored.
ko resolve ${tag_option} -RBf "${image_dir}" > /dev/null
}

: ${KO_DOCKER_REPO:?"You must set 'KO_DOCKER_REPO', see DEVELOPMENT.md"}
Expand Down