Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COSI-43: add smoke test for helm install and update a CI step name #16

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .github/scripts/capture_k8s_logs.sh
100644 → 100755
Empty file.
21 changes: 21 additions & 0 deletions .github/scripts/verify_helm_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/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

echo "Verifying COSI driver Pod status for 120s..."
if ! kubectl wait --namespace $NAMESPACE --for=condition=ready pod --selector=app.kubernetes.io/name=scality-cosi-driver --timeout=120s; 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."
Empty file modified .github/scripts/wait_for_local_port.bash
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build-and-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -50,7 +51,6 @@ jobs:
- name: Setup COSI Controller, CRDs and Driver
run: |
pwd
chmod +x .github/scripts/setup_cosi_resources.sh
.github/scripts/setup_cosi_resources.sh

- name: Login to Registry
Expand Down Expand Up @@ -99,7 +99,6 @@ jobs:
- name: E2E tests for bucket creation via COSI driver
run: |
pwd
chmod +x .github/scripts/e2e_test_bucket_creation.sh
.github/scripts/e2e_test_bucket_creation.sh

- name: "Delay completion"
Expand All @@ -123,13 +122,11 @@ jobs:

- name: Capture Kubernetes Logs in artifacts directory
run: |
chmod +x .github/scripts/capture_k8s_logs.sh
.github/scripts/capture_k8s_logs.sh
if: always()

- name: Cleanup COSI CRDs, Controller, and Driver
run: |
chmod +x .github/scripts/cleanup_cosi_resources.sh
.github/scripts/cleanup_cosi_resources.sh
if: always()

Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/ci-smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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/[email protected]
with:
version: v3.16.3

- name: Create Kind Cluster
uses: helm/[email protected]
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: |
.github/scripts/verify_helm_install.sh

- name: "Delay completion"
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
uses: scality/actions/[email protected]
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()
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
default: false

jobs:
prod-container-build:
prod-container-with-docker:
permissions:
contents: read
packages: write
Expand All @@ -27,7 +27,7 @@ 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
Expand Down
3 changes: 0 additions & 3 deletions docs/development/dev-container-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ In the integrated terminal inside VS Code, run the following commands to set up
```bash
eval $(minikube docker-env)

chmod +x .github/scripts/setup_cosi_resources.sh
.github/scripts/setup_cosi_resources.sh
```

Expand All @@ -79,7 +78,6 @@ In the integrated terminal inside VS Code, run the following commands to set up
```bash
eval $(minikube docker-env -u)

chmod +x .github/scripts/e2e_test_bucket_creation.sh
.github/scripts/e2e_test_bucket_creation.sh
```

Expand Down Expand Up @@ -137,6 +135,5 @@ To clean up resources after development or testing:
```bash
eval $(minikube docker-env)

chmod +x .github/scripts/cleanup_cosi_resources.sh
.github/scripts/cleanup_cosi_resources.sh
```
Loading