From 987a3110dc8c922a302b194fcb75c7e013e82930 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Fri, 18 Oct 2024 11:22:13 -0700 Subject: [PATCH 1/2] test: require ceph tag param to replace_ceph_image To prevent silent failures where the ceph image tag is not updated. Signed-off-by: Joshua Hoblitt (cherry picked from commit 100c8bd7a99120f176ef3ccac627025ed5269bf2) --- tests/scripts/github-action-helper.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/scripts/github-action-helper.sh b/tests/scripts/github-action-helper.sh index 4b36bd78e..275355624 100755 --- a/tests/scripts/github-action-helper.sh +++ b/tests/scripts/github-action-helper.sh @@ -265,12 +265,15 @@ function deploy_toolbox() { } function replace_ceph_image() { - local file="$1" # parameter 1: the file in which to replace the ceph image - local ceph_image="${2:-}" # parameter 2: the new ceph image to use - if [[ -z ${ceph_image} ]]; then - echo "No Ceph image given. Not adjusting manifests." - return 0 + local file="$1" # parameter 1: the file in which to replace the ceph image + local ceph_image="${2?ceph_image is required}" # parameter 2: the new ceph image to use + + # check for ceph_image being an empty string + if [ -z "$ceph_image" ]; then + echo "ceph_image may not be an empty string" + exit 1 fi + sed -i "s|image: .*ceph/ceph:.*|image: ${ceph_image}|g" "${file}" } From 251c7b432beceab3009cc6ce28387a4923fd2256 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Fri, 18 Oct 2024 10:40:58 -0700 Subject: [PATCH 2/2] test: fix ceph image tag used by most canary tests Fix ceph image tag string passed to replica_ceph_image. Previously, the result was "" was being passed in most cases. Signed-off-by: Joshua Hoblitt (cherry picked from commit 84694397bc536cae96526986cff4fc76782faf04) --- .github/workflows/canary-integration-test.yml | 54 ++++++++----------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/.github/workflows/canary-integration-test.yml b/.github/workflows/canary-integration-test.yml index 528a43a14..e8e5965d1 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -347,7 +347,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: validate-yaml run: tests/scripts/github-action-helper.sh validate_yaml @@ -424,7 +424,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: validate-yaml run: tests/scripts/github-action-helper.sh validate_yaml @@ -525,7 +525,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: validate-yaml run: tests/scripts/github-action-helper.sh validate_yaml @@ -583,7 +583,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: validate-yaml run: tests/scripts/github-action-helper.sh validate_yaml @@ -635,7 +635,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: validate-yaml run: tests/scripts/github-action-helper.sh validate_yaml @@ -692,7 +692,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: use local disk and create partitions for osds run: | @@ -768,7 +768,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: use local disk run: tests/scripts/github-action-helper.sh use_local_disk @@ -820,7 +820,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: use local disk run: tests/scripts/github-action-helper.sh use_local_disk @@ -875,7 +875,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: use local disk and create partitions for osds run: | @@ -943,7 +943,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: use local disk run: tests/scripts/github-action-helper.sh use_local_disk @@ -997,7 +997,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: use local disk run: tests/scripts/github-action-helper.sh use_local_disk @@ -1061,7 +1061,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: use local disk and create partitions for osds run: | @@ -1147,7 +1147,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: use local disk and create partitions for osds run: | @@ -1213,7 +1213,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "tests/manifests/test-cluster-on-pvc-encrypted.yaml" "${{ matrix.ceph-image }}" - name: create cluster prerequisites run: tests/scripts/github-action-helper.sh create_cluster_prerequisites @@ -1270,7 +1270,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: use local disk into two partitions run: | @@ -1525,12 +1525,12 @@ jobs: with: use-tmate: ${{ secrets.USE_TMATE }} - - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" - - name: setup cluster resources uses: ./.github/workflows/canary-test-config + - name: set Ceph version in CephCluster manifest + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" + - name: install additional deps for object testing shell: bash --noprofile --norc -eo pipefail -x {0} run: | @@ -1658,19 +1658,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" - - - name: install deps - shell: bash --noprofile --norc -eo pipefail -x {0} - run: tests/scripts/github-action-helper.sh install_deps - - - name: print k8s cluster status - shell: bash --noprofile --norc -eo pipefail -x {0} - run: tests/scripts/github-action-helper.sh print_k8s_cluster_status - - - name: build rook - shell: bash --noprofile --norc -eo pipefail -x {0} - run: tests/scripts/github-action-helper.sh build_rook + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: allow holder pod deployment run: sed -i "s|CSI_DISABLE_HOLDER_PODS|# CSI_DISABLE_HOLDER_PODS|g" "deploy/examples/operator.yaml" @@ -1744,7 +1732,7 @@ jobs: run: sed -i "s|CSI_DISABLE_HOLDER_PODS|# CSI_DISABLE_HOLDER_PODS|g" "deploy/examples/operator.yaml" - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: use local disk and create partitions for osds run: | @@ -1799,7 +1787,7 @@ jobs: uses: ./.github/workflows/canary-test-config - name: set Ceph version in CephCluster manifest - run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ github.event.inputs.ceph-image }}" + run: tests/scripts/github-action-helper.sh replace_ceph_image "deploy/examples/cluster-test.yaml" "${{ matrix.ceph-image }}" - name: validate-yaml run: tests/scripts/github-action-helper.sh validate_yaml