Skip to content

Instantly share code, notes, and snippets.

@nickboldt
Last active April 4, 2025 15:44
Show Gist options
  • Save nickboldt/e2ff2a09ba67d3a13f2902e1bb331042 to your computer and use it in GitHub Desktop.
Save nickboldt/e2ff2a09ba67d3a13f2902e1bb331042 to your computer and use it in GitHub Desktop.
get RHDH metadata from container

fetch build metadata from a RHDH container

because js apps like to obfuscate things in .js files this will extract the info into useable json:

TAG=1.5-182
TAG=1.6-76
TAG=1.7-6
podman run -it --rm --entrypoint /bin/bash --user root -v .:/host-mount quay.io/rhdh/rhdh-hub-rhel9:$TAG -c \
'grep -H -R "RHDH Metadata" /opt/app-root/src/packages/app/dist/static/ | tr "," "\n" | grep Upstream -A2 -B2 | \
sed -r -e "s/$/,/" -e "s/\}.\),//" -e s/"\"(N|card)\"://"' \
| jq -c . | jq

gets

[
  "RHDH Version: 1.5.2",
  "Backstage Version: 1.35.1",
  "Upstream: https://github.com/redhat-developer/rhdh/tree/release-1.5 @ 252b1171",
  "Midstream: https://gitlab.cee.redhat.com/rhidp/rhdh/-/commits/rhdh-1.5-rhel-9 @ 750ab35b",
  "Build Time: 2025-04-04T12:49:35Z"
]

OR

{
  "RHDH Version": "1.6.0",
  "Backstage Version": "1.36.1",
  "Upstream": "https://github.com/redhat-developer/rhdh/tree/release-1.6 @ a5fc5ab6",
  "Midstream": "https://gitlab.cee.redhat.com/rhidp/rhdh/-/commits/rhdh-1.6-rhel-9 @ 9efe3ff8",
  "Build Time": "2025-04-03T21:05:31Z"
}

If container is already running, execute this at the console:

grep -H -R "RHDH Metadata" /opt/app-root/src/packages/app/dist/static/ | tr "," "\n" | grep Upstream -A2 -B2 | \
sed -r -e "s/$/,/" -e "s/\}.\),//" -e s/"\"(N|card)\"://"
@nickboldt
Copy link
Author

Or without pulling the image, use skopeo to get the upstream branch+commit and downstream branch:

q=quay.io/rhdh/rhdh-hub-rhel9:1.7-7
skopeo inspect "docker://$q" | jq -r '.Env[] | select(.|test("_REPO=")?)'
UPSTREAM_REPO=https://github.com/redhat-developer/rhdh/tree/main @ a2ccb15b
MIDSTREAM_REPO=https://gitlab.cee.redhat.com/rhidp/rhdh/-/commits/rhdh-1-rhel-9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment