Skip to content

Commit bdfc708

Browse files
authored
Refactor e2e workflows to 1 matrix (#365)
* Refactor e2e workflows to 1 matrix Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Remove setup-dev step from build job Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Fix IMAGE_TAG missing override Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Another fix for IMAGE_TAG override Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Add temp DEBUG out Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Another fix for IMAGE_TAG var Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Add DEBUG in common.sh Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Override IMAGE_TAG correctly Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Add workflow_dispatch Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> * Remove stub git server image Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech> --------- Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech>
1 parent ea3bcce commit bdfc708

8 files changed

Lines changed: 184 additions & 311 deletions

File tree

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# Copyright 2025 The Nephio Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: End-to-End Tests
16+
on:
17+
push:
18+
paths-ignore:
19+
- "docs/**"
20+
- "release/**"
21+
- "OWNERS"
22+
pull_request:
23+
paths-ignore:
24+
- "docs/**"
25+
- "release/**"
26+
- "OWNERS"
27+
workflow_dispatch:
28+
29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.ref }}
31+
cancel-in-progress: true
32+
33+
env:
34+
IMAGE_REPO: porch-kind
35+
KIND_CONTEXT_NAME: porch-test
36+
PORCH_FUNCTION_RUNNER_IMAGE: porch-function-runner
37+
PORCH_WRAPPER_SERVER_IMAGE: porch-wrapper-server
38+
PORCH_SERVER_IMAGE: porch-server
39+
PORCH_CONTROLLERS_IMAGE: porch-controllers
40+
41+
jobs:
42+
build:
43+
name: Build Dev Images
44+
runs-on: ubuntu-latest
45+
timeout-minutes: 15
46+
env:
47+
IMAGE_TAG: ${{ github.sha }}
48+
outputs:
49+
image-tag: ${{ steps.vars.outputs.image-tag }}
50+
steps:
51+
- name: Checkout Porch
52+
uses: actions/checkout@v4
53+
- name: Set up Go
54+
uses: actions/setup-go@v5
55+
with:
56+
go-version-file: go.mod
57+
cache: true
58+
- name: Set variables
59+
id: vars
60+
run: echo "image-tag=${IMAGE_TAG:0:8}" >> $GITHUB_OUTPUT
61+
- name: Build images in parallel
62+
run: |
63+
export IMAGE_TAG=${IMAGE_TAG:0:8}
64+
IMAGE_NAME=${PORCH_FUNCTION_RUNNER_IMAGE} WRAPPER_SERVER_IMAGE_NAME=${PORCH_WRAPPER_SERVER_IMAGE} make -C func/ build-image &
65+
docker buildx build --load --tag ${IMAGE_REPO}/${PORCH_SERVER_IMAGE}:${IMAGE_TAG} -f ./build/Dockerfile . &
66+
IMAGE_NAME=${PORCH_CONTROLLERS_IMAGE} make -C controllers/ build-image &
67+
wait
68+
- name: Save all images
69+
run: |
70+
export IMAGE_TAG=${IMAGE_TAG:0:8}
71+
docker save \
72+
${IMAGE_REPO}/${PORCH_SERVER_IMAGE}:${IMAGE_TAG} \
73+
${IMAGE_REPO}/${PORCH_CONTROLLERS_IMAGE}:${IMAGE_TAG} \
74+
${IMAGE_REPO}/${PORCH_FUNCTION_RUNNER_IMAGE}:${IMAGE_TAG} \
75+
${IMAGE_REPO}/${PORCH_WRAPPER_SERVER_IMAGE}:${IMAGE_TAG} \
76+
| gzip > porch-images.tar.gz
77+
- name: Upload images
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: porch-images
81+
path: porch-images.tar.gz
82+
compression-level: 0
83+
retention-days: 1
84+
85+
tests:
86+
name: ${{ matrix.name }}
87+
runs-on: ubuntu-latest
88+
timeout-minutes: 30
89+
needs: build
90+
env:
91+
IMAGE_TAG: ${{ needs.build.outputs.image-tag }}
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
include:
96+
- name: "Porch E2E Tests"
97+
make_target: "run-in-kind"
98+
test_path: "${GITHUB_WORKSPACE}/test/e2e"
99+
test_env: "E2E=1"
100+
log_name: "porch-e2e-server.log"
101+
- name: "Porch E2E Tests (DB Cache)"
102+
make_target: "run-in-kind-db-cache"
103+
test_path: "${GITHUB_WORKSPACE}/test/e2e"
104+
test_env: "E2E=1 DB_CACHE=1"
105+
log_name: "porch-e2e-dbcache-server.log"
106+
- name: "Porch CLI E2E Tests"
107+
make_target: "run-in-kind-no-git"
108+
test_path: "${GITHUB_WORKSPACE}/test/e2e/cli"
109+
test_env: "E2E=1"
110+
log_name: "porch-cli-e2e-server.log"
111+
- name: "Porch CLI E2E Tests (DB Cache)"
112+
make_target: "run-in-kind-db-cache-no-git"
113+
test_path: "${GITHUB_WORKSPACE}/test/e2e/cli"
114+
test_env: "E2E=1"
115+
log_name: "porch-cli-e2e-dbcache-server.log"
116+
117+
steps:
118+
- name: Checkout Porch
119+
uses: actions/checkout@v4
120+
- name: Set up Go
121+
uses: actions/setup-go@v5
122+
with:
123+
go-version-file: go.mod
124+
cache: true
125+
- name: Install kpt
126+
uses: jaxxstorm/action-install-gh-release@v2.1.0
127+
with:
128+
repo: kptdev/kpt
129+
tag: v1.0.0-beta.59
130+
chmod: 0755
131+
- name: Install Kind
132+
uses: helm/kind-action@v1
133+
with:
134+
version: v0.30.0
135+
install_only: true
136+
- name: Set up Git config
137+
run: |
138+
git config --global user.name "Porch E2E"
139+
git config --global user.email "porch-e2e@porch.dev"
140+
- name: Setup dev env
141+
run: ${GITHUB_WORKSPACE}/scripts/setup-dev-env.sh
142+
- name: Download image artifacts
143+
uses: actions/download-artifact@v4
144+
with:
145+
name: porch-images
146+
- name: Load images to kind
147+
run: |
148+
gunzip -c porch-images.tar.gz | docker load
149+
kind load docker-image ${IMAGE_REPO}/${PORCH_SERVER_IMAGE}:${{ needs.build.outputs.image-tag }} -n ${KIND_CONTEXT_NAME}
150+
kind load docker-image ${IMAGE_REPO}/${PORCH_CONTROLLERS_IMAGE}:${{ needs.build.outputs.image-tag }} -n ${KIND_CONTEXT_NAME}
151+
kind load docker-image ${IMAGE_REPO}/${PORCH_FUNCTION_RUNNER_IMAGE}:${{ needs.build.outputs.image-tag }} -n ${KIND_CONTEXT_NAME}
152+
kind load docker-image ${IMAGE_REPO}/${PORCH_WRAPPER_SERVER_IMAGE}:${{ needs.build.outputs.image-tag }} -n ${KIND_CONTEXT_NAME}
153+
- name: Deploy porch kpt pkg
154+
run: IMAGE_TAG=${{ needs.build.outputs.image-tag }} SKIP_IMG_BUILD=true make ${{ matrix.make_target }}
155+
- name: Run E2E tests
156+
run: ${{ matrix.test_env }} go test -v -timeout 20m ${{ matrix.test_path }}
157+
- name: Export porch server logs
158+
if: always()
159+
run: |
160+
name=$(kubectl -n porch-system get pod -l app=porch-server -o custom-columns=NAME:.metadata.name --no-headers=true)
161+
kubectl -n porch-system logs $name > ${{ matrix.log_name }}
162+
- name: Archive logs
163+
if: always()
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: ${{ matrix.log_name }}
167+
path: ${{ matrix.log_name }}
168+
compression-level: 0
169+
retention-days: 7

.github/workflows/porch-e2e-dbcache.yaml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.github/workflows/porch-e2e.yaml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.github/workflows/porchctl-cli-e2e-dbcache.yaml

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)