|
| 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 |
0 commit comments