Skip to content

Commit f112ac4

Browse files
ci: pin platformatic world image to 0.7.0 and harden community-world runner
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
1 parent 9f3f5f3 commit f112ac4

4 files changed

Lines changed: 37 additions & 22 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
Add Platformatic to `worlds-manifest.json` as a community world, and add a generic `docker` service type to the community-world CI so worlds can declare arbitrary Docker containers in their manifest `services` array. Platformatic's CI job is gated by the existing `if: false` on `e2e-community` until community worlds ship CBOR queue transport support.

.github/workflows/e2e-community-world.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,16 @@ jobs:
8989
9090
- name: Start Docker services
9191
if: ${{ inputs.service-type == 'docker' }}
92+
# Services start serially in manifest order. Each service's health check
93+
# must pass before the next one starts, so any service that depends on
94+
# another (e.g. a workflow service that needs postgres) must be listed
95+
# AFTER its dependency in the manifest's `services` array.
96+
#
97+
# `healthCheck.cmd` is executed via `sh -c` below, which means the
98+
# manifest is a shell-execution surface. Safe here because
99+
# `worlds-manifest.json` is in-repo and PR-reviewed.
92100
run: |
101+
set -euo pipefail
93102
SERVICES='${{ inputs.services }}'
94103
count=$(echo "$SERVICES" | jq '. | length')
95104
for idx in $(seq 0 $((count - 1))); do
@@ -99,18 +108,21 @@ jobs:
99108
health_cmd=$(echo "$svc" | jq -r '.healthCheck.cmd // empty')
100109
retries=$(echo "$svc" | jq -r '.healthCheck.retries // 10')
101110
102-
# Build docker run command with env flags
103-
cmd="docker run -d --name $name --network host"
104-
for key in $(echo "$svc" | jq -r '.env // {} | keys[]'); do
105-
val=$(echo "$svc" | jq -r ".env[\"$key\"]")
106-
cmd="$cmd -e $key=$val"
107-
done
108-
cmd="$cmd $image"
111+
# Build docker run as an array so env values with spaces/quotes
112+
# survive intact (no shell re-interpretation via eval).
113+
args=(docker run -d --name "$name" --network host)
114+
env_lines=$(echo "$svc" | jq -r '.env // {} | to_entries[] | "\(.key)=\(.value)"')
115+
if [ -n "$env_lines" ]; then
116+
while IFS= read -r line; do
117+
args+=(-e "$line")
118+
done <<< "$env_lines"
119+
fi
120+
args+=("$image")
109121
110122
echo "Starting $name ($image)..."
111-
eval "$cmd"
123+
"${args[@]}"
112124
113-
# Health check runs on the host (--network host shares the network)
125+
# Health check runs on the host (--network host shares the network).
114126
if [ -n "$health_cmd" ]; then
115127
echo "Waiting for $name to be ready..."
116128
for i in $(seq 1 "$retries"); do
@@ -119,7 +131,8 @@ jobs:
119131
break
120132
fi
121133
if [ "$i" -eq "$retries" ]; then
122-
echo "WARNING: $name health check did not pass after $retries retries"
134+
echo "ERROR: $name health check did not pass after $retries retries"
135+
exit 1
123136
fi
124137
sleep 2
125138
done

scripts/create-community-worlds-matrix.mjs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ const testableWorlds = manifest.worlds.filter((world) => {
4646
// Build the matrix
4747
const matrix = {
4848
world: testableWorlds.map((world) => {
49-
// Determine service type based on services array
49+
// Determine service type based on services array.
50+
// `mongodb` and `redis` have dedicated single-service CI steps; anything
51+
// else (or any multi-service world) goes through the generic `docker`
52+
// path driven by the manifest's `services` array.
5053
let serviceType = 'none';
5154
if (world.services && world.services.length > 0) {
52-
// Use the first service's name as the service type
53-
// mongodb and redis have dedicated CI steps; everything else
54-
// is started generically via the manifest services definition
55-
const serviceName = world.services[0].name;
56-
if (['mongodb', 'redis'].includes(serviceName)) {
57-
serviceType = serviceName;
55+
if (world.services.length === 1) {
56+
const serviceName = world.services[0].name;
57+
serviceType = ['mongodb', 'redis'].includes(serviceName)
58+
? serviceName
59+
: 'docker';
5860
} else {
5961
serviceType = 'docker';
6062
}

worlds-manifest.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,19 @@
172172
},
173173
"healthCheck": {
174174
"cmd": "pg_isready -h localhost",
175-
"interval": "10s",
176-
"timeout": "5s",
177175
"retries": 5
178176
}
179177
},
180178
{
181179
"name": "platformatic-workflow",
182-
"image": "platformatic/workflow:latest",
180+
"image": "platformatic/workflow:0.7.0",
183181
"ports": ["3042:3042"],
184182
"env": {
185183
"DATABASE_URL": "postgres://wf:wf@localhost:5432/workflow",
186184
"PORT": "3042"
187185
},
188186
"healthCheck": {
189187
"cmd": "curl -sf http://localhost:3042/status",
190-
"interval": "10s",
191-
"timeout": "5s",
192188
"retries": 10
193189
}
194190
}

0 commit comments

Comments
 (0)