1515
1616jobs :
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,46 @@ jobs:
131162 }' \
132163 "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo"
133164
134- sudo snap install yq
135-
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+
136178 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
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
138183 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
139187 exit 64
140188 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+
141197 count=$(( count + 1 ))
142198 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
143202 done
144203
204+ echo "Starting the deposit plugin..."
145205 curl --connect-timeout 10 --max-time 30 -v \
146206 -X POST \
147207 -u admin:password \
@@ -160,13 +220,32 @@ jobs:
160220 "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo"
161221
162222 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
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
164227 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
165231 exit 65
166232 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+
167241 count=$(( count + 1 ))
168242 sleep 1
243+
244+ # Update nodesInfo.json every iteration
245+ curl -s -uadmin:password "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo" > nodesInfo.json
169246 done
247+
248+ echo "Plugin is now in RUNNING state."
170249 - name : Run tests
171250 env :
172251 DB_ADAPTER : ${{ matrix.database-adapter }}
@@ -180,7 +259,7 @@ jobs:
180259 if : failure()
181260 run : |
182261 echo "[DEBUG] killbill healthcheck"
183- curl --connect-timeout 10 --max-time 30 -v http://${KB_ADDRESS}:${KB_PORT}/1.0/healthcheck || true
262+ curl --connect-timeout 10 --max-time 30 -v http://$\ {KB_ADDRESS\ }:$\ {KB_PORT\ }/1.0/healthcheck || true
184263 echo "[DEBUG] hostname"
185264 hostname
186265 echo "[DEBUG] netstat -tulpn"
0 commit comments