From 14207ae0c56f66b971906810524648b2aa2df520 Mon Sep 17 00:00:00 2001 From: Anurag Mittal Date: Thu, 14 Nov 2024 05:58:47 +0100 Subject: [PATCH 1/5] COSI-43: add-test-for-install-using-helm-charts --- .github/scripts/verify_helm_install.sh | 26 ++++++++ .github/workflows/ci-smoke-tests.yml | 87 ++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 .github/scripts/verify_helm_install.sh create mode 100644 .github/workflows/ci-smoke-tests.yml diff --git a/.github/scripts/verify_helm_install.sh b/.github/scripts/verify_helm_install.sh new file mode 100644 index 00000000..d4c8dfba --- /dev/null +++ b/.github/scripts/verify_helm_install.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +NAMESPACE="scality-object-storage" + +echo "Verifying Helm installation..." + +if ! helm status scality-cosi-driver -n $NAMESPACE; then + echo "Helm release scality-cosi-driver not found in namespace $NAMESPACE" + exit 1 +fi + +if ! kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=scality-cosi-driver -n $NAMESPACE --timeout=120s; then + echo "One or more pods failed to start within the expected time" + exit 1 +fi + +echo "Verifying COSI driver Pod status..." +if ! kubectl wait --namespace $NAMESPACE --for=condition=ready pod --selector=app.kubernetes.io/name=scality-cosi-driver --timeout=30s; then + echo "Error: COSI driver Pod did not reach ready state." + kubectl get pods -n $NAMESPACE + exit 1 +fi +kubectl get pods -n $NAMESPACE + +echo "Helm installation verified successfully." diff --git a/.github/workflows/ci-smoke-tests.yml b/.github/workflows/ci-smoke-tests.yml new file mode 100644 index 00000000..fd3684c1 --- /dev/null +++ b/.github/workflows/ci-smoke-tests.yml @@ -0,0 +1,87 @@ +name: CI Smoke Tests + +on: + push: + branches: + - '**' + workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: 'Run the build with tmate debugging enabled' + required: false + default: false + debug_delay_duration_minutes: + type: number + description: 'Duration to delay job completion in minutes' + required: false + default: 5 + +jobs: + smoke-test-installation-with-helm: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.16.3 + + - name: Create Kind Cluster + uses: helm/kind-action@v1.10.0 + with: + version: v0.21.0 + wait: 90s + cluster_name: helm-test-cluster + + - name: "Debug: SSH to runner" + uses: scality/actions/action-ssh-to-runner@v1 + with: + tmate-server-host: ${{ secrets.TMATE_SERVER_HOST }} + tmate-server-port: ${{ secrets.TMATE_SERVER_PORT }} + tmate-server-rsa-fingerprint: ${{ secrets.TMATE_SERVER_RSA_FINGERPRINT }} + tmate-server-ed25519-fingerprint: ${{ secrets.TMATE_SERVER_ED25519_FINGERPRINT }} + detached: true + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + timeout-minutes: 10 + continue-on-error: true + + - name: Build COSI Driver Docker Image + run: | + make container + + - name: Load Docker Image into Kind Cluster + run: | + kind load docker-image ghcr.io/scality/cosi-driver:latest --name helm-test-cluster + + - name: Install Scality COSI Helm Chart + run: | + helm install scality-cosi-driver ./helm/scality-cosi-driver \ + --namespace scality-object-storage \ + --create-namespace \ + --set image.tag=latest + + - name: Print all resources in scality-object-storage namespace + run: | + kubectl get all -n scality-object-storage + + - name: Verify Helm Installation + run: | + chmod +x .github/scripts/verify_helm_install.sh + .github/scripts/verify_helm_install.sh + + - name: "Delay completion" + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + uses: scality/actions/action-delay-job-completion@1.11.0 + with: + completion_delay_m: ${{ inputs.debug_delay_duration_minutes }} + continue-on-error: true + + - name: Cleanup Helm Release and Namespace + run: | + helm uninstall scality-cosi-driver -n scality-object-storage + kubectl delete namespace scality-object-storage + if: always() From 80e6b86a4b8845be2e965742adae9257cfbd5329 Mon Sep 17 00:00:00 2001 From: Anurag Mittal Date: Thu, 14 Nov 2024 06:45:58 +0100 Subject: [PATCH 2/5] COSI-43: keeping-naming-convention-consistency --- .github/workflows/ci-build-and-unit-tests.yml | 2 +- .github/workflows/ci-e2e-tests.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build-and-unit-tests.yml b/.github/workflows/ci-build-and-unit-tests.yml index 7bf0e8d9..70b0eb25 100644 --- a/.github/workflows/ci-build-and-unit-tests.yml +++ b/.github/workflows/ci-build-and-unit-tests.yml @@ -35,7 +35,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} slug: scality/cosi-driver - dev-container-build: + dev-container-with-docker: permissions: contents: read packages: write diff --git a/.github/workflows/ci-e2e-tests.yml b/.github/workflows/ci-e2e-tests.yml index 466e1b12..9fd39251 100644 --- a/.github/workflows/ci-e2e-tests.yml +++ b/.github/workflows/ci-e2e-tests.yml @@ -35,6 +35,7 @@ jobs: run: | kubectl cluster-info kubectl get nodes + - name: "Debug: SSH to runner" uses: scality/actions/action-ssh-to-runner@v1 with: From 76de3811167d9e3d8c7804ed4f3fddaaddc3326b Mon Sep 17 00:00:00 2001 From: Anurag Mittal Date: Thu, 14 Nov 2024 08:20:32 +0100 Subject: [PATCH 3/5] COSI-43: Add-helm-packages-in-release --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf25f79a..02d5cb6b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,10 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v4 + - name: Download all workflow run artifacts + uses: actions/download-artifact@v4 + with: + path: ./actions-artifacts - name: Create GitHub Release uses: softprops/action-gh-release@v2 @@ -41,6 +45,7 @@ jobs: tag_name: ${{ inputs.tag }} name: Release ${{ inputs.tag }} generate_release_notes: true + files: ./actions-artifacts/* package-helm-chart: runs-on: ubuntu-latest From c5326555235f125f061d88518d249795c909d3e3 Mon Sep 17 00:00:00 2001 From: Anurag Mittal Date: Thu, 14 Nov 2024 08:28:30 +0100 Subject: [PATCH 4/5] added conitnue on error for download --- .github/workflows/release.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02d5cb6b..0bb2cf39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ on: default: false jobs: - prod-container-build: + prod-container-with-docker: permissions: contents: read packages: write @@ -27,14 +27,17 @@ jobs: create-github-release: runs-on: ubuntu-latest - needs: [prod-container-build, package-helm-chart] + needs: [prod-container-with-docker, package-helm-chart] steps: - name: Check out repository uses: actions/checkout@v4 + - name: Download all workflow run artifacts uses: actions/download-artifact@v4 with: path: ./actions-artifacts + github-token: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true - name: Create GitHub Release uses: softprops/action-gh-release@v2 From 34f73744204f86caccebef59b4d6e264dd5949c5 Mon Sep 17 00:00:00 2001 From: Anurag Mittal Date: Thu, 14 Nov 2024 08:56:35 +0100 Subject: [PATCH 5/5] updated release --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0bb2cf39..d9fd840c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,8 +35,9 @@ jobs: - name: Download all workflow run artifacts uses: actions/download-artifact@v4 with: - path: ./actions-artifacts + path: actions-artifacts github-token: ${{ secrets.GITHUB_TOKEN }} + merge-multiple: true continue-on-error: true - name: Create GitHub Release @@ -48,7 +49,7 @@ jobs: tag_name: ${{ inputs.tag }} name: Release ${{ inputs.tag }} generate_release_notes: true - files: ./actions-artifacts/* + files: actions-artifacts/* package-helm-chart: runs-on: ubuntu-latest