From 9fe6dcde7612be127280da8136fd22a38812b446 Mon Sep 17 00:00:00 2001 From: superpoussin22 Date: Tue, 28 Aug 2018 08:45:04 +0200 Subject: [PATCH] detect if latest TAG is used (#575) that's always better to specify the version, latest desn't mean latest version it can be a suggestion if you prefer --- include/helper_audit_dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/helper_audit_dockerfile b/include/helper_audit_dockerfile index 05c9ad6f..1185fb2e 100644 --- a/include/helper_audit_dockerfile +++ b/include/helper_audit_dockerfile @@ -61,17 +61,23 @@ fi FIND=$(grep "^FROM" ${AUDIT_FILE} | sed 's/ /:space:/g') for I in ${FIND}; do IMAGE=$(echo ${I} | sed 's/:space:/ /g' | awk '{ if ($1=="FROM") { print $2 }}') + TAG=$(echo ${IMAGE} | cut -d':' -f2) Display --indent 2 --text "Found image:" --result "${IMAGE}" IS_DEBIAN=$(echo ${IMAGE} | grep -i debian) IS_FEDORA=$(echo ${IMAGE} | grep -i fedora) IS_UBUNTU=$(echo ${IMAGE} | grep -i ubuntu) IS_ALPINE=$(echo ${IMAGE} | grep -i alpine) + IS_LATEST=$(echo ${TAG} | grep -i latest) if [ ! "${IS_DEBIAN}" = "" ]; then IMAGE="debian"; fi if [ ! "${IS_FEDORA}" = "" ]; then IMAGE="fedora"; fi if [ ! "${IS_UBUNTU}" = "" ]; then IMAGE="ubuntu"; fi if [ ! "${IS_ALPINE}" = "" ]; then IMAGE="alpine"; fi + + if [ ! "${IS_LATEST}" = "" ]; then + ReportWarning "dockerfile" "latest TAG used. Specifying the version is better." + fi case ${IMAGE} in "debian")