Skip to content

Instantly share code, notes, and snippets.

@kk7ds
Last active March 1, 2024 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kk7ds/9a77939bd314cd4b5a35139adcdcedce to your computer and use it in GitHub Desktop.
Save kk7ds/9a77939bd314cd4b5a35139adcdcedce to your computer and use it in GitHub Desktop.
Tool to fetch, convert and display openstack gate job journals
#!/bin/bash
# Usage: call with a base url to a gate job log, like:
# https://zuul.opendev.org/t/openstack/build/83d6dc665c2643f88d0025c385987c92
#
# Any other arguments go to the journalctl
URL="$1"
shift
uuid=$(echo $URL | cut -d / -f 7)
tmpf="/tmp/openstack-${uuid}.journal"
if [ ! -f "$tmpf" ]; then
logs=$(curl -s https://zuul.opendev.org/api/tenant/openstack/builds?uuid=${uuid} | jq -r '.[0].log_url')
journal_url="${logs}controller/logs/devstack.journal.gz"
curl -s "$journal_url" | zcat | /usr/lib/systemd/systemd-journal-remote - -o "$tmpf"
fi
journalctl --file "$tmpf" $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment