Skip to content

Commit

Permalink
Fix to avoid caching out-of-date images on clusters in e2e testing
Browse files Browse the repository at this point in the history
* Ensures that the ImagePullPolicy is set to Always in the bundle csv to
  avoid target clusters retaining out-of-date cached camel-k images
  • Loading branch information
phantomjinx committed Jan 10, 2022
1 parent 95d404e commit 7d3da2f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/actions/e2e-kubernetes/exec-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST}
export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}

# Will only have an effect if olm=false
# since, for OLM, the csv determines the policy
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"

export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
Expand Down
13 changes: 13 additions & 0 deletions .github/actions/kamel-build-bundle/build-bundle-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ if [ -z "${REGISTRY_PULL_HOST}" ]; then
exit 1
fi

#
# Using a custom single cluster can allow for use-case that old camel-k images are cached
# (see https://cloud.redhat.com/blog/image-garbage-collection-in-openshift). This is not an
# issue on ephemeral clusters like kind.
# Therefore, need to edit the bundle CSV to ensure the ImagePullPolicy of the camel-k image is
# set to "Always" to mandate that the new image is always pulled.
#
# Use kustomize to patch the deployment resource
#
pushd config/manager > /dev/null
kustomize edit add patch --path patch-image-pull-policy-always.yaml --kind Deployment
popd

#
# Build with the PUSH host to ensure the correct image:tag
# for docker to push the image.
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/kamel-preflight-test/preflight-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}

# Will only have an effect if olm=false
# since, for OLM, the csv determine the policy
# since, for OLM, the csv determines the policy.
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"

#
Expand Down

0 comments on commit 7d3da2f

Please # to comment.