initial attempt at csi-sanity ci test

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2021-09-26 22:17:33 -06:00
parent 124f194f3a
commit e8b0d7df93
11 changed files with 179 additions and 29 deletions

View File

@ -9,14 +9,44 @@ on:
- next - next
jobs: jobs:
build: cancel-previous-runs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Cancel Previous Runs - name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0 uses: styfle/cancel-workflow-action@0.6.0
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
csi-sanity-synology:
strategy:
matrix:
config:
- synlogy-iscsi/default.yaml
runs-on:
- self-hosted
steps:
- uses: actions/checkout@v2
- name: csi-sanity
run: |
export CI_BUILD_KEY=$(uuidgen)
sudo ci/bin/launch-server.sh &
# wait for server to launch
sleep 10
sudo ci/bin/launch-csi-sanity.sh
env:
TEMPLATE_CONFIG_FILE: "./ci/configs/${{ matrix.config }}"
SYNOLOGY_HOST: ${{ secrets.SANITY_SYNOLOGY_HOST }}
SYNOLOGY_PORT: ${{ secrets.SANITY_SYNOLOGY_PORT }}
SYNOLOGY_USERNAME: ${{ secrets.SANITY_SYNOLOGY_USERNAME }}
SYNOLOGY_PASSWORD: ${{ secrets.SANITY_SYNOLOGY_PASSWORD }}
SYNOLOGY_VOLUME: ${{ secrets.SANITY_SYNOLOGY_VOLUME }}
TARGET_PORTAL: ${{ secrets.SANITY_SYNOLOGY_TARGET_PORTAL }}
build:
needs:
- csi-sanity-synology
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: docker build - name: docker build
run: | run: |

View File

