Skip to content

Commit e7e9693

Browse files
committed
also debug docker action
1 parent 831b9f8 commit e7e9693

File tree

3 files changed

+44
-12
lines changed

3 files changed

+44
-12
lines changed

.github/workflows/zhook.yml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,41 @@ jobs:
4141
INPUT_EVENTJSON: ${{ toJson(github.event) }}
4242
INPUT_SENDERUSERNAME: GitHubZ
4343
INPUT_SENDERICONURL: https://github.com/fluidicon.png
44-
ZITI_LOG: 6
45-
TLSUV_DEBUG: 6
44+
INPUT_ZITILOGLEVEL: 6
4645
shell: bash
4746
run: |
4847
set -o pipefail
4948
set -o xtrace
5049
pip install --user --upgrade --requirement ./requirements.txt
51-
sudo sysctl -w kernel.core_pattern='/tmp/core.%e.%p.%t'
50+
sudo mkdir -m0777 ${{ github.workspace }}/cores
51+
sudo sysctl -w kernel.core_pattern='${{ github.workspace }}/cores/core.%e.%p.%t'
5252
ulimit -c unlimited
5353
valgrind --verbose --log-file=/tmp/zook.py-valgrind-%p-%n.log --leak-check=full python ./zhook.py
5454
55+
- name: Run as Docker Action with Core Dumps
56+
if: |
57+
github.repository_owner == 'openziti'
58+
&& ((github.event_name != 'pull_request_review')
59+
|| (github.event_name == 'pull_request_review' && github.event.review.state == 'approved'))
60+
shell: bash
61+
run: |
62+
set -o pipefail
63+
set -o xtrace
64+
docker build -t zhook-action .
65+
docker run --rm \
66+
-v "${{ github.workspace }}:${{ github.workspace }}" \
67+
-w "${{ github.workspace }}" \
68+
-e INPUT_ZITIID="${{ secrets.ZITI_MATTERMOST_IDENTITY }}" \
69+
-e INPUT_WEBHOOKURL="${{ secrets.ZHOOK_URL_DEV_NOTIFICATIONS }}" \
70+
-e INPUT_EVENTJSON='${{ toJson(github.event) }}' \
71+
-e INPUT_SENDERUSERNAME="GitHubZ" \
72+
-e INPUT_ZITILOGLEVEL="6" \
73+
--entrypoint /bin/sh \
74+
zhook-action -xc "
75+
ulimit -c unlimited
76+
exec /app/zhook.py
77+
"
78+
5579
- uses: ./
5680
name: Run as a GH Action from the Local Checkout
5781
if: |
@@ -63,6 +87,7 @@ jobs:
6387
webhookUrl: ${{ secrets.ZHOOK_URL_DEV_NOTIFICATIONS }}
6488
eventJson: ${{ toJson(github.event) }}
6589
senderUsername: GitHubZ
90+
zitiLogLevel: 6
6691

6792
- name: Print Debug Info
6893
if: always()
@@ -75,7 +100,10 @@ jobs:
75100
echo "DEBUG: LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}"
76101
find $(python -c "import site; print(site.USER_SITE)") -path "*/openziti*" -name "*.so*" -type f -print0 | xargs -0r ldd
77102
cat /tmp/zook.py-valgrind-*.log
78-
if [ -s /tmp/core.python.* ]; then
79-
echo "DEBUG: Core dump found"
80-
gdb -q $(realpath $(which python)) -c /tmp/core.python.* --ex bt --ex exit
81-
fi
103+
for CORE in ${{ github.workspace }}/cores/core.*; do
104+
if [ -s "$CORE" ]; then
105+
echo "DEBUG: Core dump found: $CORE"
106+
EXECUTABLE=$(basename "$CORE" | cut -d. -f2)
107+
gdb -q $(realpath $(which "$EXECUTABLE")) -c "$CORE" --ex bt --ex exit
108+
fi
109+
done

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
FROM python:3-slim AS builder
22

3-
RUN pip install --target=/app requests openziti
3+
COPY requirements.txt /tmp/requirements.txt
4+
RUN pip install --target=/app --requirement /tmp/requirements.txt
45

56
# https://github.com/GoogleContainerTools/distroless
67
FROM gcr.io/distroless/python3-debian12
78
COPY --from=builder /app /app
8-
COPY ./zhook.py /app/zhook.py
9+
COPY --chmod=0755 ./zhook.py /app/zhook.py
910
WORKDIR /app
1011
ENV PYTHONPATH=/app
11-
ENV ZITI_LOG=6
12-
ENV TLSUV_DEBUG=6
12+
1313
CMD ["/app/zhook.py"]

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ inputs:
2222
required: false
2323
default: https://github.com/fluidicon.png
2424
destChannel:
25-
description: Mattermost channel (deprecated because incoming webhooks are now locked to a channel)
25+
description: Mattermost channel (ignored because incoming webhooks are locked to a channel)
2626
required: false
2727
default: null
28+
zitiLogLevel:
29+
description: Ziti log level
30+
required: false
31+
default: 3
2832
runs:
2933
using: docker
3034
image: Dockerfile

0 commit comments

Comments
 (0)