Skip to content

Commit 0171cc2

Browse files
committed
Add workflow to run e2e tests using GitHub CI
Signed-off-by: Andrei Kvapil <[email protected]>
1 parent a9c8133 commit 0171cc2

5 files changed

Lines changed: 29 additions & 15 deletions

File tree

‎.github/workflows/e2e-test.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: E2E Test in Docker
2+
3+
on:
4+
pull_request:
5+
types: [labeled, opened, synchronize, reopened]
6+
7+
jobs:
8+
e2e:
9+
name: Run Makefile in e2e container
10+
runs-on: [self-hosted]
11+
12+
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test')
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 1
19+
20+
- name: Run tests in Docker
21+
run: |
22+
make test

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ assets:
3838
make -C packages/core/installer/ assets
3939

4040
test:
41-
test -f _out/assets/nocloud-amd64.raw.xz || make -C packages/core/installer talos-nocloud
41+
#test -f _out/assets/nocloud-amd64.raw.xz || make -C packages/core/installer talos-nocloud
4242
make -C packages/core/testing apply
4343
make -C packages/core/testing test
4444
make -C packages/core/testing test-applications

‎packages/core/testing/Makefile‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,8 @@ image-e2e-sandbox:
3434
yq -i '.e2e.image = strenv(IMAGE)' values.yaml
3535
rm -f images/e2e-sandbox.json
3636

37-
copy-hack-dir:
38-
tar -C ../../../ -cf- hack | kubectl exec -i -n $(NAMESPACE) deploy/cozystack-e2e-$(NAME) -- tar -xf-
39-
40-
copy-image:
41-
cat ../../../_out/assets/nocloud-amd64.raw.xz | kubectl exec -i -n $(NAMESPACE) deploy/cozystack-e2e-$(NAME) -- sh -xec 'xz --decompress > /nocloud-amd64.raw'
42-
43-
test: wait-for-sandbox copy-hack-dir copy-image ## Run the end-to-end tests in existing sandbox.
44-
helm template -n cozy-system installer ../installer | kubectl exec -i -n $(NAMESPACE) deploy/cozystack-e2e-$(NAME) -- sh -c 'cat > /cozystack-installer.yaml'
45-
kubectl exec -ti -n $(NAMESPACE) deploy/cozystack-e2e-$(NAME) -- sh -c 'export COZYSTACK_INSTALLER_YAML=$$(cat /cozystack-installer.yaml) && /hack/e2e.sh'
37+
test: wait-for-sandbox ## Run the end-to-end tests in existing sandbox.
38+
docker exec -ti -n cozy-e2e-sandbox -- sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(helm template -n cozy-system installer .packages/core/installer) && hack/e2e.sh'
4639

4740
test-applications: wait-for-sandbox copy-hack-dir ## Run the end-to-end tests in existing sandbox for applications.
4841
for app in $(TESTING_APPS); do \
@@ -66,5 +59,4 @@ sync-hosts:
6659
kubectl exec -n $(NAMESPACE) deploy/cozystack-e2e-$(NAME) -- sh -c 'kubectl get ing -A -o go-template='\''{{ "127.0.0.1 localhost\n"}}{{ range .items }}{{ range .status.loadBalancer.ingress }}{{ .ip }}{{ end }} {{ range .spec.rules }}{{ .host }}{{ end }}{{ "\n" }}{{ end }}'\'' > /etc/hosts'
6760

6861
wait-for-sandbox:
69-
kubectl wait deploy --for=condition=Progressing -n $(NAMESPACE) cozystack-e2e-$(NAME)
70-
kubectl wait pod --for=condition=Ready -n $(NAMESPACE) -l app=cozystack-e2e-$(NAME)
62+
docker run -d --rm -v "${PWD}/../../..:/workspace" -n cozy-e2e-sandbox ghcr.io/cozystack/cozystack/e2e-sandbox:latest@sha256:f41b1e0f76e7820ce87cd3dfa1b680490d0c898105690c79537943f26ab28040 sleep infinity

‎packages/core/testing/images/e2e-sandbox/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM ubuntu:22.04
22

33
ARG KUBECTL_VERSION=1.32.0
4-
ARG TALOSCTL_VERSION=1.8.4
4+
ARG TALOSCTL_VERSION=1.9.5
55
ARG HELM_VERSION=3.16.4
66

77
RUN apt-get update
8-
RUN apt-get -y install genisoimage qemu-kvm qemu-utils iproute2 iptables wget xz-utils netcat curl jq
8+
RUN apt-get -y install genisoimage qemu-kvm qemu-utils iproute2 iptables wget xz-utils netcat curl jq make git
99
RUN curl -LO "https://github.com/siderolabs/talos/releases/download/v${TALOSCTL_VERSION}/talosctl-linux-amd64" \
1010
&& chmod +x talosctl-linux-amd64 \
1111
&& mv talosctl-linux-amd64 /usr/local/bin/talosctl

‎packages/core/testing/values.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
e2e:
2-
image: ghcr.io/cozystack/cozystack/e2e-sandbox:v0.29.0@sha256:e24763eba3831224c6f92a09063c4dd199a15a4a8bc68171451e4c5106b9f5f3
2+
image: ghcr.io/cozystack/cozystack/e2e-sandbox:latest@sha256:f41b1e0f76e7820ce87cd3dfa1b680490d0c898105690c79537943f26ab28040

0 commit comments

Comments
 (0)