Skip to content

Commit

Permalink
ci: test parallel
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
  • Loading branch information
Vicente-Cheng committed Oct 1, 2024
1 parent d5b7347 commit 61d2799
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 10 deletions.
90 changes: 81 additions & 9 deletions .github/workflows/basic-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |
make validate
make validate-ci
main_jobs:
job-new-installation:
needs: validation
runs-on:
- self-hosted
Expand All @@ -42,9 +42,81 @@ jobs:
- name: "Local Deployment (Harvester+Longhorn+Node-Disk-Manager) for testing"
id: vm_deploy
run: |
rm -rf ndm-vagrant-k3s
git clone https://github.com/bk201/vagrant-k3s ndm-vagrant-k3s
pushd ndm-vagrant-k3s
rm -rf ndm-new-vagrant-k3s
git clone https://github.com/bk201/vagrant-k3s ndm-new-vagrant-k3s
pushd ndm-new-vagrant-k3s
yq e -i ".cluster_size = 1" settings.yaml
./new-cluster.sh
echo "VM_DEPLOYED=true" >> "$GITHUB_ENV"
yq e -i ".longhorn_version = \"1.7.1\"" settings.yaml
./scripts/deploy_longhorn.sh
popd
- name: "Patch Image target"
run: |
./ci/scripts/patch-ttl-repo.sh
echo "NDM override result as below:"
cat ci/charts/ndm-override.yaml
- name: "Deploy NDM"
run: |
pushd ndm-new-vagrant-k3s
cp ../ci/scripts/deploy_ndm.sh ./deploy_ndm.sh
cp ../ci/charts/ndm-override.yaml ./ndm-override.yaml
./deploy_ndm.sh
popd
- name: "Add disk"
run: |
pushd ndm-new-vagrant-k3s
./scripts/attach-disk.sh node1 test-fresh-installation
sleep 30
popd
- name: "Run Basic Test"
id: basic-test
run: |
pushd ndm-new-vagrant-k3s
vagrant ssh-config node1 > ../ssh-config
cp kubeconfig ../kubeconfig
popd
echo Running integration tests
NDM_HOME=`pwd` go test -v ./tests/...
- name: "Get NDM logs"
if: always()
run: |
if [ ${{ env.VM_DEPLOYED }} != 'true' ]; then
echo "VM is not deployed, skip getting logs"
exit 0
fi
./ci/scripts/get-debug-info.sh
- name: "Tear Down / Cleanup"
if: always()
run: |
if [ ${{ env.VM_DEPLOYED }} != 'true' ]; then
echo "VM is not deployed, skip VM destroy"
exit 0
fi
pushd ndm-new-vagrant-k3s
vagrant destroy -f --parallel
popd
jobs-upgrade:
needs: validation
runs-on:
- self-hosted
- golang
steps:
- name: "Clone and check"
uses: actions/checkout@v3
- name: "Build the Image for the Integration Test"
run: |
BUILD_FOR_CI=true make
./ci/scripts/patch-ttl-repo.sh
echo "NDM override result as below:"
cat ci/charts/ndm-override.yaml
- name: "Local Deployment (Harvester+Longhorn+Node-Disk-Manager) for testing"
id: vm_deploy
run: |
rm -rf ndm-upgrade-vagrant-k3s
git clone https://github.com/bk201/vagrant-k3s ndm-upgrade-vagrant-k3s
pushd ndm-upgrade-vagrant-k3s
yq e -i ".cluster_size = 1" settings.yaml
./new-cluster.sh
echo "VM_DEPLOYED=true" >> "$GITHUB_ENV"
Expand All @@ -55,8 +127,8 @@ jobs:
popd
- name: "Add disk"
run: |
pushd ndm-vagrant-k3s
./scripts/attach-disk.sh node1
pushd ndm-upgrade-vagrant-k3s
./scripts/attach-disk.sh node1 test-upgrade
sleep 30
popd
- name: "Patch Image target (for upgrade)"
Expand All @@ -66,14 +138,14 @@ jobs:
cat ci/charts/ndm-override.yaml
- name: "Upgrade NDM"
run: |
pushd ndm-vagrant-k3s
pushd ndm-upgrade-vagrant-k3s
cp ../ci/scripts/upgrade_ndm.sh ./upgrade_ndm.sh
./upgrade_ndm.sh
popd
- name: "Run Basic Test"
id: basic-test
run: |
pushd ndm-vagrant-k3s
pushd ndm-upgrade-vagrant-k3s
vagrant ssh-config node1 > ../ssh-config
cp kubeconfig ../kubeconfig
popd
Expand All @@ -94,6 +166,6 @@ jobs:
echo "VM is not deployed, skip VM destroy"
exit 0
fi
pushd ndm-vagrant-k3s
pushd ndm-upgrade-vagrant-k3s
vagrant destroy -f --parallel
popd
6 changes: 5 additions & 1 deletion ci/scripts/deploy_ndm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,14 @@ ensure_longhorn_ready

pushd $TOP_DIR

cat >> ndm-override.yaml << 'EOF'
cat >> ndm-override.yaml.default << 'EOF'
autoProvisionFilter: [/dev/sd*]
EOF

if [ ! -f ndm-override.yaml ]; then
mv ndm-override.yaml.default ndm-override.yaml
fi

$HELM pull harvester-node-disk-manager --repo https://charts.harvesterhci.io --untar
$HELM install -f $TOP_DIR/ndm-override.yaml harvester-node-disk-manager ./harvester-node-disk-manager --create-namespace -n harvester-system

Expand Down

0 comments on commit 61d2799

Please sign in to comment.