Skip to content

Commit 77b45c7

Browse files
committed
chore: Enhance CI log processing with snazy
* Installed the 'chmouel/snazy' tool in the e2e GitHub Actions workflow. * Modified the CI script (`hack/gh-workflow-ci.sh`) to collect logs from pac pods. * Utilized 'snazy' (with a fallback) to format collected logs for improved readability. * These changes facilitate easier debugging of CI failures by providing clearer and more relevant logs. Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
1 parent 9b5ec18 commit 77b45c7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/workflows/e2e.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ jobs:
8484
with:
8585
repo: chmouel/gosmee
8686

87+
- name: Install Snazy
88+
uses: jaxxstorm/action-install-gh-release@v2.0.0
89+
with:
90+
repo: chmouel/snazy
91+
8792
- name: Run gosmee
8893
run: |
8994
nohup gosmee client --saveDir /tmp/gosmee-replay ${{ secrets.PYSMEE_URL }} "http://${CONTROLLER_DOMAIN_URL}" &

hack/gh-workflow-ci.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ collect_logs() {
9797
local github_ghe_smee_url="${TEST_GITHUB_SECOND_SMEE_URL}"
9898

9999
mkdir -p /tmp/logs
100+
# Output logs to stdout so we can see via the web interface directly
101+
kubectl logs -n pipelines-as-code -l app.kubernetes.io/part-of=pipelines-as-code \
102+
--all-containers=true --tail=1000 >/tmp/logs/pac-pods.log
103+
if command -v "snazy" >/dev/null 2>&1; then
104+
snazy --skip-line-regexp="^(Reconcile (succeeded|error)|Updating webhook)" /tmp/logs/pac-pods.log
105+
else
106+
# snazy for the poors
107+
python -c "import sys,json,datetime; [print(f'• { (lambda t: datetime.datetime.fromisoformat(t.rstrip(\"Z\")).strftime(\"%H:%M:%S\") if isinstance(t,str) else datetime.datetime.fromtimestamp(t).strftime(\"%H:%M:%S\"))(json.loads(l.strip())[\"ts\"] )} {json.loads(l.strip()).get(\"msg\",\"\")}') if l.strip().startswith('{') else print(l.strip()) for l in sys.stdin]" \
108+
</tmp/logs/pac-pods.log
109+
fi
110+
100111
kind export logs /tmp/logs
101112
[[ -d /tmp/gosmee-replay ]] && cp -a /tmp/gosmee-replay /tmp/logs/
102113

0 commit comments

Comments
 (0)