Fixed releases.yaml by pulling images directly from ghcr.io (#5035)

Previously, `releases.yaml` was trying to load images into the kind
clusters but that failed because those images were already in `ghcr.io`
and not in the local docker cache, but that failure was masked.
Unmasking that failure revealed some flaws that this change addresses:

- In `bin/_test_helpers` (used by `bin/tests`), modified the `images`
arg to accept `docker(default)|archive|skip`, for determining how to
load the images into the cluster (if loading them at all)
- In `bin/image-load`, changed arg `images` to `archive` which is more
descriptive.
- Have `kind_integration.yml` call `bin/tests --images archive`.
- Have `release.yml` call `bin/tests --images skip`.
This commit is contained in:
Alejandro Pedraza 2020-10-02 08:05:17 -05:00 committed by GitHub
parent 2b7bc7362a
commit e1772ae183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 21 deletions

View File

@ -145,4 +145,4 @@ jobs:
[[ "$TAG" == "$($HOME/.linkerd version --short --client)" ]]
- name: Run integration tests
run: |
bin/tests --images --name ${{ matrix.integration_test }} "$HOME/.linkerd"
bin/tests --images archive --name ${{ matrix.integration_test }} "$HOME/.linkerd"

View File

@ -130,7 +130,7 @@ jobs:
bin/docker-pull-binaries $TAG
# Validate the CLI version matches the current build tag.
[[ "$TAG" == "$($CMD version --short --client)" ]]
bin/tests --images --name ${{ matrix.integration_test }} "$CMD"
bin/tests --images skip --name ${{ matrix.integration_test }} "$CMD"
arm64_integration_tests:
name: ARM64 integration tests
runs-on: ubuntu-18.04
@ -171,7 +171,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/stable')
env:
RUN_ARM_TEST: 1
run: bin/tests --skip-kind-create "$CMD"
run: bin/tests --images skip --skip-kind-create "$CMD"
- name: CNI tests
if: startsWith(github.ref, 'refs/tags/stable')
run: |

View File

@ -10,7 +10,7 @@ export default_test_names=(deep external-issuer helm-deep helm-upgrade multiclus
export all_test_names=(cluster-domain "${default_test_names[*]}")
handle_input() {
export images=''
export images="docker"
export test_name=''
export skip_cluster_create=''
@ -25,7 +25,7 @@ Optionally specify a test with the --name flag: [${all_test_names[*]}]
Note: The cluster-domain test requires a cluster configuration with a custom cluster domain (see test/configs/cluster-domain.yaml)
Usage:
${0##*/} [--images] [--name test-name] [--skip-cluster-create] /path/to/linkerd
${0##*/} [--images docker|archive|skip] [--name test-name] [--skip-cluster-create] /path/to/linkerd
Examples:
# Run all tests in isolated clusters
@ -39,16 +39,25 @@ Examples:
# Load images from tar files located under the 'image-archives' directory
# Note: This is primarily for CI
${0##*/} --images /path/to/linkerd
${0##*/} --images archive /path/to/linkerd
Available Commands:
--name: the argument to this option is the specific test to run
--skip-cluster-create: skip KinD/k3d cluster creation step and run tests in an existing cluster.
--images: (Primarily for CI) load the images from local .tar files in the current directory."
--images: by default load images into the cluster from the local docker cache (docker), or from tar files located under the 'image-archives' directory (archive), or completely skip image loading (skip)."
exit 0
;;
--images)
images=1
images=$2
if [ -z "$images" ]; then
echo 'Error: the argument for --images was not specified'
exit 1
fi
if [[ $images != "docker" && $images != "archive" && $images != "skip" ]]; then
echo 'Error: the argument for --images was invalid'
exit 1
fi
shift
;;
--name)
test_name=$2
@ -174,6 +183,21 @@ start_test() {
fi
}
image_load() {
cluster_type=$1
cluster_name=$2
case $images in
docker)
"$bindir"/image-load "$cluster_type" "$cluster_name"
exit_on_err "error calling '$bindir/image-load'"
;;
archive)
"$bindir"/image-load "$cluster_type" --archive "$cluster_name"
exit_on_err "error calling '$bindir/image-load'"
;;
esac
}
start_kind_test() {
name=$1
config=$2
@ -182,8 +206,7 @@ start_kind_test() {
test_setup
if [ -z "$skip_cluster_create" ]; then
create_kind_cluster "$name" "$config"
"$bindir"/image-load --kind ${images:+'--images'} "$name"
exit_on_err "error calling '$bindir/image-load'"
image_load --kind "$name"
fi
check_cluster
run_"$name"_test
@ -200,9 +223,9 @@ start_k3d_test() {
test_setup
if [ -z "$skip_cluster_create" ]; then
create_k3d_cluster source multicluster-test
"$bindir"/image-load --k3d ${images:+'--images'} source
image_load --k3d source
create_k3d_cluster target multicluster-test
"$bindir"/image-load --k3d ${images:+'--images'} target
image_load --k3d target
fi
export context="k3d-source"
check_cluster

View File

@ -4,7 +4,7 @@ set -eo pipefail
kind=""
k3d=""
images=""
archive=""
while :
do
@ -13,7 +13,7 @@ do
echo "Load into KinD/k3d the images for Linkerd's proxy, controller, web, grafana, cli-bin, debug and cni-plugin."
echo ""
echo "Usage:"
echo " bin/image-load [--kind] [--k3d] [--images]"
echo " bin/image-load [--kind] [--k3d] [--archive]"
echo ""
echo "Examples:"
echo ""
@ -21,12 +21,12 @@ do
echo " bin/image-load"
echo ""
echo " # Load images from tar files located under the 'image-archives' directory into k3d"
echo " bin/image-load --k3d --images"
echo " bin/image-load --k3d --archive"
echo ""
echo "Available Commands:"
echo " --kind: use a KinD cluster (default)."
echo " --k3d: use a k3d cluster."
echo " --images: Load the images from local .tar files in the current directory."
echo " --archive: load the images from local .tar files in the current directory."
exit 0
;;
--kind)
@ -35,8 +35,8 @@ do
--k3d)
k3d=1
;;
--images)
images=1
--archive)
archive=1
;;
*)
break
@ -59,14 +59,14 @@ else
kind=1
cluster=${1:-"kind"}
bin="$bindir"/kind
if [ $images ]; then
if [ $archive ]; then
image_sub_cmd=(load image-archive --name "$cluster")
else
image_sub_cmd=(load docker-image --name "$cluster")
fi
fi
if [ -z "$images" ]; then
if [ -z "$archive" ]; then
# shellcheck source=_tag.sh
. "$bindir"/_tag.sh
# shellcheck source=_docker.sh
@ -80,7 +80,7 @@ fi
rm -f load_fail
for img in proxy controller web grafana cli-bin debug cni-plugin ; do
if [ $images ]; then
if [ $archive ]; then
param="image-archives/$img.tar"
else
param="$DOCKER_REGISTRY/$img:$TAG"