@ -31,7 +31,7 @@ const PROTO_PATH = __dirname + "/../csi_proto/csi-v1.5.0.proto";
//var grpc = require("grpc-uds"); //var grpc = require("grpc-uds");
var grpc = require("@grpc/grpc-js"); var grpc = require("@grpc/grpc-js");
var protoLoader = require("@grpc/proto-loader"); var protoLoader = require("@grpc/proto-loader");
const { rsort } = require("semver");
// Suggested options for similarity to existing grpc.load behavior // Suggested options for similarity to existing grpc.load behavior
var packageDefinition = protoLoader.loadSync(PROTO_PATH, { var packageDefinition = protoLoader.loadSync(PROTO_PATH, {
keepCase: true, keepCase: true,

39
ci/bin/launch-csi-sanity.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
set -e
set -x
: ${CI_BUILD_KEY:="local"}
: ${CSI_ENDPOINT:=/tmp/csi-${CI_BUILD_KEY}.sock}
: ${CSI_SANITY_TEMP_DIR:=$(mktemp -d -t ci-csi-sanity-tmp-XXXXXXXX)}
if [[ ! -S "${CSI_ENDPOINT}" ]];then
echo "csi socket: ${CSI_ENDPOINT} does not exist"
exit 1
fi
trap ctrl_c INT
function ctrl_c() {
echo "Trapped CTRL-C"
exit 1
}
chmod g+w,o+w "${CSI_ENDPOINT}";
mkdir -p "${CSI_SANITY_TEMP_DIR}";
rm -rf "${CSI_SANITY_TEMP_DIR}"/*;
chmod -R 777 "${CSI_SANITY_TEMP_DIR}";
# https://github.com/kubernetes-csi/csi-test/tree/master/cmd/csi-sanity
# FOR DEBUG: --ginkgo.v
# --csi.secrets=<path to secrets file>
# expand size 2073741824 to have mis-alignments
# expand size 2147483648 to have everything line up nicely
csi-sanity --csi.endpoint "unix://${CSI_ENDPOINT}" \
--csi.mountdir "${CSI_SANITY_TEMP_DIR}/mnt" \
--csi.stagingdir "${CSI_SANITY_TEMP_DIR}/stage" \
--csi.testvolumeexpandsize 2147483648 \
--csi.testvolumesize 1073741824
rm -rf "${CSI_SANITY_TEMP_DIR}"

24
ci/bin/launch-server.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
set -x
: ${CI_BUILD_KEY:="local"}
: ${TEMPLATE_CONFIG_FILE:=${1}}
: ${CSI_MODE:=""}
: ${CSI_VERSION:="1.5.0"}
: ${CSI_ENDPOINT:=/tmp/csi-${CI_BUILD_KEY}.sock}
if [[ "x${CONFIG_FILE}" == "x" ]];then
: ${CONFIG_FILE:=$(mktemp -t ci-csi-config-XXXXXXXX)}
if [[ "x${TEMPLATE_CONFIG_FILE}" != "x" ]];then
envsubst < "${TEMPLATE_CONFIG_FILE}" > "${CONFIG_FILE}"
fi
fi
if [[ "x${CSI_MODE}" != "x" ]];then
EXTRA_ARGS="--csi-mode ${CSI_MODE} ${EXTRA_ARGS}"
fi
./bin/democratic-csi --log-level debug --driver-config-file "${CONFIG_FILE}" --csi-version "${CSI_VERSION}" --csi-name "driver-test" --server-socket "${CSI_ENDPOINT}" ${EXTRA_ARGS}

View File

@ -0,0 +1,77 @@
driver: synology-iscsi
httpConnection:
protocol: http
host: ${SYNOLOGY_HOST}
port: ${SYNOLOGY_PORT}
username: ${SYNOLOGY_USERNAME}
password: ${SYNOLOGY_PASSWORD}
allowInsecure: true
session: "democratic-csi-${CI_BUILD_KEY}"
serialize: true
synology:
volume: ${SYNOLOGY_VOLUME}
iscsi:
targetPortal: ${TARGET_PORTAL}
targetPortals: []
baseiqn: "iqn.2000-01.com.synology:XpenoDsm62x."
namePrefix: "csi-${CI_BUILD_KEY}"
nameSuffix: "-ci"
lunTemplate:
# btrfs thin provisioning
type: "BLUN"
# tpws = Hardware-assisted zeroing
# caw = Hardware-assisted locking
# 3pc = Hardware-assisted data transfer
# tpu = Space reclamation
# can_snapshot = Snapshot
#dev_attribs:
#- dev_attrib: emulate_tpws
# enable: 1
#- dev_attrib: emulate_caw
# enable: 1
#- dev_attrib: emulate_3pc
# enable: 1
#- dev_attrib: emulate_tpu
# enable: 0
#- dev_attrib: can_snapshot
# enable: 1
# btfs thick provisioning
# only zeroing and locking supported
#type: "BLUN_THICK"
# tpws = Hardware-assisted zeroing
# caw = Hardware-assisted locking
#dev_attribs:
#- dev_attrib: emulate_tpws
# enable: 1
#- dev_attrib: emulate_caw
# enable: 1
# ext4 thinn provisioning UI sends everything with enabled=0
#type: "THIN"
# ext4 thin with advanced legacy features set
# can only alter tpu (all others are set as enabled=1)
#type: "ADV"
#dev_attribs:
#- dev_attrib: emulate_tpu
# enable: 1
# ext4 thick
# can only alter caw
#type: "FILE"
#dev_attribs:
#- dev_attrib: emulate_caw
# enable: 1
lunSnapshotTemplate:
is_locked: true
# https://kb.synology.com/en-me/DSM/tutorial/What_is_file_system_consistent_snapshot
is_app_consistent: true
targetTemplate:
auth_type: 0
max_sessions: 0

0
docker/iscsiadm Normal file → Executable file
View File

0
docker/mount Normal file → Executable file
View File

0
docker/multipath Normal file → Executable file
View File

9
docker/node-installer.sh Normal file → Executable file
View File

@ -28,8 +28,11 @@ fi
echo "I am installing node $NODE_VERSION $NODE_DISTRO" echo "I am installing node $NODE_VERSION $NODE_DISTRO"
if [[ "x${NODE_TARGET_DIR}" == "x" ]]; then
NODE_TARGET_DIR="/usr/local/lib/nodejs"
fi
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${NODE_DISTRO}.tar.xz >/dev/null 2>&1 wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${NODE_DISTRO}.tar.xz >/dev/null 2>&1
mkdir -p /usr/local/lib/nodejs mkdir -p ${NODE_TARGET_DIR}
tar -xJf node-${NODE_VERSION}-${NODE_DISTRO}.tar.xz -C /usr/local/lib/nodejs --strip-components=1 tar -xJf node-${NODE_VERSION}-${NODE_DISTRO}.tar.xz -C ${NODE_TARGET_DIR} --strip-components=1
rm node-${NODE_VERSION}-${NODE_DISTRO}.tar.xz rm node-${NODE_VERSION}-${NODE_DISTRO}.tar.xz
rm -rf /var/lib/apt/lists/*

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
set -x
PLATFORM=$TARGETPLATFORM
if [[ "x${PLATFORM}" == "x" ]]; then
PLATFORM="linux/amd64"
fi
if [ "$PLATFORM" = "linux/amd64" ]; then
export NODE_ARCH="x64"
elif [ "$PLATFORM" = "linux/arm64" ]; then
export NODE_ARCH="arm64"
elif [ "$PLATFORM" = "linux/arm/v7" ]; then
export NODE_ARCH="armv7l"
else
echo "unsupported/unknown PLATFORM ${PLATFORM}"
exit 1
fi
npm install --target_arch="${NODE_ARCH}"

0
docker/umount Normal file → Executable file
View File