This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit d0c97e8cc80ee3d563487f3361bcd64f343245ee Author: phantomjinx <[email protected]> AuthorDate: Fri Jan 7 23:28:06 2022 +0000 Fix to avoid caching out-of-date images on clusters in e2e testing * Ensures that the ImagePullPolicy is set to Always in the bundle csv to avoid target clusters retaining out-of-date cached camel-k images --- .github/actions/e2e-kubernetes/exec-tests.sh | 5 +++++ .github/actions/kamel-build-bundle/build-bundle-image.sh | 13 +++++++++++++ .github/actions/kamel-preflight-test/preflight-test.sh | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/actions/e2e-kubernetes/exec-tests.sh b/.github/actions/e2e-kubernetes/exec-tests.sh index b3311a5..b20cf6b 100755 --- a/.github/actions/e2e-kubernetes/exec-tests.sh +++ b/.github/actions/e2e-kubernetes/exec-tests.sh @@ -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} diff --git a/.github/actions/kamel-build-bundle/build-bundle-image.sh b/.github/actions/kamel-build-bundle/build-bundle-image.sh index 4844499..ff5aef7 100755 --- a/.github/actions/kamel-build-bundle/build-bundle-image.sh +++ b/.github/actions/kamel-build-bundle/build-bundle-image.sh @@ -87,6 +87,19 @@ if [ -z "${REGISTRY_PULL_HOST}" ]; then 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. # diff --git a/.github/actions/kamel-preflight-test/preflight-test.sh b/.github/actions/kamel-preflight-test/preflight-test.sh index 4061d30..bacae0b 100755 --- a/.github/actions/kamel-preflight-test/preflight-test.sh +++ b/.github/actions/kamel-preflight-test/preflight-test.sh @@ -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" #
