Skip to content

Instantly share code, notes, and snippets.

@lcarva
Last active January 17, 2024 17:35
Show Gist options
  • Save lcarva/3c42dac17b1997408f1e0db4328c5749 to your computer and use it in GitHub Desktop.
Save lcarva/3c42dac17b1997408f1e0db4328c5749 to your computer and use it in GitHub Desktop.
Display the Global Component List for an application in Konflux
#!/bin/bash
set -euo pipefail
APPLICATION=$1
echo "Global Component List for ${APPLICATION} application"
components="$(oc get component -o json | \
jq '.items[] | select(.spec.application == "'${APPLICATION}'") | "\(.metadata.name);\(.spec.containerImage)"' -r)"
for each in $components; do
component="${each%;*}"
ref="${each#*;}"
if [[ $ref == "null" ]]; then
when="null"
else
when="$(skopeo inspect --config docker://${ref} | jq '.config.Labels."build-date"')"
fi
echo
echo "* ${component}"
echo -e " Ref: ${ref}"
echo -e " Build date: ${when}"
done
@lcarva
Copy link
Author

lcarva commented Jan 17, 2024

Be sure to oc login to your cluster and use oc project to select the namespace.

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