Created
January 29, 2021 21:42
-
-
Save nickboldt/31136137a040ecb9082f19ef0f79e495 to your computer and use it in GitHub Desktop.
check rpms installed in a container (or diff two containers)
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
# copied from a jenkins job last used in Dec 2019 for CRW 2.0 | |
alias dr='docker run --rm --entrypoint /bin/bash' | |
if [[ ${CONTAINER1} ]]; then | |
dr ${CONTAINER1} -c "rpm -qa | sort" | tee CONTAINER1.installed.rpms.txt & | |
fi | |
if [[ ${CONTAINER2} ]]; then | |
dr ${CONTAINER2} -c "rpm -qa | sort" | tee CONTAINER2.installed.rpms.txt & | |
fi | |
wait | |
if [[ ${CONTAINER1} ]] && [[ ${CONTAINER2} ]]; then | |
diff --unified=1 --suppress-common-lines --ignore-all-space \ | |
CONTAINER1.installed.rpms.txt CONTAINER2.installed.rpms.txt | tee CONTAINERs.diff.rpms.txt | |
fi | |
set +x | |
if [[ $(cat CONTAINERs.diff.rpms.txt) ]]; then | |
echo "STATUS='RPM CHANGE in ${CONTAINER1} vs. ${CONTAINER2}'" | |
else | |
echo "STATUS='NO RPM CHANGE in ${CONTAINER1} vs. ${CONTAINER2}'" | |
fi | |
docker rmi ${CONTAINER1} ${CONTAINER2} | |
cat CONTAINERs.diff.rpms.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment