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

ci: add csi-sanity action to PRs #30

Merged
merged 14 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
91 changes: 91 additions & 0 deletions .github/workflows/sanity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: sanity
on:
pull_request:

concurrency:
group: sanity=${{ github.ref }}
cancel-in-progress: true

env:
# through 1 to 9
PLUGIN_VERBOSITY: ${{ vars.PLUGIN_VERBOSITY }}
# - ' '
# - '-ginkgo.v'
# - '-ginkgo.vv'
SANITY_VERBOSITY: ${{ vars.SANITY_VERBOSITY }}
COMPOSE_DEFAULTS: '--exit-code-from=sanity --always-recreate-deps'

jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3

- run: echo "${{ secrets.WEKAFS_API_SECRET_YAML }}" > tests/csi-sanity/wekafs-api-secret.yaml

- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
context: .
file: tests/csi-sanity/ga-Dockerfile
tags: sanity:latest
load: true

legacy_sanity:
needs: build
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- run: docker-compose -f tests/csi-sanity/ga-docker-compose1.yaml up $COMPOSE_DEFAULTS
env:
SANITY_FUNCTION: legacy_sanity

directory_volume_no_snapshots:
if: always()
needs: legacy_sanity
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- run: docker-compose -f tests/csi-sanity/ga-docker-compose1.yaml up $COMPOSE_DEFAULTS
env:
SANITY_FUNCTION: directory_volume_no_snapshots

fs_volume_no_snapshots:
if: always()
needs: directory_volume_no_snapshots
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- run: docker-compose -f tests/csi-sanity/ga-docker-compose1.yaml up $COMPOSE_DEFAULTS
env:
SANITY_FUNCTION: fs_volume_no_snapshots

directory_volume_and_snapshots:
if: always()
needs: fs_volume_no_snapshots
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- run: docker-compose -f tests/csi-sanity/ga-docker-compose2.yaml up $COMPOSE_DEFAULTS
env:
SANITY_FUNCTION: directory_volume_and_snapshots

snaphot_volumes_with_2nd_level_shapshots:
if: always()
needs: directory_volume_and_snapshots
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- run: docker-compose -f tests/csi-sanity/ga-docker-compose2.yaml up $COMPOSE_DEFAULTS
env:
SANITY_FUNCTION: snaphot_volumes_with_2nd_level_shapshots

filesystem_volumes:
if: always()
needs: snaphot_volumes_with_2nd_level_shapshots
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- run: docker-compose -f tests/csi-sanity/ga-docker-compose2.yaml up $COMPOSE_DEFAULTS
env:
SANITY_FUNCTION: filesystem_volumes
25 changes: 25 additions & 0 deletions tests/csi-sanity/ga-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM golang:1.19-alpine

WORKDIR /app

COPY go.mod .
COPY go.sum .
RUN go mod download

RUN go install -v github.com/kubernetes-csi/csi-test/v5/cmd/[email protected]

COPY cmd cmd
COPY pkg pkg

RUN CGO_ENABLED=0 GOOS="linux" GOARCH="amd64" go build -a -ldflags '-X main.version='$VERSION' -extldflags "-static"' -o wekafsplugin ./cmd/wekafsplugin/main.go


FROM golang:1.19-alpine

ADD tests/csi-sanity/wekafs-dirv1.yaml /test/wekafs-dirv1.yaml
ADD tests/csi-sanity/wekafs-fs.yaml /test/wekafs-fs.yaml
ADD tests/csi-sanity/wekafs-snapvol.yaml /test/wekafs-snapvol.yaml
ADD tests/csi-sanity/wekafs-api-secret.yaml /test/wekafs-api-secret.yaml
ADD tests/csi-sanity/ga_docker_run_sanity.sh /usr/bin/run_sanity
COPY --from=0 /go/bin/csi-sanity /usr/local/bin/csi-sanity
COPY --from=0 /app/wekafsplugin /usr/local/bin/wekafsplugin
31 changes: 31 additions & 0 deletions tests/csi-sanity/ga-docker-compose1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest to rename docker-compose-nosnapshotcaps.yaml
Why do you have ga- prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will rename


services:
plugin_controller_no_snaps:
image: sanity
command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9091 --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -allowautoseedsnapshotcreation -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes
volumes:
- test-volume:/tmp/weka-csi-test
privileged: true
network_mode: host
plugin_node_no_snaps:
image: sanity
command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9092 --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -allowautoseedsnapshotcreation -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes
volumes:
- test-volume:/tmp/weka-csi-test
privileged: true
network_mode: host
sanity:
image: sanity
command: run_sanity ${SANITY_FUNCTION} ${SANITY_VERBOSITY}
network_mode: host
volumes:
- test-volume:/tmp/weka-csi-test
healthcheck:
test: test -f /tmp/weka-csi-test/controller-no-snaps.sock && test -f /tmp/weka-csi-test/node-no-snaps.sock
start_period: 5s
timeout: 1s
retries: 5
interval: 3s
volumes:
test-volume:
31 changes: 31 additions & 0 deletions tests/csi-sanity/ga-docker-compose2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3'

