Last active
November 3, 2023 12:39
-
-
Save jgato/be0d1741c6b6f7194b6a72d87ac7eabd to your computer and use it in GitHub Desktop.
Script to get information from an assisted image container image
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 | |
# | |
echo "Execute the command from a directory containing a Git repo of the assisted-service" | |
echo "Also, exports a proper KUBECONFIG to your Openshift cluster with RHACM installed" | |
IMAGE=`oc -n multicluster-engine get deployment infrastructure-operator -o yaml | grep agent-service-rhel8 | grep image | awk '{print $2}'` | |
echo "#########################################" | |
echo "Assisted service image is: $IMAGE" | |
COMMIT=`skopeo inspect docker://${IMAGE} | grep "org.label-schema.vcs-ref" | awk '{print $2}' | awk -F '"' '{print $2}'` | |
echo "The image was built from https://github.com/openshift/assisted-service/commit/$COMMIT" | |
echo "#########################################" | |
git log --pretty=medium -1 ${COMMIT} | |
echo "#########################################" | |
BRANCH=`git branch -a --contains ${COMMIT} | tr -d '[:space:]'` | |
echo "The commit was done on branch(es): $BRANCH" | |
#it could be more than one branch ToDo: interate | |
#but you are mainly interested in the branc/version of your ACM | |
#if acm2.6 you are interested on branch ocm-release-2.6 | |
echo "All these other commits are not included in the current installed version" | |
git rev-list ${COMMIT}..${BRANCH} --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative | |
echo "#########################################" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment