Skip to content

Commit cf62266

Browse files
committed
Adjusted build to match upstream changes, fixed and improved tests
1 parent 113751c commit cf62266

File tree

1 file changed

+52
-17
lines changed

1 file changed

+52
-17
lines changed

dkron.yaml

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ package:
1212
environment:
1313
contents:
1414
packages:
15+
- buf
1516
- build-base
1617
- bun
1718
- ca-certificates-bundle
1819
- corepack
1920
- go
21+
- jq
2022
- nodejs-20
21-
- protobuf
23+
- pnpm
2224
- protobuf-dev
23-
- protoc
2425
- protoc-gen-go
2526
- protoc-gen-go-grpc
26-
- yarn
2727

2828
pipeline:
2929
- uses: git-checkout
@@ -34,18 +34,21 @@ pipeline:
3434

3535
- name: Generate protobuf files
3636
runs: |
37-
# Generate protobuf files as per Makefile - protobuf-dev should provide Google well-known types
38-
protoc -I proto/types/v1/ \
39-
--go_out=types --go_opt=paths=source_relative \
40-
--go-grpc_out=types --go-grpc_opt=paths=source_relative \
41-
proto/*.proto
37+
# Generate protobuf files using buf (as upstream does)
38+
# buf will use buf.gen.yaml to generate to gen/proto/types/v1/
39+
buf generate
4240
4341
- name: Build UI components
4442
runs: |
4543
cd ui
44+
# Add query-string as explicit dependency (pnpm requires it, yarn was more permissive)
45+
jq '.dependencies["query-string"] = "^7.1.3"' package.json > package.json.tmp
46+
mv package.json.tmp package.json
47+
4648
corepack enable
47-
yarn install --frozen-lockfile
48-
yarn build --out-dir ../dkron/ui-dist
49+
# Upstream uses pnpm now
50+
pnpm install
51+
pnpm build --out-dir ../dkron/ui-dist
4952
cd ..
5053
5154
echo "UI build output for debugging:"
@@ -138,32 +141,64 @@ test:
138141
environment:
139142
contents:
140143
packages:
144+
- ca-certificates-bundle
145+
- coreutils
141146
- curl
142147
- netcat-openbsd
148+
- nodejs
143149
- procps
144-
- coreutils
145150
- wait-for-it
146-
- nodejs
147151
pipeline:
148152
- name: Verify dkron version
149153
runs: |
150154
dkron version | grep -q "${{package.version}}"
151155
- name: Verify dkron help and commands
152156
runs: dkron agent --help | grep -q "Start a dkron agent"
153-
- runs: |
154-
mkdir -p /tmp/dkron-test
157+
- name: Test dkron agent startup and API
158+
runs: |
159+
mkdir -p /tmp/dkron-test/data
155160
cat > /tmp/dkron-test/dkron.json <<EOF
156161
{
157162
"bind-addr": "127.0.0.1:8946",
163+
"advertise-addr": "127.0.0.1:8946",
158164
"http-addr": "127.0.0.1:8080",
159165
"node-name": "test-node",
160166
"server": true,
161167
"bootstrap-expect": 1,
162168
"data-dir": "/tmp/dkron-test/data"
163169
}
164170
EOF
165-
dkron agent --config /tmp/dkron-test/dkron.json > /tmp/dkron-agent.log 2>&1 & sleep 2
166-
grep -qE "(agent: Dkron agent starting|agent: Listen for events)" /tmp/dkron-agent.log
167-
wait-for-it 127.0.0.1:8080 -t 15
171+
172+
# Start agent in background
173+
dkron agent --config /tmp/dkron-test/dkron.json > /tmp/dkron-agent.log 2>&1 &
174+
AGENT_PID=$!
175+
echo "Started dkron agent with PID $AGENT_PID"
176+
177+
# Give it a moment and check if it's still running
178+
sleep 3
179+
if ! kill -0 $AGENT_PID 2>/dev/null; then
180+
echo "ERROR: Agent process died immediately. Logs:"
181+
cat /tmp/dkron-agent.log
182+
exit 1
183+
fi
184+
185+
# Show initial logs
186+
echo "Agent appears to be running, first few log lines:"
187+
head -20 /tmp/dkron-agent.log || true
188+
189+
# Wait for HTTP server
190+
if ! wait-for-it 127.0.0.1:8080 -t 30; then
191+
echo "ERROR: HTTP server did not start. Full logs:"
192+
cat /tmp/dkron-agent.log
193+
exit 1
194+
fi
195+
196+
# Test API endpoint
197+
echo "Testing API endpoint..."
168198
curl -sf http://127.0.0.1:8080/v1/ | grep -q '"server":"true"'
199+
200+
# Test UI is served
201+
echo "Testing UI..."
169202
curl -Ls http://127.0.0.1:8080/ui/ | grep -i "<title>Dkron</title>"
203+
204+
echo "All tests passed!"

0 commit comments

Comments
 (0)