-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kimmo Lehto <[email protected]>
- Loading branch information
Showing
3 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,6 +271,40 @@ jobs: | |
LINUX_IMAGE: ${{ matrix.image }} | ||
K0S_FROM: ${{ matrix.k0s_from }} | ||
run: make smoke-upgrade | ||
|
||
smoke-dryrun: | ||
strategy: | ||
matrix: | ||
image: | ||
- quay.io/k0sproject/bootloose-alpine3.18 | ||
- quay.io/k0sproject/bootloose-ubuntu20.04 | ||
k0s_from: | ||
- v1.21.6+k0s.0 | ||
name: Dry run | ||
needs: build | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
check-latest: true | ||
|
||
- {"name":"Go modules cache","uses":"actions/cache@v3","with":{"path":"~/go/pkg/mod\n~/.cache/go-build\n~/Library/Caches/go-build\n%LocalAppData%\\go-build\n","key":"${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}","restore-keys":"${{ runner.os }}-go-\n"}} | ||
- {"name":"Compiled binary cache","uses":"actions/download-artifact@v3","with":{"name":"k0sctl","path":"."}} | ||
- {"name":"Make executable","run":"chmod +x k0sctl"} | ||
- {"name":"K0sctl cache","uses":"actions/cache@v3","with":{"path":"/var/cache/k0sctl\n~/.cache/k0sctl\n!*.log\n","key":"k0sctl-cache"}} | ||
- {"name":"Kubectl cache","uses":"actions/cache@v3","with":{"path":"smoke-test/kubectl\n","key":"kubectl-1.21.3"}} | ||
- {"name":"Go modules cache","uses":"actions/cache@v3","with":{"path":"~/go/pkg/mod\n~/.cache/go-build\n~/Library/Caches/go-build\n%LocalAppData%\\go-build\n","key":"${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}","restore-keys":"${{ runner.os }}-go-\n"}} | ||
- {"name":"Docker Layer Caching For Bootloose","uses":"satackey/[email protected]","continue-on-error":true} | ||
|
||
- name: Run smoke tests | ||
env: | ||
LINUX_IMAGE: ${{ matrix.image }} | ||
K0S_FROM: ${{ matrix.k0s_from }} | ||
run: make smoke-dryrun | ||
|
||
smoke-reset: | ||
strategy: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env sh | ||
|
||
K0SCTL_CONFIG=${K0SCTL_CONFIG:-"k0sctl.yaml"} | ||
|
||
set -e | ||
|
||
. ./smoke.common.sh | ||
trap cleanup EXIT | ||
|
||
|
||
deleteCluster | ||
createCluster | ||
|
||
remoteCommand() { | ||
local userhost="$1" | ||
shift | ||
bootloose ssh "${userhost}" -- "$@" | ||
} | ||
|
||
# Create config with older version and apply | ||
K0S_VERSION="${K0S_FROM}" | ||
echo "* Installing ${K0S_VERSION} using dry-run" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug --dry-run | tee k0sctl-dry-run.log | ||
remoteCommand "root@manager0" "test ! -d /etc/k0s" | ||
remoteCommand "root@manager0" "test ! -f /etc/k0s/k0s.yaml" | ||
remoteCommand "root@manager0" "test ! -d /var/lib/k0s" | ||
grep -q "write k0s configuration" k0sctl-dry-run.log | ||
count=$(grep -c "dry-run" k0sctl-dry-run.log) | ||
if [ "${count}" -lt 3 ]; then | ||
echo "Expected at least dry-run lines, got ${count}" | ||
exit 1 | ||
fi | ||
echo "* Dry-run filtered log:" | ||
grep "dry-run" k0sctl-dry-run.log | ||
|
||
echo "* Installing ${K0S_VERSION} without dry-run" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug | tee k0sctl.log | ||
remoteCommand "root@manager0" "test -d /etc/k0s" | ||
remoteCommand "root@manager0" "test -f /etc/k0s/k0s.yaml" | ||
remoteCommand "root@manager0" "test -d /var/lib/k0s" | ||
remoteCommand "root@manager0" "k0s version | grep -q ${K0S_VERSION}" | ||
count=$(grep -c "dry-run" k0sctl.log) | ||
if [ "${count}" -ne 0 ]; then | ||
echo "Expected zero dry-run lines, got ${count}" | ||
exit 1 | ||
fi | ||
|
||
unset K0S_VERSION | ||
|
||
echo "* Upgrading to k0s latest using dry-run" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug --dry-run | tee k0sctl-dry-run.log | ||
remoteCommand "root@manager0" "k0s version | grep -q ${K0S_FROM}" | ||
count=$(grep -c "dry-run" k0sctl-dry-run.log) | ||
if [ "${count}" -lt 3 ]; then | ||
echo "Expected at least dry-run lines, got ${count}" | ||
exit 1 | ||
fi | ||
echo "* Dry-run filtered log:" | ||
grep "dry-run" k0sctl-dry-run.log | ||
|
||
echo "* Upgrading to k0s latest without dry-run" | ||
../k0sctl apply --config "${K0SCTL_CONFIG}" --debug | tee k0sctl.log | ||
remoteCommand "root@manager0" "k0s version | grep -vq ${K0S_FROM}" | ||
count=$(grep -c "dry-run" k0sctl-dry-run.log) | ||
if [ "${count}" -ne 0 ]; then | ||
echo "Expected zero dry-run lines, got ${count}" | ||
exit 1 | ||
fi |