Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 737a340

Browse files
committed
COSI-11: deploy-COSI-resources-in-CI
- added a script for setting up the COSI driver - added a new workflow step to run the script
1 parent a62e8d9 commit 737a340

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Define log file for debugging
5+
LOG_FILE=".github/e2e_tests/artifacts/logs/kind_cluster_logs/cosi_deployment/setup_debug.log"
6+
mkdir -p "$(dirname "$LOG_FILE")" # Ensure the log directory exists
7+
8+
# Error handling function
9+
error_handler() {
10+
echo "An error occurred during the COSI setup. Check the log file for details." | tee -a "$LOG_FILE"
11+
echo "Failed command: $BASH_COMMAND" | tee -a "$LOG_FILE"
12+
exit 1
13+
}
14+
15+
# Trap errors and call the error handler
16+
trap 'error_handler' ERR
17+
18+
# Log command execution to the log file for debugging
19+
log_and_run() {
20+
echo "Running: $*" | tee -a "$LOG_FILE"
21+
"$@" | tee -a "$LOG_FILE"
22+
}
23+
24+
# Step 1: Install COSI CRDs
25+
log_and_run echo "Installing COSI CRDs..."
26+
log_and_run kubectl create -k github.com/kubernetes-sigs/container-object-storage-interface-api
27+
log_and_run kubectl create -k github.com/kubernetes-sigs/container-object-storage-interface-controller
28+
29+
# Step 2: Verify COSI Controller Pod Status
30+
log_and_run echo "Verifying COSI Controller Pod status..."
31+
log_and_run kubectl wait --namespace default --for=condition=ready pod -l app.kubernetes.io/name=container-object-storage-interface-controller --timeout=10s
32+
log_and_run kubectl get pods --namespace default
33+
34+
# Step 3: Build COSI driver Docker image
35+
log_and_run echo "Building COSI driver image..."
36+
log_and_run docker build -t ghcr.io/scality/cosi:latest .
37+
38+
# Step 4: Load COSI driver image into KIND cluster
39+
log_and_run echo "Loading COSI driver image into KIND cluster..."
40+
log_and_run kind load docker-image ghcr.io/scality/cosi:latest --name object-storage-cluster
41+
42+
# Step 5: Run COSI driver
43+
log_and_run echo "Applying COSI driver manifests..."
44+
log_and_run kubectl apply -k .
45+
46+
# Step 6: Verify COSI driver Pod Status
47+
log_and_run echo "Verifying COSI driver Pod status..."
48+
log_and_run kubectl wait --namespace scality-object-storage --for=condition=ready pod --selector=app.kubernetes.io/name=scality-cosi-driver --timeout=20s
49+
log_and_run kubectl get pods -n scality-object-storage
50+
51+
log_and_run echo "COSI setup completed successfully."

.github/workflows/ci-e2e-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ jobs:
3737
with:
3838
detached: true
3939

40+
41+
- name: Setup COSI Controller, CRDs and Driver
42+
run: |
43+
pwd
44+
chmod +x .github/scripts/setup_cosi_resources.sh
45+
.github/scripts/setup_cosi_resources.sh
46+
4047
- name: Capture Kubernetes Logs in artifacts directory
4148
run: |
4249
chmod +x .github/scripts/capture_k8s_logs.sh

0 commit comments

Comments
 (0)