Skip to content

Commit a9b7880

Browse files
Initial commit
1 parent a265280 commit a9b7880

File tree

10 files changed

+145
-0
lines changed

10 files changed

+145
-0
lines changed

Makefile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
GITHUB_RUN_NUMBER ?= 0
2+
FIXTURE_BASE_BRANCH := e2e-test/$(GITHUB_RUN_NUMBER)/main
3+
FIXTURE_BRANCH_PREFIX := e2e-test/$(GITHUB_RUN_NUMBER)
4+
5+
all:
6+
7+
push-base-branch:
8+
git config user.name 'github-actions[bot]'
9+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
10+
git checkout -B "$(FIXTURE_BASE_BRANCH)"
11+
git add .
12+
git commit -a -m "Initial commit"
13+
git push origin -f "$(FIXTURE_BASE_BRANCH)"
14+
15+
# Test#1
16+
# It updates an image tag of Deployment.
17+
# It will cause the rolling update, that is, Progressing state.
18+
update-manifest-app1:
19+
git checkout "$(FIXTURE_BASE_BRANCH)"
20+
git checkout -b "$(FIXTURE_BRANCH_PREFIX)/update-manifest-app1"
21+
sed -i -e 's/echoserver:1.8/echoserver:1.9/g' app1/deployment/echoserver.yaml
22+
git commit -a -m 'e2e-test: update-manifest-app1'
23+
git push origin -f "$(FIXTURE_BRANCH_PREFIX)/update-manifest-app1"
24+
gh pr create --base "$(FIXTURE_BASE_BRANCH)" --fill --body "$(PULL_REQUEST_BODY)" --label e2e-test
25+
gh pr merge --squash
26+
git checkout "$(FIXTURE_BASE_BRANCH)"
27+
git pull origin "$(FIXTURE_BASE_BRANCH)" --ff-only
28+
29+
# Test#2
30+
# It updates the label to invalid value.
31+
# It will cause this error:
32+
# one or more objects failed to apply, reason: Deployment.apps "echoserver" is invalid: spec.selector: Invalid value: v1.LabelSelector
33+
update-manifest-app2:
34+
git checkout "$(FIXTURE_BASE_BRANCH)"
35+
git checkout -b "$(FIXTURE_BRANCH_PREFIX)/update-manifest-app2"
36+
sed -i -e 's/app: echoserver/app: echoserver-test2/g' app2/deployment/echoserver.yaml
37+
git commit -a -m 'e2e-test: update-manifest-app2'
38+
git push origin -f "$(FIXTURE_BRANCH_PREFIX)/update-manifest-app2"
39+
gh pr create --base "$(FIXTURE_BASE_BRANCH)" --fill --body "$(PULL_REQUEST_BODY)" --label e2e-test
40+
gh pr merge --squash
41+
git checkout "$(FIXTURE_BASE_BRANCH)"
42+
git pull origin "$(FIXTURE_BASE_BRANCH)" --ff-only
43+
44+
# Test#3
45+
# It updates an image tag of CronJob template.
46+
# Application will not transit to Progressing state.
47+
update-manifest-app3:
48+
git checkout "$(FIXTURE_BASE_BRANCH)"
49+
git checkout -b "$(FIXTURE_BRANCH_PREFIX)/update-manifest-app3"
50+
sed -i -e 's/busybox:1.28/busybox:1.30/g' app3/cronjob/echoserver.yaml
51+
git commit -a -m 'e2e-test: update-manifest-app3'
52+
git push origin -f "$(FIXTURE_BRANCH_PREFIX)/update-manifest-app3"
53+
gh pr create --base "$(FIXTURE_BASE_BRANCH)" --fill --body "$(PULL_REQUEST_BODY)" --label e2e-test
54+
gh pr merge --squash
55+
git checkout "$(FIXTURE_BASE_BRANCH)"
56+
git pull origin "$(FIXTURE_BASE_BRANCH)" --ff-only

app1/deployment/echoserver.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: echoserver
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: echoserver
10+
template:
11+
metadata:
12+
labels:
13+
app: echoserver
14+
spec:
15+
containers:
16+
- image: gcr.io/google_containers/echoserver:1.8
17+
name: echoserver
18+
ports:
19+
- containerPort: 8080
20+
readinessProbe:
21+
initialDelaySeconds: 3
22+
httpGet:
23+
path: /
24+
port: 8080

app1/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace: app1
2+
resources:
3+
- namespace/app1.yaml
4+
- deployment/echoserver.yaml

app1/namespace/app1.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: app1

app2/deployment/echoserver.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: echoserver
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: echoserver
10+
template:
11+
metadata:
12+
labels:
13+
app: echoserver
14+
spec:
15+
containers:
16+
- image: gcr.io/google_containers/echoserver:1.8
17+
name: echoserver
18+
ports:
19+
- containerPort: 8080

app2/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace: app2
2+
resources:
3+
- namespace/app2.yaml
4+
- deployment/echoserver.yaml

app2/namespace/app2.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: app2

app3/cronjob/echoserver.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: batch/v1
2+
kind: CronJob
3+
metadata:
4+
name: echoserver
5+
spec:
6+
schedule: "* * * * *"
7+
jobTemplate:
8+
spec:
9+
template:
10+
metadata:
11+
labels:
12+
app: echoserver
13+
spec:
14+
restartPolicy: Never
15+
containers:
16+
# https://hub.docker.com/_/busybox/
17+
- image: busybox:1.28
18+
name: echoserver
19+
command:
20+
- /bin/sh
21+
- -c
22+
- date; echo Hello from the Kubernetes cluster

app3/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace: app3
2+
resources:
3+
- namespace/app3.yaml
4+
- cronjob/echoserver.yaml

app3/namespace/app3.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: app3

0 commit comments

Comments
 (0)