Skip to content

Commit c0d5b38

Browse files
feat: upload logs from all local-environment containers if PC node fails to start
1 parent ed2cc4b commit c0d5b38

File tree

1 file changed

+31
-5
lines changed
  • .github/actions/tests/local-environment-tests

1 file changed

+31
-5
lines changed

.github/actions/tests/local-environment-tests/action.yml

+31-5
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,43 @@ runs:
8383
pip install -r requirements.txt
8484
cd ..
8585
shell: bash
86-
- name: Wait for the PC node 1 to start
86+
- name: Wait for partner-chains-node-1 to start
87+
id: wait-pc-node
88+
continue-on-error: true
8789
run: |
90+
# Wait for the Cardano node to be ready
8891
while ! docker exec cardano-node-1 [ -e /shared/cardano.ready ]; do sleep 1; done
8992
echo "Cardano network is ready! Waiting for Partner Chain first node to start..."
9093
INIT_TIMESTAMP=$(docker exec cardano-node-1 cat /shared/cardano.start)
9194
echo "INIT_TIMESTAMP=$INIT_TIMESTAMP" >> $GITHUB_ENV
92-
while ! docker exec partner-chains-node-1 [ -e /shared/partner-chains-node-1.ready ]; do \
93-
epoch=$(docker exec cardano-node-1 cardano-cli query tip --testnet-magic 42 | jq -r .epoch) && \
94-
echo "Epoch: $epoch" && \
95-
sleep 10; \
95+
epoch=0
96+
while ! docker exec partner-chains-node-1 [ -e /shared/partner-chains-node-1.ready ]; do
97+
epoch=$(docker exec cardano-node-1 cardano-cli query tip --testnet-magic 42 | jq -r .epoch)
98+
echo "Epoch: $epoch"
99+
if [ "$epoch" -ge 3 ]; then
100+
echo "MC has reached epoch 3 and partner-chains-node-1 is still not ready. Failing test and gathering logs."
101+
exit 1
102+
fi
103+
sleep 10
104+
done
105+
shell: bash
106+
- name: Collect and zip Docker logs
107+
run: |
108+
mkdir -p docker_logs
109+
docker ps -a --format '{{.Names}}' | while read line; do
110+
echo "Collecting logs for container $line"
111+
docker logs "$line" > "docker_logs/$line.log" 2>&1 || true
96112
done
113+
zip -r docker_logs.zip docker_logs/
114+
shell: bash
115+
- name: Upload Docker logs artifact
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: docker_logs
119+
path: docker_logs.zip
120+
- name: Fail the job
121+
if: ${{ steps.wait-pc-node.outcome == 'failure' }}
122+
run: exit 1
97123
shell: bash
98124
- name: Run smoke tests
99125
uses: ./.github/actions/tests/run-e2e-tests

0 commit comments

Comments
 (0)