forked from oss-aspen/8Knot
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (158 loc) · 7.67 KB
/
end_to_end.yml
File metadata and controls
188 lines (158 loc) · 7.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Test Docker images
on:
push:
branches:
- main
- release
pull_request:
release:
types:
- published
workflow_dispatch:
permissions: {}
jobs:
test-e2e-podman:
name: End-to-end test (Podman)
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files from the base image
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Start Podman socket
run: systemctl --user start podman.socket
- name: Checkout repository
uses: actions/checkout@v4
- name: Build 8knot container
uses: redhat-actions/buildah-build@v2
with:
context: .
containerfiles: |
./docker/Dockerfile
platforms: linux/amd64
# ghcr.io/${{ github.repository_owner }}/
tags: 8knot-app:test
layers: true
- name: Prepare env file
run: |
cp .env.sample .env
- name: Prepare compose file
run: |
yq eval -i '.services.db-init.image = "8knot-app:test"' docker-compose.yml
yq eval -i '.services.db-init.pull_policy = "never"' docker-compose.yml
yq eval -i '.services.db-init.restart = "no"' docker-compose.yml
yq eval -i '.services.app-server.image = "8knot-app:test"' docker-compose.yml
yq eval -i '.services.app-server.pull_policy = "never"' docker-compose.yml
yq eval -i '.services.app-server.restart = "no"' docker-compose.yml
yq eval -i '.services.app-server.healthcheck.test = "curl -f http://localhost:8080/ || exit 1"' docker-compose.yml
yq eval -i '.services.app-server.healthcheck.interval = "15s"' docker-compose.yml
yq eval -i '.services.app-server.healthcheck.timeout = "2m"' docker-compose.yml
yq eval -i '.services.worker-callback.image = "8knot-app:test"' docker-compose.yml
yq eval -i '.services.worker-callback.pull_policy = "never"' docker-compose.yml
yq eval -i '.services.worker-callback.restart = "no"' docker-compose.yml
yq eval -i '.services.worker-query.image = "8knot-app:test"' docker-compose.yml
yq eval -i '.services.worker-query.pull_policy = "never"' docker-compose.yml
yq eval -i '.services.worker-query.restart = "no"' docker-compose.yml
yq eval -i '.services.mock-db.image = "ghcr.io/chaoss/augur_empty_database:latest"' docker-compose.yml
- name: Setup Podman Compose
uses: webgtx/setup-podman-compose@v1
- name: Set up list of log lines to match
run: |
cat <<EOF > /tmp/regex_matches.txt
Ready to accept connections
database system is ready to accept connections
Database connection established successfully!
ALL TABLES COMMITTED SUCCESSFULLY
POSTGRES CACHE SUCCESSFULLY INITIALIZED
AUGUR: Connection to DB succeeded
Listening at: http://0.0.0.0:8080
Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Configuration complete; ready for start up
EOF
- name: Start services & wait for output
# This starts the system and sends the output to "await_all.py" which
# scans for the regex matches from above. Once all matches are seen at
# least once, the `compose down` will run to shut down the system. If
# this all doesn't happen before the timeout, the job will fail.
run: |
podman compose -f docker-compose.yml up --no-build 2>&1 \
| (./scripts/ci/await_all.py /tmp/regex_matches.txt \
&& podman compose -f docker-compose.yml down)
timeout-minutes: 3
- name: Dump logs
# Always run this step to get logs, even if the previous step fails
if: always()
# We use tail so that we can see the name of each file as it's printed
run: "podman run -t --rm -v augur_logs:/logs bash -c 'find /logs -type f | xargs tail -n +0'"
test-e2e-docker:
name: End-to-end test (Docker)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: setup-buildx
- name: Build 8knot container
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
tags: 8knot-app:test
cache-from: type=gha,scope=container-database
cache-to: type=gha,scope=container-database,mode=min
load: true
- name: Prepare env file
run: |
cp .env.sample .env
- name: Prepare compose file
run: |
yq eval -i '.services.db-init.image = "8knot-app:test"' docker-compose.yml
yq eval -i '.services.db-init.pull_policy = "never"' docker-compose.yml
yq eval -i '.services.db-init.restart = "no"' docker-compose.yml
yq eval -i '.services.app-server.image = "8knot-app:test"' docker-compose.yml
yq eval -i '.services.app-server.pull_policy = "never"' docker-compose.yml
yq eval -i '.services.app-server.restart = "no"' docker-compose.yml
yq eval -i '.services.app-server.healthcheck.test = "curl -f http://localhost:8080/ || exit 1"' docker-compose.yml
yq eval -i '.services.app-server.healthcheck.interval = "15s"' docker-compose.yml
yq eval -i '.services.app-server.healthcheck.timeout = "2m"' docker-compose.yml
yq eval -i '.services.worker-callback.image = "8knot-app:test"' docker-compose.yml
yq eval -i '.services.worker-callback.pull_policy = "never"' docker-compose.yml
yq eval -i '.services.worker-callback.restart = "no"' docker-compose.yml
yq eval -i '.services.worker-query.image = "8knot-app:test"' docker-compose.yml
yq eval -i '.services.worker-query.pull_policy = "never"' docker-compose.yml
yq eval -i '.services.worker-query.restart = "no"' docker-compose.yml
yq eval -i '.services.mock-db.image = "ghcr.io/chaoss/augur_empty_database:latest"' docker-compose.yml
- name: Setup Docker Compose
uses: docker/setup-compose-action@v1
with:
version: latest
- name: Set up list of log lines to match
run: |
cat <<EOF > /tmp/regex_matches.txt
Ready to accept connections
database system is ready to accept connections
Database connection established successfully!
ALL TABLES COMMITTED SUCCESSFULLY
POSTGRES CACHE SUCCESSFULLY INITIALIZED
AUGUR: Connection to DB succeeded
Listening at: http://0.0.0.0:8080
Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Configuration complete; ready for start up
EOF
- name: Start services & wait for output
# This starts the system and sends the output to "await_all.py" which
# scans for the regex matches from above. Once all matches are seen at
# least once, the `compose down` will run to shut down the system. If
# this all doesn't happen before the timeout, the job will fail.
run: |
docker compose -f docker-compose.yml up --no-build 2>&1 \
| (./scripts/ci/await_all.py /tmp/regex_matches.txt \
&& docker compose -f docker-compose.yml down)
timeout-minutes: 3
- name: Dump logs
# Always run this step to get logs, even if the previous step fails
if: always()
# We use tail so that we can see the name of each file as it's printed
run: "docker run -t --rm -v augur_logs:/logs bash -c 'find /logs -type f | xargs tail -n +0'"