Last active
January 17, 2024 17:35
-
-
Save lcarva/3c42dac17b1997408f1e0db4328c5749 to your computer and use it in GitHub Desktop.
Display the Global Component List for an application in Konflux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Be sure to
oc login
to your cluster and useoc project
to select the namespace.