This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit e039e22e065675fd6d56860eee688e01fbdfdfaf Author: Pasquale Congiusti <[email protected]> AuthorDate: Mon Aug 12 12:44:27 2024 +0200 chore(ci): move OLM test as nightly --- .github/workflows/install.yml | 21 ------ .../{install.yml => nightly-install-olm.yml} | 80 +++++++--------------- e2e/install/helm/setup_test.go | 14 ++-- e2e/install/kustomize/setup_test.go | 2 - e2e/install/olm/olm_install_test.go | 8 ++- e2e/install/upgrade/upgrade_test.go | 8 ++- script/Makefile | 11 ++- 7 files changed, 55 insertions(+), 89 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index f7078e812..c1fad2c50 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -83,27 +83,6 @@ jobs: run: | make release-helm - - name: Install OLM - shell: bash - run: | - kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.28.0/crds.yaml - kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.28.0/olm.yaml - kubectl wait --for=jsonpath='{.status.phase}'=Succeeded csv packageserver -n olm --timeout=2m - - - name: Login to staging container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push OLM bundle - shell: bash - run: | - echo "BUNDLE_IMAGE_NAME=ghcr.io/${{ github.actor }}/camel-k-bundle" >> $GITHUB_ENV - echo "Setting bundle image name as as $BUNDLE_IMAGE_NAME which is required by OLM tests" - BUNDLE_IMAGE_NAME=ghcr.io/${{ github.actor }}/camel-k-bundle make bundle-push - - name: Run tests shell: bash run: | diff --git a/.github/workflows/install.yml b/.github/workflows/nightly-install-olm.yml similarity index 56% copy from .github/workflows/install.yml copy to .github/workflows/nightly-install-olm.yml index f7078e812..1ae89d381 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/nightly-install-olm.yml @@ -1,3 +1,5 @@ +--- # --------------------------------------------------------------------------- + # --------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -15,74 +17,39 @@ # limitations under the License. # --------------------------------------------------------------------------- -name: install +# TODO: follow up the evolution of https://github.com/operator-framework/operator-sdk/issues/6699 +# and move into a normal test once it is possible for the operator-sdk to test local bundles +name: Nightly OLM test + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CAMEL_K_TEST_TIMEOUT_SHORT: 5m - CAMEL_K_TEST_TIMEOUT_MEDIUM: 10m on: - pull_request: - branches: - - main - - "release-*" - paths-ignore: - - 'docs/**' - - 'java/**' - - 'proposals/**' - - '**.adoc' - - '**.md' - - 'KEYS' - - 'LICENSE' - - 'NOTICE' - push: - branches: - - main - - "release-*" - paths-ignore: - - 'docs/**' - - 'java/**' - - 'proposals/**' - - '**.adoc' - - '**.md' - - 'KEYS' - - 'LICENSE' - - 'NOTICE' + schedule: + - cron: "15 1 * * *" workflow_dispatch: -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: true - jobs: - install-and-upgrade: + release: + strategy: + fail-fast: false + matrix: + ref-branch: [main, release-2.3.x, release-2.4.x] + + if: github.repository == 'apache/camel-k' runs-on: ubuntu-latest steps: - - - name: Checkout code + - name: "Checkout code" uses: actions/checkout@v4 with: + ref: ${{ matrix.ref-branch }} persist-credentials: false submodules: recursive - name: Infra setting uses: ./.github/actions/infra-setting - - name: Install Helm - shell: bash - run: | - curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null - sudo apt-get install apt-transport-https --yes - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list - sudo apt-get update - sudo apt-get install helm - - - name: Build Helm chart - shell: bash - run: | - make release-helm - - name: Install OLM shell: bash run: | @@ -90,21 +57,22 @@ jobs: kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.28.0/olm.yaml kubectl wait --for=jsonpath='{.status.phase}'=Succeeded csv packageserver -n olm --timeout=2m + # Building and pushing a bundle to a running container is required due to how + # Operator-SDK works. Once it allows for local bundle testing, this part may be omitted - name: Login to staging container registry uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.TEST_DOCKER_HUB_USERNAME }} + password: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }} - name: Build and push OLM bundle shell: bash run: | - echo "BUNDLE_IMAGE_NAME=ghcr.io/${{ github.actor }}/camel-k-bundle" >> $GITHUB_ENV + echo "BUNDLE_IMAGE_NAME=docker.io/testcamelk/camel-k-bundle" >> $GITHUB_ENV echo "Setting bundle image name as as $BUNDLE_IMAGE_NAME which is required by OLM tests" - BUNDLE_IMAGE_NAME=ghcr.io/${{ github.actor }}/camel-k-bundle make bundle-push + BUNDLE_IMAGE_NAME=docker.io/testcamelk/camel-k-bundle make bundle-push - name: Run tests shell: bash run: | - DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-install + DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-install-olm diff --git a/e2e/install/helm/setup_test.go b/e2e/install/helm/setup_test.go index a3e9a2efd..f9c25b38b 100644 --- a/e2e/install/helm/setup_test.go +++ b/e2e/install/helm/setup_test.go @@ -63,6 +63,8 @@ func TestHelmInstallation(t *testing.T) { "--force", ), ) + // Refresh the test client to account for the newly installed CRDs + RefreshClient(t) g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil()) // Check if restricted security context has been applied @@ -74,10 +76,9 @@ func TestHelmInstallation(t *testing.T) { // Test a simple route t.Run("simple route", func(t *testing.T) { - name := RandomizedSuffixName("yaml") - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml", "--name", name).Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationLogs(t, ctx, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed()) + g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + g.Eventually(IntegrationLogs(t, ctx, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) }) ExpectExecSucceed(t, g, @@ -91,5 +92,10 @@ func TestHelmInstallation(t *testing.T) { ) g.Eventually(OperatorPod(t, ctx, ns)).Should(BeNil()) + + // Test CRD uninstall (will remove Integrations as well) + UninstallCRDs(t, ctx, g, "../../../") + + g.Eventually(CRDs(t)).Should(BeNil()) }) } diff --git a/e2e/install/kustomize/setup_test.go b/e2e/install/kustomize/setup_test.go index 926ab1d68..78114bd69 100644 --- a/e2e/install/kustomize/setup_test.go +++ b/e2e/install/kustomize/setup_test.go @@ -117,7 +117,6 @@ func TestKustomizeNamespaced(t *testing.T) { UninstallCRDs(t, ctx, g, "../../../") g.Eventually(OperatorPod(t, ctx, ns)).Should(BeNil()) - g.Eventually(Integration(t, ctx, ns, "yaml"), TestTimeoutShort).Should(BeNil()) g.Eventually(CRDs(t)).Should(BeNil()) }) } @@ -219,7 +218,6 @@ func TestKustomizeDescoped(t *testing.T) { UninstallCRDs(t, ctx, g, "../../../") g.Eventually(OperatorPod(t, ctx, ns)).Should(BeNil()) - g.Eventually(Integration(t, ctx, nsIntegration, "yaml"), TestTimeoutShort).Should(BeNil()) g.Eventually(CRDs(t)).Should(BeNil()) }) }) diff --git a/e2e/install/olm/olm_install_test.go b/e2e/install/olm/olm_install_test.go index 31d7f322d..5f6b6f7d2 100644 --- a/e2e/install/olm/olm_install_test.go +++ b/e2e/install/olm/olm_install_test.go @@ -63,6 +63,8 @@ func TestOLMInstallation(t *testing.T) { ), "180s", ) + // Refresh the test client to account for the newly installed CRDs + RefreshClient(t) // Find the only one Camel K CSV noAdditionalConditions := func(csv olm.ClusterServiceVersion) bool { return true @@ -73,8 +75,6 @@ func TestOLMInstallation(t *testing.T) { g.Eventually(OperatorPodPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(OperatorImage(t, ctx, ns), TestTimeoutShort).Should(Equal(defaults.OperatorImage())) - // This is required in order to wait the availability of IntegrationPlatform CRDs - g.Eventually(CRDs(t)).Should(HaveLen(ExpectedCRDs)) // Check the IntegrationPlatform has been reconciled after setting the expected container registry g.Expect(UpdatePlatform(t, ctx, ns, func(ip *v1.IntegrationPlatform) { ip.Spec.Build.Registry.Address = containerRegistry @@ -105,5 +105,9 @@ func TestOLMInstallation(t *testing.T) { g.Consistently( IntegrationConditionStatus(t, ctx, ns, "yaml", v1.IntegrationConditionReady), 15*time.Second, 5*time.Second). Should(Equal(corev1.ConditionTrue)) + + // Test CRD uninstall (will remove Integrations as well) + UninstallCRDs(t, ctx, g, "../../../") + g.Eventually(CRDs(t)).Should(BeNil()) }) } diff --git a/e2e/install/upgrade/upgrade_test.go b/e2e/install/upgrade/upgrade_test.go index 28d6ad76c..50903ccc0 100644 --- a/e2e/install/upgrade/upgrade_test.go +++ b/e2e/install/upgrade/upgrade_test.go @@ -78,13 +78,15 @@ func TestUpgrade(t *testing.T) { installPrevCmd.Dir = lastVersionDir ExpectExecSucceed(t, g, installPrevCmd) + // Refresh the test client to account for the newly installed CRDs + RefreshClient(t) // Check the operator image is the previous one g.Eventually(OperatorImage(t, ctx, ns)).Should(ContainSubstring(lastVersion)) // Check the operator pod is running g.Eventually(OperatorPodPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) // Check the IntegrationPlatform has been reconciled - g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) - g.Eventually(PlatformVersion(t, ctx, ns), TestTimeoutMedium).Should(Equal(lastVersion)) + g.Eventually(PlatformPhase(t, ctx, ns)).Should(Equal(v1.IntegrationPlatformPhaseReady)) + g.Eventually(PlatformVersion(t, ctx, ns)).Should(Equal(lastVersion)) // We need a different namespace from the global operator WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsIntegration string) { @@ -105,6 +107,8 @@ func TestUpgrade(t *testing.T) { ) installNextCmd.Dir = "../../.." ExpectExecSucceed(t, g, installNextCmd) + // Refresh the test client to account for the newly installed CRDs + RefreshClient(t) // Check the operator image is the current built one g.Eventually(OperatorImage(t, ctx, ns)).Should(ContainSubstring(defaults.Version)) diff --git a/script/Makefile b/script/Makefile index 846228650..68391a750 100644 --- a/script/Makefile +++ b/script/Makefile @@ -301,16 +301,23 @@ test-advanced: exit $${FAILED} # -# Installation procedure test using CLi and Kustomize methodologies +# Installation and upgrade procedure test using # test-install: FAILED=0; \ go test -timeout 20m -v ./e2e/install/kustomize -tags=integration $(GOTESTFMT) || ((FAILED++)); \ go test -timeout 20m -v ./e2e/install/helm -tags=integration $(GOTESTFMT) || ((FAILED++)); \ - go test -timeout 20m -v ./e2e/install/olm -tags=integration $(GOTESTFMT) || ((FAILED++)); \ go test -timeout 60m -v ./e2e/install/upgrade -tags=integration $(GOTESTFMT) || ((FAILED++)); \ exit $${FAILED} +# +# Installation procedure test via OLM +# +test-install-olm: + FAILED=0; \ + go test -timeout 20m -v ./e2e/install/olm -tags=integration $(GOTESTFMT) || ((FAILED++)); \ + exit $${FAILED} + # # Knative tests that require the presence of Knative configuration #
