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-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: 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() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf25f79a..d9fd840c 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,11 +27,19 @@ 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 }} + merge-multiple: true + continue-on-error: true + - name: Create GitHub Release uses: softprops/action-gh-release@v2 env: @@ -41,6 +49,7 @@ jobs: tag_name: ${{ inputs.tag }} name: Release ${{ inputs.tag }} generate_release_notes: true + files: actions-artifacts/* package-helm-chart: runs-on: ubuntu-latest