Skip to content

Commit

Permalink
Switch to lima as Vagrant replacement
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed Nov 1, 2023
1 parent c33f280 commit d9326eb
Show file tree
Hide file tree
Showing 14 changed files with 260 additions and 293 deletions.
120 changes: 62 additions & 58 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,122 +57,126 @@ jobs:

e2e-fedora:
needs: image

runs-on: macos-12
timeout-minutes: 90
timeout-minutes: 200
env:
RUN: ./hack/ci/run-fedora.sh
RUN: ./hack/ci/run.sh
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: image
path: .
- name: Cache ~/Library/Caches/lima/download
uses: actions/cache@v3
with:
path: ~/Library/Caches/lima/download
key: ${{ runner.os }}-${{ hashFiles('hack/ci/lima-fedora.yaml') }}
- name: Boot Virtual Machine
run: make vagrant-up-fedora
run: make lima-up-fedora
- name: Show environment information
run: |
$RUN kubectl wait --for=condition=ready --timeout=60s nodes --all
$RUN kubectl get nodes -o wide
- name: Set up git config
run: |
$RUN git config --global --add safe.directory /vagrant
- name: Run E2E tests
run: $RUN hack/ci/e2e-fedora.sh
- name: Run Flaky E2E tests
continue-on-error: true
run: |
$RUN "echo \"export E2E_TEST_FLAKY_TESTS_ONLY=true\" >> /vagrant/hack/ci/env.sh"
$RUN "echo \"export E2E_TEST_FLAKY_TESTS_ONLY=true\" >> hack/ci/env.sh"
$RUN hack/ci/e2e-fedora.sh
e2e-ubuntu:
needs: image

runs-on: macos-12
timeout-minutes: 90
timeout-minutes: 200
env:
RUN: ./hack/ci/run-ubuntu.sh
RUN: ./hack/ci/run.sh
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: image
path: .
- name: Cache ~/Library/Caches/lima/download
uses: actions/cache@v3
with:
path: ~/Library/Caches/lima/download
key: ${{ runner.os }}-${{ hashFiles('hack/ci/lima-ubuntu.yaml') }}
- name: Boot Virtual Machine
run: make vagrant-up-ubuntu
run: make lima-up-ubuntu
- name: Show environment information
run: |
$RUN kubectl wait --for=condition=ready --timeout=60s nodes --all
$RUN kubectl get nodes -o wide
- name: Set up git config
run: |
$RUN git config --global --add safe.directory /vagrant
- name: Run E2E tests
run: $RUN hack/ci/e2e-ubuntu.sh
- name: Run Flaky E2E tests
continue-on-error: true
run: |
$RUN "echo \"export E2E_TEST_FLAKY_TESTS_ONLY=true\" >> /vagrant/hack/ci/env.sh"
$RUN "echo \"export E2E_TEST_FLAKY_TESTS_ONLY=true\" >> hack/ci/env.sh"
$RUN hack/ci/e2e-ubuntu.sh
e2e-flatcar:
needs: image

runs-on: macos-12
timeout-minutes: 90
env:
RUN: ./hack/ci/run-flatcar.sh
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2
- name: Vagrant box version
id: vagrant-box
run: |
echo "version=$(curl -s https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_vagrant.json | jq '.versions[0].version' | tr -d '".')" >> $GITHUB_OUTPUT
shell: bash
- name: Upgrade vagrant box
run: |
ln -sf hack/ci/Vagrantfile-flatcar Vagrantfile
vagrant box update
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: image
path: .
- name: Boot Virtual Machine
run: make vagrant-up-flatcar
- name: Show environment information
run: |
$RUN kubectl wait --for=condition=ready --timeout=600s node localhost
$RUN kubectl get nodes -o wide
- name: Run E2E tests
run: $RUN hack/ci/e2e-flatcar-dev-container.sh
- name: Run Flaky E2E tests
continue-on-error: true
run: |
$RUN "echo \"export E2E_TEST_FLAKY_TESTS_ONLY=true\" >> /vagrant/hack/ci/env-flatcar.sh"
$RUN hack/ci/e2e-flatcar-dev-container.sh
# e2e-flatcar:
# needs: image
#
# runs-on: macos-12
# timeout-minutes: 90
# env:
# RUN: ./hack/ci/run-flatcar.sh
# steps:
# - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2
# - name: Vagrant box version
# id: vagrant-box
# run: |
# echo "version=$(curl -s https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_vagrant.json | jq '.versions[0].version' | tr -d '".')" >> $GITHUB_OUTPUT
# shell: bash
# - name: Upgrade vagrant box
# run: |
# ln -sf hack/ci/Vagrantfile-flatcar Vagrantfile
# vagrant box update
# - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
# with:
# name: image
# path: .
# - name: Boot Virtual Machine
# run: make vagrant-up-flatcar
# - name: Show environment information
# run: |
# $RUN kubectl wait --for=condition=ready --timeout=600s node localhost
# $RUN kubectl get nodes -o wide
# - name: Run E2E tests
# run: $RUN hack/ci/e2e-flatcar-dev-container.sh
# - name: Run Flaky E2E tests
# continue-on-error: true
# run: |
# $RUN "echo \"export E2E_TEST_FLAKY_TESTS_ONLY=true\" >> /vagrant/hack/ci/env-flatcar.sh"
# $RUN hack/ci/e2e-flatcar-dev-container.sh

