Skip to content

Commit 0e335c4

Browse files
aFlyBird0steinliber
authored andcommitted
ci: new e2e test "gitlabci-argocd"
Signed-off-by: Bird <[email protected]>
1 parent 8c63c7f commit 0e335c4

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

.github/workflows/e2e-test.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ env:
2222
DOCKERHUB_TOKEN: ${{ secrets.E2E_DOCKERHUB_TOKEN }}
2323
# for apps
2424
IMAGE_REPO_PASSWORD: ${{ secrets.E2E_DOCKERHUB_TOKEN }}
25+
# token for gitlab.com (of aFlyBird0 now)
26+
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
2527

2628
concurrency:
2729
group: ${{ github.workflow }}
@@ -72,6 +74,7 @@ jobs:
7274
sudo mv ./kubectl /usr/local/bin/kubectl
7375
- name: copy config files
7476
run: cp ./test/e2e/yaml/e2e-*.yaml ./
77+
# test 1 is git-ops with tools only
7578
- name: test 1 - apply git-ops (tools only)
7679
run: ./dtm apply -f e2e-tools.yaml -y
7780
- name: test 1 - apply git-ops (tools only) again
@@ -83,21 +86,38 @@ jobs:
8386
run: ./dtm verify -f e2e-tools.yaml
8487
- name: test 1 - clean
8588
run: ./dtm delete -f e2e-tools.yaml -y
89+
# test 2 is git-ops with apps
8690
- name: test 2 - apply (apps)
8791
run: ./dtm apply --debug -f e2e-apps.yaml -y
8892
- name: test 2 - apply (apps) again
8993
run: ./dtm apply -f e2e-apps.yaml -y
9094
- name: test 2 - check if pod is ready
9195
run: while [[ $(kubectl get pods -l app=dtm-e2e-go -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "pod not ready yet..."; sleep 3; done
9296
timeout-minutes: 10
93-
- name: test 3 - check flask app can be reached
94-
run:
97+
- name: test 2 - check flask app can be reached
98+
run: |
9599
# get cluster ip of the service created by the argocd
96-
clusterIP=$(kubectl get svc helloworld -n default -o jsonpath='{.spec.clusterIP}')
100+
clusterIP=$(kubectl get svc dtm-e2e-go -n default -o jsonpath='{.spec.clusterIP}')
97101
# curl flask url and check if it returns "Hello, World!", if not, echo error and exit 1
98102
curl -s http://$clusterIP:8080 | grep "Hello, World!" || (echo "failed to access to flask app" && exit 1)
99103
- name: test 2 - clean
100104
run: ./dtm delete -f e2e-apps.yaml -y
105+
# test3 is gitlabci-argocd
106+
- name: test 3 - apply (gitlabci-argocd)
107+
run: ./dtm apply --debug -f e2e-gitlabci-argocd.yaml -y
108+
- name: test 3 - apply (gitlabci-argocd) again
109+
run: ./dtm apply -f e2e-gitlabci-argocd.yaml -y
110+
- name: test 3 - check if pod is ready
111+
run: while [[ $(kubectl get pods -l app=dtme2egitlabciargocd -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "pod not ready yet..."; sleep 3; done
112+
timeout-minutes: 10
113+
- name: test 3 - check flask app can be reached
114+
run: |
115+
# get cluster ip of the service created by the argocd
116+
clusterIP=$(kubectl get svc dtme2egitlabciargocd -n default -o jsonpath='{.spec.clusterIP}')
117+
# curl flask url and check if it returns "Hello, World!", if not, echo error and exit 1
118+
curl -s http://$clusterIP:8080 | grep "Hello, World!" || (echo "failed to access to flask app" && exit 1)
119+
- name: test 2 - clean
120+
run: ./dtm delete -f e2e-gitlabci-argocd.yaml -y
101121
- name: test e2e success or not
102122
if: failure()
103123
run: |
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
config:
2+
state:
3+
backend: local
4+
options:
5+
stateFile: devstream-e2e-gitlabci-argocd.state
6+
7+
vars:
8+
appName: dtme2egitlabciargocd
9+
gitlabURL: https://gitlab.com
10+
gitlabUsername: aFlyBird
11+
defaultBranch: main
12+
dockerhubUser: dtme2etest
13+
14+
tools:
15+
- name: helm-installer
16+
instanceID: argocd
17+
apps:
18+
- name: [[ appName ]]
19+
spec:
20+
language: python
21+
framework: flask
22+
repo:
23+
url: [[ gitlabURL ]]/[[ gitlabUsername ]]/[[ appName ]].git
24+
branch: [[ defaultBranch ]]
25+
token: [[ env GITLAB_TOKEN ]] # use "GITLAB_TOKEN" env var
26+
repoTemplate:
27+
url: https://github.com/devstream-io/dtm-repo-scaffolding-python-flask.git
28+
ci:
29+
- type: template
30+
templateName: ci-pipeline
31+
cd:
32+
- type: argocdapp
33+
pipelineTemplates:
34+
- name: ci-pipeline
35+
type: gitlab-ci
36+
options:
37+
imageRepo:
38+
user: [[ dockerhubUser ]]
39+
password: [[ env DOCKERHUB_TOKEN]]
40+
runner:
41+
enable: true

0 commit comments

Comments
 (0)