Skip to content

Commit

Permalink
✨ Cache testing image and simplify scripts (#1776)
Browse files Browse the repository at this point in the history
Cache golang-testing image

And reduce external call to generate datasource-iso

Signed-off-by: Mauro Morales <[email protected]>
  • Loading branch information
mauromorales authored Aug 29, 2023
1 parent 355e12c commit eb44ba5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/workflows/reusable-qemu-acceptance-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,4 @@ jobs:
repository: quay.io/kairos/packages
packages: utils/earthly
- run: |
earthly +datasource-iso --CLOUD_CONFIG=tests/assets/autoinstall.yaml
earthly +run-qemu-datasource-tests --PREBUILT_ISO=$(ls kairos-core-*${{ inputs.flavor }}*.iso) --FLAVOR=${{ inputs.flavor }} --SSH_PORT=${{ inputs.port }}
1 change: 0 additions & 1 deletion .github/workflows/reusable-qemu-reset-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ jobs:
insecure = true
http = true
EOF
earthly -P +datasource-iso --CLOUD_CONFIG=tests/assets/autoinstall.yaml
earthly -P +run-qemu-datasource-tests --PREBUILT_ISO=$(ls kairos-core-*${{ inputs.flavor }}*.iso) --TEST_SUITE=reset-test --FLAVOR=${{ inputs.flavor }}
16 changes: 8 additions & 8 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,18 @@ all-arm-generic:
BUILD --platform=linux/arm64 +base-image --MODEL=generic
BUILD --platform=linux/arm64 +iso --MODEL=generic

go-deps-test:
build-and-push-golang-testing:
ARG GO_VERSION
FROM golang:$GO_VERSION
# Enable backports repo for debian for swtpm
RUN . /etc/os-release && echo "deb http://deb.debian.org/debian $VERSION_CODENAME-backports main contrib non-free" > /etc/apt/sources.list.d/backports.list
RUN apt update
RUN apt install -y qemu-system-x86 qemu-utils git swtpm && apt clean
SAVE IMAGE --push $IMAGE_REPOSITORY_ORG/golang-testing:${GO_VERSION}

go-deps-test:
ARG GO_VERSION
FROM $IMAGE_REPOSITORY_ORG/golang-testing:$GO_VERSION
WORKDIR /build
COPY tests/go.mod tests/go.sum ./
RUN go mod download
Expand Down Expand Up @@ -874,8 +881,6 @@ grype-scan:
# usage e.g. ./earthly.sh +run-qemu-datasource-tests --FLAVOR=alpine-opensuse-leap --FROM_ARTIFACTS=true
run-qemu-datasource-tests:
FROM +go-deps-test
RUN apt update
RUN apt install -y qemu-system-x86 qemu-utils golang git swtpm
WORKDIR /test
ARG FLAVOR
ARG PREBUILT_ISO
Expand Down Expand Up @@ -922,9 +927,6 @@ run-qemu-netboot-test:
COPY +version/VERSION ./
ARG VERSION=$(cat VERSION)

RUN apt update
RUN apt install -y qemu-utils qemu-system git swtpm && apt clean

# This is the IP at which qemu vm can see the host
ARG IP="10.0.2.2"

Expand All @@ -951,8 +953,6 @@ run-qemu-netboot-test:

run-qemu-test:
FROM +go-deps-test
RUN apt update
RUN apt install -y qemu-system-x86 qemu-utils git swtpm && apt clean
ARG FLAVOR
ARG TEST_SUITE=upgrade-with-cli
ARG PREBUILT_ISO
Expand Down

0 comments on commit eb44ba5

Please sign in to comment.