baseprofiles:
needs: image
runs-on: macos-12
timeout-minutes: 90
timeout-minutes: 200
env:
RUN: ./hack/ci/run-ubuntu.sh
RUN: ./hack/ci/run.sh
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: image
path: .
- name: Cache ~/Library/Caches/lima/download
uses: actions/cache@v3
with:
path: ~/Library/Caches/lima/download
key: ${{ runner.os }}-${{ hashFiles('hack/ci/lima-ubuntu.yaml') }}
- name: Boot Virtual Machine
run: make vagrant-up-ubuntu
run: make lima-up-ubuntu
- name: Show environment information
run: |
$RUN kubectl wait --for=condition=ready --timeout=60s nodes --all
$RUN kubectl get nodes -o wide
- name: Set up git config
run: |
$RUN git config --global --add safe.directory /vagrant
- name: Record baseprofiles
- name: Run E2E tests
run: $RUN hack/ci/baseprofiles.sh

typos:
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*.orig
*.swp
.idea
.vagrant
/build
Vagrantfile
/lima.yaml
build.tar.gz
image.tar
result
29 changes: 15 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -289,28 +289,29 @@ update-proto: $(BUILD_DIR)/protoc-gen-go $(BUILD_DIR)/protoc-gen-go-grpc ## Upda
$$PROTO/api.proto ;\
done

define vagrant-up
define lima-up
if [ ! -f image.tar ]; then \
make image IMAGE=$(IMAGE) && \
$(CONTAINER_RUNTIME) save -o image.tar $(IMAGE); \
fi
ln -sf hack/ci/Vagrantfile-$(1) Vagrantfile
# Retry in case provisioning failed because of some temporarily unavailable
# remote resource (like the VM image)
vagrant up
ln -sf hack/ci/lima-$(1).yaml lima.yaml
limactl start lima.yaml \
--set '.env.LIMA_PATH="$(shell pwd)" | .env.LIMA_USER="$(shell whoami)"' \
--timeout 30m \
--tty=false
endef

.PHONY: vagrant-up-fedora
vagrant-up-fedora: ## Boot the Vagrant Fedora based test VM
$(call vagrant-up,fedora)
.PHONY: lima-up-fedora
lima-up-fedora: ## Boot the lima Fedora based test VM
$(call lima-up,fedora)

.PHONY: vagrant-up-ubuntu
vagrant-up-ubuntu: ## Boot the Vagrant Ubuntu based test VM
$(call vagrant-up,ubuntu)
.PHONY: lima-up-ubuntu
lima-up-ubuntu: ## Boot the lima Ubuntu based test VM
$(call lima-up,ubuntu)

.PHONY: vagrant-up-flatcar
vagrant-up-flatcar: ## Boot the Vagrant Flatcar based test VM
$(call vagrant-up,flatcar)
.PHONY: lima-up-flatcar
lima-up-flatcar: ## Boot the lima Flatcar based test VM
$(call lima-up,flatcar)

$(BUILD_DIR)/mdtoc: $(BUILD_DIR)
$(call go-build,./vendor/sigs.k8s.io/mdtoc)
Expand Down
18 changes: 9 additions & 9 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,22 @@ dependencies:
- name: e2e-kubernetes
version: 1.28
refPaths:
- path: hack/ci/Vagrantfile-fedora
- path: hack/ci/lima-fedora.yaml
match: KUBERNETES_VERSION
- path: hack/ci/Vagrantfile-ubuntu
- path: hack/ci/lima-ubuntu.yaml
match: KUBERNETES_VERSION

- name: e2e-fedora
version: 38
refPaths:
- path: hack/ci/Vagrantfile-fedora
- path: hack/ci/lima-fedora.yaml
match: fedora

- name: e2e-ubuntu
version: ubuntu2204
version: 22.04
refPaths:
- path: hack/ci/Vagrantfile-ubuntu
match: config.vm.box
- path: hack/ci/lima-ubuntu.yaml
match: location

- name: debian-base-digest
version: sha256:b9335fa66cdb5c1562c4f952e2d99f904dbe1618a6ed0d52487e70cf6cc280fd
Expand Down Expand Up @@ -168,7 +168,7 @@ dependencies:
match: VERSION

- name: crun
version: v1.10
version: v1.11
refPaths:
- path: examples/baseprofile-crun.yaml
match: name
Expand All @@ -184,13 +184,13 @@ dependencies:
match: baseProfileNameRunc
- path: installation-usage.md
match: baseProfileName
- path: hack/ci/Vagrantfile-ubuntu
- path: hack/ci/lima-ubuntu.yaml
match: RUNC_VERSION

- name: cosign
version: v2.2.0
refPaths:
- path: hack/ci/Vagrantfile-ubuntu
- path: hack/ci/lima-ubuntu.yaml
match: COSIGN_VERSION
- name: bom
version: v0.5.1
Expand Down
2 changes: 1 addition & 1 deletion examples/baseprofile-crun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: security-profiles-operator.x-k8s.io/v1beta1
kind: SeccompProfile
metadata:
name: crun-v1.10
name: crun-v1.11
spec:
defaultAction: SCMP_ACT_ERRNO
architectures:
Expand Down
Loading

0 comments on commit d9326eb

Please sign in to comment.