Skip to content

Commit

Permalink
ci: use helm chart for ci tests
Browse files Browse the repository at this point in the history
Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
  • Loading branch information
niladrih committed Apr 10, 2024
1 parent 0bba34c commit 14b7452
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ jobs:
cni: calico
start-args: '--install-addons=false'

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.14.3

- name: Setting environment variables
run: |
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ jobs:
cni: calico
start-args: '--install-addons=false'

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.14.3

- name: Setting environment variables
run: |
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
Expand Down
23 changes: 11 additions & 12 deletions ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,37 @@

set -e

ZFS_OPERATOR=deploy/zfs-operator.yaml
ZFS_CHART=deploy/helm/charts
SNAP_CLASS=deploy/sample/zfssnapclass.yaml

Check warning on line 19 in ci/ci-test.sh

View workflow job for this annotation

GitHub Actions / lint

[shellcheck] reported by reviewdog 🐶 SNAP_CLASS appears unused. Verify use (or export if used externally). [SC2034](https://github.com/koalaman/shellcheck/wiki/SC2034) Raw Output: ./ci/ci-test.sh:19:1:warning:SNAP_CLASS appears unused. Verify use (or export if used externally). [SC2034](https://github.com/koalaman/shellcheck/wiki/SC2034)

TEST_DIR="tests"


# Prepare env for runnging BDD tests
# Minikube is already running
kubectl apply -f $ZFS_OPERATOR
kubectl apply -f $SNAP_CLASS
helm install openebs-zfslocalpv "$ZFS_CHART" -n openebs --create-namespace --dependency-update --set analytics.enabled=false

dumpAgentLogs() {
NR=$1
AgentPOD=$(kubectl get pods -l app=openebs-zfs-node -o jsonpath='{.items[0].metadata.name}' -n kube-system)
kubectl describe po $AgentPOD -n kube-system
AgentPOD=$(kubectl get pods -l app=openebs-zfs-node -o jsonpath='{.items[0].metadata.name}' -n openebs)
kubectl describe po $AgentPOD -n openebs

Check warning on line 31 in ci/ci-test.sh

View workflow job for this annotation

GitHub Actions / lint

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./ci/ci-test.sh:31:23:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)
printf "\n\n"
kubectl logs --tail=${NR} $AgentPOD -n kube-system -c openebs-zfs-plugin
kubectl logs --tail=${NR} $AgentPOD -n openebs -c openebs-zfs-plugin

Check warning on line 33 in ci/ci-test.sh

View workflow job for this annotation

GitHub Actions / lint

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./ci/ci-test.sh:33:23:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check warning on line 33 in ci/ci-test.sh

View workflow job for this annotation

GitHub Actions / lint

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./ci/ci-test.sh:33:29:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)
printf "\n\n"
}

dumpControllerLogs() {
NR=$1
ControllerPOD=$(kubectl get pods -l app=openebs-zfs-controller -o jsonpath='{.items[0].metadata.name}' -n kube-system)
kubectl describe po $ControllerPOD -n kube-system
ControllerPOD=$(kubectl get pods -l app=openebs-zfs-controller -o jsonpath='{.items[0].metadata.name}' -n openebs)
kubectl describe po $ControllerPOD -n openebs

Check warning on line 40 in ci/ci-test.sh

View workflow job for this annotation

GitHub Actions / lint

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./ci/ci-test.sh:40:23:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)
printf "\n\n"
kubectl logs --tail=${NR} $ControllerPOD -n kube-system -c openebs-zfs-plugin
kubectl logs --tail=${NR} $ControllerPOD -n openebs -c openebs-zfs-plugin

Check warning on line 42 in ci/ci-test.sh

View workflow job for this annotation

GitHub Actions / lint

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./ci/ci-test.sh:42:23:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check warning on line 42 in ci/ci-test.sh

View workflow job for this annotation

GitHub Actions / lint

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./ci/ci-test.sh:42:29:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)
printf "\n\n"
}


isPodReady(){
[ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n kube-system)" = 'True' ]
[ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n openebs)" = 'True' ]
}


Expand All @@ -63,7 +62,7 @@ waitForZFSDriver() {

i=0
while [ "$i" -le "$period" ]; do
zfsDriver="$(kubectl get pods -l role=openebs-zfs -o 'jsonpath={.items[*].metadata.name}' -n kube-system)"
zfsDriver="$(kubectl get pods -l role=openebs-zfs -o 'jsonpath={.items[*].metadata.name}' -n openebs)"
if isDriverReady $zfsDriver; then

Check warning on line 66 in ci/ci-test.sh

View workflow job for this annotation

GitHub Actions / lint

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./ci/ci-test.sh:66:22:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)
return 0
fi
Expand All @@ -82,7 +81,7 @@ waitForZFSDriver

cd $TEST_DIR

kubectl get po -n kube-system
kubectl get po -n openebs

set +e

Expand Down
14 changes: 7 additions & 7 deletions ci/sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ test_repo="kubernetes-csi"

dumpAgentLogs() {
NR=$1
AgentPOD=$(kubectl get pods -l app=openebs-zfs-node -o jsonpath='{.items[0].metadata.name}' -n kube-system)
kubectl describe po "$AgentPOD" -n kube-system
AgentPOD=$(kubectl get pods -l app=openebs-zfs-node -o jsonpath='{.items[0].metadata.name}' -n openebs)
kubectl describe po "$AgentPOD" -n openebs
printf "\n\n"
kubectl logs --tail="${NR}" "$AgentPOD" -n kube-system -c openebs-zfs-plugin
kubectl logs --tail="${NR}" "$AgentPOD" -n openebs -c openebs-zfs-plugin
printf "\n\n"
}

dumpControllerLogs() {
NR=$1
ControllerPOD=$(kubectl get pods -l app=openebs-zfs-controller -o jsonpath='{.items[0].metadata.name}' -n kube-system)
kubectl describe po "$ControllerPOD" -n kube-system
ControllerPOD=$(kubectl get pods -l app=openebs-zfs-controller -o jsonpath='{.items[0].metadata.name}' -n openebs)
kubectl describe po "$ControllerPOD" -n openebs
printf "\n\n"
kubectl logs --tail="${NR}" "$ControllerPOD" -n kube-system -c openebs-zfs-plugin
kubectl logs --tail="${NR}" "$ControllerPOD" -n openebs -c openebs-zfs-plugin
printf "\n\n"
}

Expand Down Expand Up @@ -66,7 +66,7 @@ EOT
make clean
make

UUID=$(kubectl get pod -n kube-system -l "openebs.io/component-name=openebs-zfs-controller" -o 'jsonpath={.items[0].metadata.uid}')
UUID=$(kubectl get pod -n openebs -l "openebs.io/component-name=openebs-zfs-controller" -o 'jsonpath={.items[0].metadata.uid}')
SOCK_PATH=/var/lib/kubelet/pods/"$UUID"/volumes/kubernetes.io~empty-dir/socket-dir/csi.sock

sudo chmod -R 777 /var/lib/kubelet
Expand Down

0 comments on commit 14b7452

Please sign in to comment.