mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-16 22:50:47 +00:00
sparkles: custom user bind and ephemeral mounts (#692)
* ✨ custom user bind and ephemeral mounts Users can now specify custom and ephemeral mounts in cloud-init under the `install` section, e.g.: ``` users: - name: kairos ... install: auto: true device: "auto" bind_mounts: - /mnt/bind1 - /mnt/bind2 ephemeral_mounts: - /mnt/ephemeral - /mnt/ephemeral2 ... ``` Ephemeral mounts are mounted as RW - but changes are discarded when the machine is restart. Bind mounts will persist changes after restarted. This is a fix for #210 Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Add the custom user mount to /cos/run/cos-layout.env Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Add docs for custom user mounts in configuration example Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Reuse test_install function DRY the code, change how we call the function install_test Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Enable custom mount tests and install tests Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Enable tests in CI Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Remove duplicate if check Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Remove uneeded fmt.Println ... Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Use separate label for custom mounts Signed-off-by: Oz Tiram <oz@spectrocloud.com> * 🔧 Earthfile - DRY ginkgo We repeat this a more than twice so just extract to own target... Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Correct return type for ContainElements Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Remove CLOUD_INIT from custom mounts test This is not needed here. Signed-off-by: Oz Tiram <oz@spectrocloud.com> * Fix qemu-test-* earthly targets Signed-off-by: Oz Tiram <oz@spectrocloud.com> * 🔧 Fix CPU passing to VM Signed-off-by: Oz Tiram <oz@spectrocloud.com> * 🔧 remove apt cache after install qemu Helps deal with space running out in the CI. Signed-off-by: Oz Tiram <oz@spectrocloud.com> * 📖 Document custom mounts Signed-off-by: Oz Tiram <oz@spectrocloud.com> --------- Signed-off-by: Oz Tiram <oz@spectrocloud.com> Co-authored-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
This commit is contained in:
79
Earthfile
79
Earthfile
@@ -42,7 +42,8 @@ go-deps:
|
||||
SAVE ARTIFACT go.mod AS LOCAL go.mod
|
||||
SAVE ARTIFACT go.sum AS LOCAL go.sum
|
||||
|
||||
test:
|
||||
|
||||
ginkgo:
|
||||
FROM +go-deps
|
||||
WORKDIR /build
|
||||
RUN go get github.com/onsi/gomega/...
|
||||
@@ -50,6 +51,15 @@ test:
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/generators@v2.1.4
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/labels@v2.1.4
|
||||
RUN go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
|
||||
|
||||
test:
|
||||
FROM +ginkgo
|
||||
WORKDIR /build
|
||||
RUN go get github.com/onsi/gomega/...
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/internal@v2.1.4
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/generators@v2.1.4
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/labels@v2.1.4
|
||||
RUN go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
|
||||
COPY +luet/luet /usr/bin/luet
|
||||
COPY . .
|
||||
ENV ACK_GINKGO_DEPRECATIONS=2.5.1
|
||||
@@ -437,13 +447,13 @@ linux-bench-scan:
|
||||
###
|
||||
# usage e.g. ./earthly.sh +run-qemu-datasource-tests --FLAVOR=alpine-opensuse-leap --FROM_ARTIFACTS=true
|
||||
run-qemu-datasource-tests:
|
||||
FROM opensuse/leap
|
||||
FROM +ginkgo
|
||||
RUN apt install -y qemu-system-x86 qemu-utils golang git
|
||||
WORKDIR /test
|
||||
RUN zypper in -y qemu-x86 qemu-arm qemu-tools go git
|
||||
ARG FLAVOR
|
||||
ARG TEST_SUITE=autoinstall-test
|
||||
ENV FLAVOR=$FLAVOR
|
||||
ENV SSH_PORT=60022
|
||||
ENV SSH_PORT=60023
|
||||
ENV CREATE_VM=true
|
||||
ARG CLOUD_CONFIG="./tests/assets/autoinstall.yaml"
|
||||
ENV USE_QEMU=true
|
||||
@@ -466,19 +476,34 @@ run-qemu-datasource-tests:
|
||||
ELSE
|
||||
ENV DATASOURCE=/test/build/datasource.iso
|
||||
END
|
||||
RUN go get github.com/onsi/gomega/...
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/internal@v2.1.4
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/generators@v2.1.4
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/labels@v2.1.4
|
||||
RUN go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
|
||||
|
||||
ENV CLOUD_INIT=/tests/tests/$CLOUD_CONFIG
|
||||
|
||||
RUN PATH=$PATH:$GOPATH/bin ginkgo --label-filter "$TEST_SUITE" --fail-fast -r ./tests/
|
||||
RUN PATH=$PATH:$GOPATH/bin ginkgo -v --label-filter "$TEST_SUITE" --fail-fast -r ./tests/
|
||||
|
||||
run-qemu-custom-mount-tests:
|
||||
FROM +ginkgo
|
||||
RUN apt install -y qemu-system-x86 qemu-utils git && apt clean
|
||||
ARG FLAVOR
|
||||
|
||||
COPY . .
|
||||
RUN ls -liah
|
||||
IF [ -e /build/kairos.iso ]
|
||||
ENV ISO=/build/kairos.iso
|
||||
ELSE
|
||||
COPY +iso/kairos.iso kairos.iso
|
||||
ENV ISO=/build/kairos.iso
|
||||
END
|
||||
|
||||
ENV GOPATH="/go"
|
||||
ARG TEST_SUITE=custom-mounts-test
|
||||
ENV SSH_PORT=60024
|
||||
ENV CREATE_VM=true
|
||||
ENV USE_QEMU=true
|
||||
RUN pwd && ls -liah
|
||||
RUN PATH=$PATH:$GOPATH/bin ginkgo -v --label-filter custom-mounts-test --fail-fast -r ./tests/
|
||||
|
||||
run-qemu-netboot-test:
|
||||
FROM ubuntu
|
||||
|
||||
FROM +ginkgo
|
||||
COPY . /test
|
||||
WORKDIR /test
|
||||
|
||||
@@ -487,7 +512,7 @@ run-qemu-netboot-test:
|
||||
ARG VERSION=$(cat VERSION)
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y qemu qemu-utils qemu-system golang git
|
||||
RUN apt install -y qemu qemu-utils qemu-system git && apt clean
|
||||
|
||||
# This is the IP at which qemu vm can see the host
|
||||
ARG IP="10.0.2.2"
|
||||
@@ -504,7 +529,7 @@ run-qemu-netboot-test:
|
||||
ENV USE_QEMU=true
|
||||
ARG TEST_SUITE=netboot-test
|
||||
ENV GOPATH="/go"
|
||||
RUN go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
|
||||
|
||||
|
||||
# TODO: use --pull or something to cache the python image in Earthly
|
||||
WITH DOCKER
|
||||
@@ -514,9 +539,8 @@ run-qemu-netboot-test:
|
||||
END
|
||||
|
||||
run-qemu-test:
|
||||
FROM opensuse/leap
|
||||
WORKDIR /test
|
||||
RUN zypper in -y qemu-x86 qemu-arm qemu-tools go git
|
||||
FROM +ginkgo
|
||||
RUN apt install -y qemu-system-x86 qemu-utils git && apt clean
|
||||
ARG FLAVOR
|
||||
ARG TEST_SUITE=upgrade-with-cli
|
||||
ARG CONTAINER_IMAGE
|
||||
@@ -528,18 +552,15 @@ run-qemu-test:
|
||||
|
||||
ENV GOPATH="/go"
|
||||
|
||||
|
||||
COPY . .
|
||||
RUN go get github.com/onsi/gomega/...
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/internal@v2.1.4
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/generators@v2.1.4
|
||||
RUN go get github.com/onsi/ginkgo/v2/ginkgo/labels@v2.1.4
|
||||
RUN go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
|
||||
|
||||
ARG ISO=$(ls /test/build/*.iso)
|
||||
ENV ISO=$ISO
|
||||
|
||||
RUN PATH=$PATH:$GOPATH/bin ginkgo --label-filter "$TEST_SUITE" --fail-fast -r ./tests/
|
||||
IF [ -e /build/kairos.iso ]
|
||||
ENV ISO=/build/kairos.iso
|
||||
ELSE
|
||||
COPY +iso/kairos.iso kairos.iso
|
||||
ENV ISO=/build/kairos.iso
|
||||
END
|
||||
RUN pwd && ls -l && ls -l build
|
||||
RUN PATH=$PATH:$GOPATH/bin ginkgo -v --label-filter "$TEST_SUITE" --fail-fast -r ./tests/
|
||||
|
||||
###
|
||||
### Artifacts targets
|
||||
|
Reference in New Issue
Block a user