Skip to content

Commit ee610c7

Browse files
committed
Fix failure CI
1 parent 6d2373a commit ee610c7

File tree

4 files changed

+334
-7
lines changed

4 files changed

+334
-7
lines changed

.github/workflows/ci.yml

Lines changed: 322 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515

1616
jobs:
1717
test:
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-22.04
1919
strategy:
2020
matrix:
2121
include:
@@ -107,13 +107,44 @@ jobs:
107107
- name: Install plugin specific MySQL DDL
108108
if: ${{ matrix.docker-compose-file == 'docker-compose.ci.mysql.yml' }}
109109
run: |
110-
curl https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
110+
echo "Fetching DDL script from GitHub..."
111+
# First check if the DDL file is accessible
112+
if curl -s --head https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | head -n 1 | grep "200" > /dev/null; then
113+
echo "DDL file found, applying to MySQL..."
114+
curl -s https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
115+
else
116+
echo "Warning: DDL file not found at expected location, checking for alternative branches..."
117+
# Try main branch as an alternative
118+
if curl -s --head https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/main/src/main/resources/ddl.sql | head -n 1 | grep "200" > /dev/null; then
119+
echo "DDL file found on main branch, applying to MySQL..."
120+
curl -s https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/main/src/main/resources/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
121+
else
122+
echo "Error: Cannot find DDL file. Repository or file path might be incorrect."
123+
echo "Continuing without DDL, but this might cause issues later."
124+
fi
125+
fi
111126
- name: Install plugin specific PostgreSQL DDL
112127
if: ${{ matrix.docker-compose-file == 'docker-compose.ci.postgresql.yml' }}
113128
run: |
114-
curl https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
129+
echo "Fetching DDL script from GitHub..."
130+
# First check if the DDL file is accessible
131+
if curl -s --head https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | head -n 1 | grep "200" > /dev/null; then
132+
echo "DDL file found, applying to PostgreSQL..."
133+
curl -s https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
134+
else
135+
echo "Warning: DDL file not found at expected location, checking for alternative branches..."
136+
# Try main branch as an alternative
137+
if curl -s --head https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/main/src/main/resources/ddl.sql | head -n 1 | grep "200" > /dev/null; then
138+
echo "DDL file found on main branch, applying to PostgreSQL..."
139+
curl -s https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/main/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
140+
else
141+
echo "Error: Cannot find DDL file. Repository or file path might be incorrect."
142+
echo "Continuing without DDL, but this might cause issues later."
143+
fi
144+
fi
115145
- name: Install plugin
116146
run: |
147+
echo "Installing deposit plugin..."
117148
curl --connect-timeout 10 --max-time 30 -v \
118149
-X POST \
119150
-u admin:password \
@@ -131,17 +162,288 @@ jobs:
131162
}' \
132163
"http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo"
133164
134-
sudo snap install yq
165+
# Install tools we need
166+
echo "Installing jq for JSON parsing..."
167+
sudo apt-get update && sudo apt-get install -y jq
168+
169+
# Wait a bit before checking status
170+
echo "Giving the plugin some time to install..."
171+
sleep 10
172+
173+
# Debug: Check nodesInfo response
174+
echo "Checking nodesInfo response..."
175+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
176+
cat nodesInfo.json
177+
178+
count=0
179+
echo "Waiting for plugin to be in STOPPED state..."
180+
181+
# More robust check with better error handling
182+
until [[ "$(jq -r '.[]?.pluginsInfo[]? | select(.pluginKey == "deposit") | .state' nodesInfo.json 2>/dev/null)" == "STOPPED" ]]; do
183+
if [[ "$count" == "180" ]]; then
184+
echo "ERROR: Timed out waiting for plugin to be in STOPPED state."
185+
echo "Current plugin status:"
186+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" | jq
187+
exit 64
188+
fi
189+
190+
# Debug every 30 seconds
191+
if [[ "$((count % 30))" == "0" ]]; then
192+
echo "Checking plugin status (attempt $count)..."
193+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
194+
echo "Plugin status: $(jq -r '.[]?.pluginsInfo[]? | select(.pluginKey == "deposit") | .state' nodesInfo.json 2>/dev/null || echo "NOT_FOUND")"
195+
fi
196+
197+
count=$(( count + 1 ))
198+
sleep 1
199+
200+
# Update nodesInfo.json every iteration
201+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
202+
done
203+
204+
echo "Starting the deposit plugin..."
205+
curl --connect-timeout 10 --max-time 30 -v \
206+
-X POST \
207+
-u admin:password \
208+
-H 'Content-Type: application/json' \
209+
-H 'X-Killbill-CreatedBy: GitHub' \
210+
-d '{
211+
"nodeCommandProperties": [
212+
{
213+
"key": "pluginKey",
214+
"value": "deposit"
215+
}
216+
],
217+
"nodeCommandType": "START_PLUGIN",
218+
"isSystemCommandType": "true"
219+
}' \
220+
"http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo"
221+
222+
count=0
223+
echo "Waiting for plugin to be in RUNNING state..."
224+
225+
# More robust check with better error handling
226+
until [[ "$(jq -r '.[]?.pluginsInfo[]? | select(.pluginKey == "deposit") | .state' nodesInfo.json 2>/dev/null)" == "RUNNING" ]]; do
227+
if [[ "$count" == "180" ]]; then
228+
echo "ERROR: Timed out waiting for plugin to be in RUNNING state."
229+
echo "Current plugin status:"
230+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" | jq
231+
exit 65
232+
fi
233+
234+
# Debug every 30 seconds
235+
if [[ "$((count % 30))" == "0" ]]; then
236+
echo "Checking plugin status (attempt $count)..."
237+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
238+
echo "Plugin status: $(jq -r '.[]?.pluginsInfo[]? | select(.pluginKey == "deposit") | .state' nodesInfo.json 2>/dev/null || echo "NOT_FOUND")"
239+
fi
240+
241+
count=$(( count + 1 ))
242+
sleep 1
243+
name: ci
244+
245+
on:
246+
push:
247+
workflow_dispatch:
248+
249+
env:
250+
COMPOSE_DOCKER_CLI_BUILD: 1
251+
DB_NAME: kaui
252+
DOCKER_BUILDKIT: 1
253+
JRUBY_OPTS: -J-Xmx1024M
254+
KB_ADDRESS: 127.0.0.1
255+
KB_PORT: 8080
256+
RAILS_ENV: test
257+
258+
jobs:
259+
test:
260+
runs-on: ubuntu-22.04
261+
strategy:
262+
matrix:
263+
include:
264+
- ruby-version: '3.2.2'
265+
database-adapter: 'mysql2'
266+
database-user: 'root'
267+
database-password: 'root'
268+
database-port: '3306'
269+
docker-compose-file: 'docker-compose.ci.mysql.yml'
270+
- ruby-version: 'jruby-9.4.2.0'
271+
database-adapter: 'mysql2'
272+
database-user: 'root'
273+
database-password: 'root'
274+
database-port: '3306'
275+
docker-compose-file: 'docker-compose.ci.mysql.yml'
276+
- ruby-version: '3.2.2'
277+
database-adapter: 'postgresql'
278+
database-user: 'postgres'
279+
database-password: 'postgres'
280+
database-port: '5432'
281+
docker-compose-file: 'docker-compose.ci.postgresql.yml'
282+
- ruby-version: 'jruby-9.4.2.0'
283+
database-adapter: 'postgresql'
284+
database-user: 'postgres'
285+
database-password: 'postgres'
286+
database-port: '5432'
287+
docker-compose-file: 'docker-compose.ci.postgresql.yml'
288+
steps:
289+
- name: Checkout code
290+
uses: actions/checkout@v3
291+
- name: Set up Ruby
292+
uses: ruby/setup-ruby@v1
293+
with:
294+
ruby-version: ${{ matrix.ruby-version }}
295+
bundler-cache: true
296+
- name: Start stack
297+
run: |
298+
cd docker
299+
docker compose -p it -f ${{ matrix.docker-compose-file }} up --no-start
300+
docker start it-db-1
301+
- name: Wait for MySQL
302+
if: ${{ matrix.docker-compose-file == 'docker-compose.ci.mysql.yml' }}
303+
run: |
304+
set +e
305+
count=0
306+
until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
307+
if [[ "$count" == "25" ]]; then
308+
exit 1
309+
fi
310+
(( count++ ))
311+
printf '.'
312+
sleep 5
313+
done
314+
set -e
315+
- name: Wait for PostgreSQL
316+
if: ${{ matrix.docker-compose-file == 'docker-compose.ci.postgresql.yml' }}
317+
run: |
318+
set +e
319+
count=0
320+
until $(psql -h 127.0.0.1 -U postgres -p 5432 -l > /dev/null); do
321+
if [[ "$count" == "25" ]]; then
322+
exit 1
323+
fi
324+
(( count++ ))
325+
printf '.'
326+
sleep 5
327+
done
328+
set -e
329+
- name: Start Kill Bill
330+
# Sometimes it gets stuck (if Kill Bill starts when the DB isn't ready?)
331+
timeout-minutes: 4
332+
run: |
333+
docker start it-killbill-1
334+
count=0
335+
until $(curl --connect-timeout 10 --max-time 30 --output /dev/null --silent --fail http://${KB_ADDRESS}:${KB_PORT}/1.0/healthcheck); do
336+
if [[ "$count" == "180" ]]; then
337+
exit 64
338+
fi
339+
count=$(( count + 1 ))
340+
sleep 1
341+
done
342+
curl --connect-timeout 10 --max-time 30 -v \
343+
-X POST \
344+
-u admin:password \
345+
-H 'Content-Type: application/json' \
346+
-H 'X-Killbill-CreatedBy: GitHub' \
347+
-d '{"apiKey": "bob", "apiSecret": "lazar"}' \
348+
"http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/tenants"
349+
- name: Install plugin specific MySQL DDL
350+
if: ${{ matrix.docker-compose-file == 'docker-compose.ci.mysql.yml' }}
351+
run: |
352+
echo "Fetching DDL script from GitHub..."
353+
# First check if the DDL file is accessible
354+
if curl -s --head https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | head -n 1 | grep "200" > /dev/null; then
355+
echo "DDL file found, applying to MySQL..."
356+
curl -s https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
357+
else
358+
echo "Warning: DDL file not found at expected location, checking for alternative branches..."
359+
# Try main branch as an alternative
360+
if curl -s --head https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/main/src/main/resources/ddl.sql | head -n 1 | grep "200" > /dev/null; then
361+
echo "DDL file found on main branch, applying to MySQL..."
362+
curl -s https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/main/src/main/resources/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
363+
else
364+
echo "Error: Cannot find DDL file. Repository or file path might be incorrect."
365+
echo "Continuing without DDL, but this might cause issues later."
366+
fi
367+
fi
368+
- name: Install plugin specific PostgreSQL DDL
369+
if: ${{ matrix.docker-compose-file == 'docker-compose.ci.postgresql.yml' }}
370+
run: |
371+
echo "Fetching DDL script from GitHub..."
372+
# First check if the DDL file is accessible
373+
if curl -s --head https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | head -n 1 | grep "200" > /dev/null; then
374+
echo "DDL file found, applying to PostgreSQL..."
375+
curl -s https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/master/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
376+
else
377+
echo "Warning: DDL file not found at expected location, checking for alternative branches..."
378+
# Try main branch as an alternative
379+
if curl -s --head https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/main/src/main/resources/ddl.sql | head -n 1 | grep "200" > /dev/null; then
380+
echo "DDL file found on main branch, applying to PostgreSQL..."
381+
curl -s https://raw.githubusercontent.com/killbill/killbill-deposit-plugin/main/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
382+
else
383+
echo "Error: Cannot find DDL file. Repository or file path might be incorrect."
384+
echo "Continuing without DDL, but this might cause issues later."
385+
fi
386+
fi
387+
- name: Install plugin
388+
run: |
389+
echo "Installing deposit plugin..."
390+
curl --connect-timeout 10 --max-time 30 -v \
391+
-X POST \
392+
-u admin:password \
393+
-H 'Content-Type: application/json' \
394+
-H 'X-Killbill-CreatedBy: GitHub' \
395+
-d '{
396+
"nodeCommandProperties": [
397+
{
398+
"key": "pluginKey",
399+
"value": "deposit"
400+
}
401+
],
402+
"nodeCommandType": "INSTALL_PLUGIN",
403+
"isSystemCommandType": "true"
404+
}' \
405+
"http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo"
135406
407+
# Install tools we need
408+
echo "Installing jq for JSON parsing..."
409+
sudo apt-get update && sudo apt-get install -y jq
410+
411+
# Wait a bit before checking status
412+
echo "Giving the plugin some time to install..."
413+
sleep 10
414+
415+
# Debug: Check nodesInfo response
416+
echo "Checking nodesInfo response..."
417+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
418+
cat nodesInfo.json
419+
136420
count=0
137-
until [[ "$(curl -s -uadmin:password http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo | jq -r '.[].pluginsInfo[] | select(.pluginKey == "deposit").state')" == "STOPPED" ]]; do
421+
echo "Waiting for plugin to be in STOPPED state..."
422+
423+
# More robust check with better error handling
424+
until [[ "$(jq -r '.[]?.pluginsInfo[]? | select(.pluginKey == "deposit") | .state' nodesInfo.json 2>/dev/null)" == "STOPPED" ]]; do
138425
if [[ "$count" == "180" ]]; then
426+
echo "ERROR: Timed out waiting for plugin to be in STOPPED state."
427+
echo "Current plugin status:"
428+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" | jq
139429
exit 64
140430
fi
431+
432+
# Debug every 30 seconds
433+
if [[ "$((count % 30))" == "0" ]]; then
434+
echo "Checking plugin status (attempt $count)..."
435+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
436+
echo "Plugin status: $(jq -r '.[]?.pluginsInfo[]? | select(.pluginKey == "deposit") | .state' nodesInfo.json 2>/dev/null || echo "NOT_FOUND")"
437+
fi
438+
141439
count=$(( count + 1 ))
142440
sleep 1
441+
442+
# Update nodesInfo.json every iteration
443+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
143444
done
144445
446+
echo "Starting the deposit plugin..."
145447
curl --connect-timeout 10 --max-time 30 -v \
146448
-X POST \
147449
-u admin:password \
@@ -160,10 +462,24 @@ jobs:
160462
"http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo"
161463
162464
count=0
163-
until [[ "$(curl -s -uadmin:password http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo | jq -r '.[].pluginsInfo[] | select(.pluginKey == "deposit").state')" == "RUNNING" ]]; do
465+
echo "Waiting for plugin to be in RUNNING state..."
466+
467+
# More robust check with better error handling
468+
until [[ "$(jq -r '.[]?.pluginsInfo[]? | select(.pluginKey == "deposit") | .state' nodesInfo.json 2>/dev/null)" == "RUNNING" ]]; do
164469
if [[ "$count" == "180" ]]; then
470+
echo "ERROR: Timed out waiting for plugin to be in RUNNING state."
471+
echo "Current plugin status:"
472+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" | jq
165473
exit 65
166474
fi
475+
476+
# Debug every 30 seconds
477+
if [[ "$((count % 30))" == "0" ]]; then
478+
echo "Checking plugin status (attempt $count)..."
479+
curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
480+
echo "Plugin status: $(jq -r '.[]?.pluginsInfo[]? | select(.pluginKey == "deposit") | .state' nodesInfo.json 2>/dev/null || echo "NOT_FOUND")"
481+
fi
482+
167483
count=$(( count + 1 ))
168484
sleep 1
169485
done

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ group :development do
2424
gem 'sprockets-rails'
2525
end
2626

27+
# Temporary fix for JRuby 9.4.10.0 here: https://github.com/jruby/jruby/issues/7262
28+
gem 'jar-dependencies', '~> 0.4.1' if defined?(JRUBY_VERSION)
29+
2730
# gem 'killbill-assets-ui', github: 'killbill/killbill-assets-ui', ref: 'main'
2831
# gem 'killbill-assets-ui', path: '../killbill-assets-ui'
2932
gem 'killbill-assets-ui'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<%#
2+
This is a placeholder breadcrumb component for standalone gem usage.
3+
4+
This placeholder prevents "missing template" errors when running
5+
the gem independently during development or testing.
6+
%>
7+
8+
<!-- Breadcrumb placeholder for standalone gem -->

0 commit comments

Comments
 (0)