Skip to content

Commit 0c3ddb7

Browse files
author
Max Azatian
committed
CI pipeline fix 2
1 parent d1d0b63 commit 0c3ddb7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
- name: Modify Docker Compose for CI
3636
run: |
3737
cp docker-compose.yaml docker-compose.ci.yaml
38-
# For the backend service
39-
yq eval '.services.backend.extra_hosts += ["host.docker.internal:host-gateway"]' -i docker-compose.ci.yaml
38+
# For the backend service (extra_hosts already exists, skip it)
39+
# Note: backend.environment is a list in docker-compose.yaml
4040
yq eval '.services.backend.environment += ["TESTING=true"]' -i docker-compose.ci.yaml
4141
yq eval '.services.backend.environment += ["MONGO_ROOT_USER=testroot"]' -i docker-compose.ci.yaml
4242
yq eval '.services.backend.environment += ["MONGO_ROOT_PASSWORD=testpassword"]' -i docker-compose.ci.yaml
@@ -48,9 +48,11 @@ jobs:
4848
yq eval '.services.mongo.environment.MONGO_INITDB_ROOT_PASSWORD = "testpassword"' -i docker-compose.ci.yaml
4949
5050
# For the cert-generator service
51-
yq eval '.services.cert-generator.extra_hosts += ["host.docker.internal:host-gateway"]' -i docker-compose.ci.yaml
52-
yq eval '.services.cert-generator.environment += ["CI=true"]' -i docker-compose.ci.yaml
53-
yq eval '.services.cert-generator.volumes += ["$HOME/.kube/config:/root/.kube/config:ro"]' -i docker-compose.ci.yaml
51+
# Check if extra_hosts exists, if not create it as a list
52+
yq eval 'select(.services."cert-generator".extra_hosts == null).services."cert-generator".extra_hosts = []' -i docker-compose.ci.yaml
53+
yq eval '.services."cert-generator".extra_hosts += ["host.docker.internal:host-gateway"]' -i docker-compose.ci.yaml
54+
yq eval '.services."cert-generator".environment += ["CI=true"]' -i docker-compose.ci.yaml
55+
yq eval '.services."cert-generator".volumes += [env(HOME) + "/.kube/config:/root/.kube/config:ro"]' -i docker-compose.ci.yaml
5456
5557
echo "--- Modified docker-compose.ci.yaml ---"
5658
cat docker-compose.ci.yaml

0 commit comments

Comments
 (0)