From 97fccf79f5be26513972f17a0b0c92da1017460c Mon Sep 17 00:00:00 2001 From: Itxaka Date: Wed, 14 Jun 2023 16:53:12 +0200 Subject: [PATCH] Bump to v2.2.0 (#399) --- .github/workflows/image.yaml | 18 ++++++++++++++++-- CORE_VERSION | 2 +- Earthfile | 4 ++++ tests/decentralized_test.go | 21 +++++++++++---------- tests/tests_suite_test.go | 10 ++++++++++ tests/upgrade_k8s_test.go | 17 +++++++++++++---- tests/upgrade_latest_k8s_test.go | 10 +++++++++- 7 files changed, 64 insertions(+), 18 deletions(-) diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index 69129f6..011b8b3 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -52,7 +52,17 @@ jobs: - name: Login to Quay Registry if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io - - name: Build 🔧 + - name: Build PR 🔧 + if: ${{ github.event_name == 'pull_request' }} + env: + FLAVOR: ${{ matrix.flavor }} + IMAGE: quay.io/kairos/kairos-${{ matrix.flavor }}:latest + run: | + ./earthly.sh +ci --IMAGE=$IMAGE --FLAVOR=$FLAVOR + sudo mv build/* . + sudo rm -rf build + - name: Build main 🔧 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} env: FLAVOR: ${{ matrix.flavor }} IMAGE: quay.io/kairos/kairos-${{ matrix.flavor }}:latest @@ -68,6 +78,7 @@ jobs: *.sha256 if-no-files-found: error - uses: actions/upload-artifact@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} with: name: kairos-${{ matrix.flavor }}.sbom.zip path: | @@ -75,18 +86,21 @@ jobs: *.spdx.json if-no-files-found: error - uses: actions/upload-artifact@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} with: name: kairos-${{ matrix.flavor }}.initrd.zip path: | *-initrd if-no-files-found: error - uses: actions/upload-artifact@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} with: name: kairos-${{ matrix.flavor }}.squashfs.zip path: | *.squashfs if-no-files-found: error - uses: actions/upload-artifact@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} with: name: kairos-${{ matrix.flavor }}.kernel.zip path: | @@ -94,6 +108,7 @@ jobs: *-initrd if-no-files-found: error - uses: actions/upload-artifact@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} with: name: kairos-${{ matrix.flavor }}.ipxe.zip path: | @@ -196,7 +211,6 @@ jobs: name: ${{ matrix.flavor }}-upgrade-test.logs.zip path: tests/**/logs/* if-no-files-found: warn - provider_upgrade: needs: - build diff --git a/CORE_VERSION b/CORE_VERSION index 1defe53..a4b6ac3 100644 --- a/CORE_VERSION +++ b/CORE_VERSION @@ -1 +1 @@ -v2.1.0 +v2.2.0 diff --git a/Earthfile b/Earthfile index f730229..af85331 100644 --- a/Earthfile +++ b/Earthfile @@ -55,6 +55,10 @@ all: BUILD +ipxe-iso DO +RELEASEVERSION +ci: + BUILD +docker + BUILD +iso + all-arm: ARG SECURITY_SCANS=true BUILD --platform=linux/arm64 +docker diff --git a/tests/decentralized_test.go b/tests/decentralized_test.go index 074287d..8796d5a 100644 --- a/tests/decentralized_test.go +++ b/tests/decentralized_test.go @@ -45,7 +45,6 @@ var _ = Describe("kairos decentralized k8s test", Label("decentralized-k8s"), fu vmForEach("checking if it has default service active", vms, func(vm VM) { if isFlavor(vm, "alpine") { out, _ := vm.Sudo("rc-status") - Expect(out).Should(ContainSubstring("kairos")) Expect(out).Should(ContainSubstring("kairos-agent")) } else { out, _ := vm.Sudo("systemctl status kairos") @@ -73,7 +72,6 @@ var _ = Describe("kairos decentralized k8s test", Label("decentralized-k8s"), fu out, _ := vm.Sudo("rc-status") return out }, 30*time.Second, 10*time.Second).Should(And( - ContainSubstring("kairos"), ContainSubstring("kairos-agent"))) } else { Eventually(func() string { @@ -119,14 +117,17 @@ var _ = Describe("kairos decentralized k8s test", Label("decentralized-k8s"), fu out, err := vm.Sudo("cat /run/cos/live_mode") Expect(err).To(HaveOccurred(), out) if isFlavor(vm, "alpine") { - Eventually(func() string { - out, _ = vm.Sudo("sudo cat /var/log/kairos/agent.log") - return out - }, 20*time.Minute, 1*time.Second).Should( - Or( - ContainSubstring("Configuring k3s-agent"), - ContainSubstring("Configuring k3s"), - ), out) + // Skip for now as agent doesn't log anymore as it cannot behave both as a one-off and a daemon + /* + Eventually(func() string { + out, _ = vm.Sudo("sudo cat /var/log/kairos/agent.log") + return out + }, 20*time.Minute, 1*time.Second).Should( + Or( + ContainSubstring("Configuring k3s-agent"), + ContainSubstring("Configuring k3s"), + ), out) + */ } else { Eventually(func() string { out, _ = vm.Sudo("systemctl status kairos-agent") diff --git a/tests/tests_suite_test.go b/tests/tests_suite_test.go index 7183a9a..ad92fa5 100644 --- a/tests/tests_suite_test.go +++ b/tests/tests_suite_test.go @@ -76,6 +76,8 @@ func startVM(iso string) (context.Context, VM) { stateDir, err := os.MkdirTemp("", "stateDir-*") Expect(err).ToNot(HaveOccurred()) + fmt.Printf("Statedir: %s\n", stateDir) + sshPort, err = getFreePort() Expect(err).ToNot(HaveOccurred()) @@ -111,6 +113,14 @@ func startVM(iso string) (context.Context, VM) { // but we just print the output just in case. fmt.Printf("\nVM Aborted: %s %s Exit status: %s\n", out, err, status) }), + func(m *types.MachineConfig) error { + m.Args = append(m.Args, + "-chardev", fmt.Sprintf("stdio,mux=on,id=char0,logfile=%s,signal=off", path.Join(stateDir, "serial.log")), + "-serial", "chardev:char0", + "-mon", "chardev=char0", + ) + return nil + }, types.WithStateDir(stateDir), types.WithDataSource(os.Getenv("DATASOURCE")), } diff --git a/tests/upgrade_k8s_test.go b/tests/upgrade_k8s_test.go index 0b00290..3bb4fb1 100644 --- a/tests/upgrade_k8s_test.go +++ b/tests/upgrade_k8s_test.go @@ -86,22 +86,23 @@ var _ = Describe("k3s upgrade test", Label("upgrade-k8s"), func() { "loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: disabled)")) } - By("checking if it has a working kubeconfig") + By("checking if kairos-agent has started") Eventually(func() string { var out string if isFlavor(vm, "alpine") { - out, _ = vm.Sudo("cat /var/log/kairos/agent.log;cat /var/log/kairos-agent.log") + out, _ = vm.Sudo("rc-service kairos-agent status") } else { out, _ = vm.Sudo("systemctl status kairos-agent") } return out - }, 900*time.Second, 10*time.Second).Should(ContainSubstring("One time bootstrap starting")) - + }, 900*time.Second, 10*time.Second).Should(Or(ContainSubstring("One time bootstrap starting"), ContainSubstring("status: started"))) + By("Checking agent provider correct start") Eventually(func() string { out, _ := vm.Sudo("cat /var/log/kairos/agent-provider.log") return out }, 900*time.Second, 10*time.Second).Should(Or(ContainSubstring("One time bootstrap starting"), ContainSubstring("Sentinel exists"))) + By("Checking k3s is pointing to https") Eventually(func() string { out, _ := vm.Sudo("cat /etc/rancher/k3s/k3s.yaml") return out @@ -120,6 +121,14 @@ var _ = Describe("k3s upgrade test", Label("upgrade-k8s"), func() { return out }, 900*time.Second, 10*time.Second).Should(ContainSubstring("system-upgrade-controller")) + By("wait for all containers to be in running state") + Eventually(func() string { + out, _ := kubectl(vm, "get pods -A") + fmt.Printf("out = %+v\n", out) + return out + + }, 900*time.Second, 10*time.Second).ShouldNot(And(ContainSubstring("Pending"), ContainSubstring("ContainerCreating"))) + By("applying upgrade plan") err = vm.Scp("assets/suc.yaml", "./suc.yaml", "0770") Expect(err).ToNot(HaveOccurred()) diff --git a/tests/upgrade_latest_k8s_test.go b/tests/upgrade_latest_k8s_test.go index 211b939..c8c381b 100644 --- a/tests/upgrade_latest_k8s_test.go +++ b/tests/upgrade_latest_k8s_test.go @@ -144,7 +144,15 @@ var _ = Describe("k3s upgrade test from k8s", Label("upgrade-latest-with-kuberne out, _ := kubectl(vm, "get pods -A") fmt.Printf("out = %+v\n", out) return out - }, 900*time.Second, 10*time.Second).Should(ContainSubstring("system-upgrade-controller")) + }) + + By("wait for all containers to be in running state") + Eventually(func() string { + out, _ := kubectl(vm, "get pods -A") + fmt.Printf("out = %+v\n", out) + return out + + }, 900*time.Second, 10*time.Second).ShouldNot(And(ContainSubstring("Pending"), ContainSubstring("ContainerCreating"))) By("triggering an upgrade") suc := sucYAML(strings.ReplaceAll(containerImage, ":8h", ""), "8h")