services:
plugin_controller:
image: sanity
command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9091 --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -allowautoseedsnapshotcreation -alwaysallowsnapshotvolumes
volumes:
- test-volume:/tmp/weka-csi-test
privileged: true
network_mode: host
plugin_node:
image: sanity
command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9092 --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -allowautoseedsnapshotcreation -alwaysallowsnapshotvolumes
volumes:
- test-volume:/tmp/weka-csi-test
privileged: true
network_mode: host
sanity:
image: sanity
command: run_sanity ${SANITY_FUNCTION} ${SANITY_VERBOSITY}
network_mode: host
volumes:
- test-volume:/tmp/weka-csi-test
healthcheck:
test: test -f /tmp/weka-csi-test/controller.sock && test -f /tmp/weka-csi-test/node.sock
start_period: 5s
timeout: 1s
retries: 5
interval: 3s
volumes:
test-volume:
89 changes: 89 additions & 0 deletions tests/csi-sanity/ga_docker_run_sanity.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env sh

mkdir -p /tmp/weka-csi-test/filesystems/default/test/my/path

# ---------------------- LEGACY DIR VOLUME NO API BINDING (NO SNAPSHOT SUPPORT) ----------------------
legacy_sanity() {
echo "LEGACY SANITY STARTED"

csi-sanity -csi.stagingdir /tmp/csi-test-staging \
--csi.controllerendpoint /tmp/weka-csi-test/controller-no-snaps.sock \
--csi.endpoint /tmp/weka-csi-test/node-no-snaps.sock \
-csi.mountdir=/tmp/weka-csi-test/sanity-workspace/ \
-ginkgo.always-emit-ginkgo-writer \
-ginkgo.progress $1\
-ginkgo.seed 0 \
-csi.testvolumeparameters /test/wekafs-dirv1.yaml
}

# ---------------------- DIR VOLUME WITH API BINDING EXCLUDING SNAPSHOTS ----------------------
directory_volume_no_snapshots() {
echo "DIRECTORY VOLUME NO SNAPSHOTS STARTED"

csi-sanity -csi.stagingdir /tmp/csi-test-staging \
--csi.controllerendpoint /tmp/weka-csi-test/controller-no-snaps.sock \
--csi.endpoint /tmp/weka-csi-test/node-no-snaps.sock \
-csi.secrets /test/wekafs-api-secret.yaml \
-csi.mountdir=/tmp/weka-csi-test/sanity-workspace/ \
-ginkgo.seed 0 \
-ginkgo.progress $1\
-csi.testvolumeparameters /test/wekafs-dirv1.yaml
}

# ---------------------- FS VOLUME WITH API BINDING EXCLUDING SNAPSHOTS ----------------------
fs_volume_no_snapshots() {
echo "FS VOLUME NO SNAPSHOTS STARTED"

csi-sanity -csi.stagingdir /tmp/csi-test-staging \
--csi.controllerendpoint /tmp/weka-csi-test/controller-no-snaps.sock \
--csi.endpoint /tmp/weka-csi-test/node-no-snaps.sock \
-csi.secrets /test/wekafs-api-secret.yaml \
-csi.mountdir=/tmp/weka-csi-test/sanity-workspace/ \
-csi.testvolumeparameters /test/wekafs-fs.yaml \
-ginkgo.seed 0 \
-ginkgo.progress $1
}

# ---------------------- DIR VOLUME WITH API BINDING AND SNAPSHOTS ----------------------
directory_volume_and_snapshots() {
echo "DIRECTORY VOLUME AND SNAPSHOTS STARTED"

csi-sanity -csi.stagingdir /tmp/csi-test-staging \
--csi.controllerendpoint /tmp/weka-csi-test/controller.sock \
--csi.endpoint /tmp/weka-csi-test/node.sock \
-csi.secrets /test/wekafs-api-secret.yaml \
-csi.mountdir=/tmp/weka-csi-test/sanity-workspace/ \
-ginkgo.seed 0 \
-ginkgo.progress $1\
-csi.testvolumeparameters /test/wekafs-dirv1.yaml
}

# ---------------------- SNAPSHOT VOLUME WITH API BINDING AND SNAPSHOTS ----------------------
snaphot_volumes_with_2nd_level_shapshots() {
echo "SNAPSHOT VOLUMES WITH 2nd LEVEL SNAPSHOTS STARTED"

csi-sanity -csi.stagingdir /tmp/csi-test-staging \
--csi.controllerendpoint /tmp/weka-csi-test/controller.sock \
--csi.endpoint /tmp/weka-csi-test/node.sock \
-csi.secrets /test/wekafs-api-secret.yaml \
-csi.mountdir=/tmp/weka-csi-test/sanity-workspace/ \
-ginkgo.seed 0 \
-ginkgo.progress $1\
-csi.testvolumeparameters /test/wekafs-snapvol.yaml
}

# ---------------------- FILESYSTEM VOLUME WITH API BINDING AND SNAPSHOTS ----------------------
filesystem_volumes() {
echo "FILESYSTEM VOLUMES STARTED"

csi-sanity -csi.stagingdir /tmp/csi-test-staging \
--csi.controllerendpoint /tmp/weka-csi-test/controller.sock \
--csi.endpoint /tmp/weka-csi-test/node.sock \
-csi.secrets /test/wekafs-api-secret.yaml \
-csi.mountdir=/tmp/weka-csi-test/sanity-workspace/ \
-ginkgo.seed 0 \
-ginkgo.progress $1\
-csi.testvolumeparameters /test/wekafs-fs.yaml
}

"$@"