From f304819231df3c85a5bbb6188b8a7899baafbff8 Mon Sep 17 00:00:00 2001 From: Adam Cmiel Date: Tue, 24 Sep 2024 13:50:33 +0200 Subject: [PATCH] buildah: address uncovered checkton warnings The '... -t $IMAGE' line changed, making checkton report the violations on this line: - $IMAGE needs quotes (valid) - $IMAGE is a potential misspelling of $image (not valid, IMAGE is defined externally but checkton doesn't know that) Signed-off-by: Adam Cmiel --- task/buildah-oci-ta/0.2/buildah-oci-ta.yaml | 7 +++++-- task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml | 7 +++++-- task/buildah-remote/0.2/buildah-remote.yaml | 7 +++++-- task/buildah/0.2/buildah.yaml | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml b/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml index 5018a6515b..a546a3ede1 100644 --- a/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml +++ b/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml @@ -417,15 +417,18 @@ spec: done < <(find $ADDITIONAL_SECRET_TMP -maxdepth 1 -type f -exec basename {} \;) fi + # Prevent ShellCheck from giving a warning because 'image' is defined and 'IMAGE' is not. + declare IMAGE + unshare -Uf $UNSHARE_ARGS --keep-caps -r --map-users 1,1,65536 --map-groups 1,1,65536 -w ${SOURCE_CODE_DIR}/$CONTEXT -- buildah build \ $VOLUME_MOUNTS \ "${BUILDAH_ARGS[@]}" \ "${LABELS[@]}" \ --tls-verify=$TLSVERIFY --no-cache \ --ulimit nofile=4096:4096 \ - -f "$dockerfile_copy" -t $IMAGE . + -f "$dockerfile_copy" -t "$IMAGE" . - container=$(buildah from --pull-never $IMAGE) + container=$(buildah from --pull-never "$IMAGE") buildah mount $container | tee /shared/container_path # delete symlinks - they may point outside the container rootfs, messing with SBOM scanners find $(cat /shared/container_path) -xtype l -delete diff --git a/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml b/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml index 8254ba6a96..e838865580 100644 --- a/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml +++ b/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml @@ -452,15 +452,18 @@ spec: done < <(find $ADDITIONAL_SECRET_TMP -maxdepth 1 -type f -exec basename {} \;) fi + # Prevent ShellCheck from giving a warning because 'image' is defined and 'IMAGE' is not. + declare IMAGE + unshare -Uf $UNSHARE_ARGS --keep-caps -r --map-users 1,1,65536 --map-groups 1,1,65536 -w ${SOURCE_CODE_DIR}/$CONTEXT -- buildah build \ $VOLUME_MOUNTS \ "${BUILDAH_ARGS[@]}" \ "${LABELS[@]}" \ --tls-verify=$TLSVERIFY --no-cache \ --ulimit nofile=4096:4096 \ - -f "$dockerfile_copy" -t $IMAGE . + -f "$dockerfile_copy" -t "$IMAGE" . - container=$(buildah from --pull-never $IMAGE) + container=$(buildah from --pull-never "$IMAGE") buildah mount $container | tee /shared/container_path # delete symlinks - they may point outside the container rootfs, messing with SBOM scanners find $(cat /shared/container_path) -xtype l -delete diff --git a/task/buildah-remote/0.2/buildah-remote.yaml b/task/buildah-remote/0.2/buildah-remote.yaml index 8e9146d7fe..1aeff9e56b 100644 --- a/task/buildah-remote/0.2/buildah-remote.yaml +++ b/task/buildah-remote/0.2/buildah-remote.yaml @@ -434,15 +434,18 @@ spec: done < <(find $ADDITIONAL_SECRET_TMP -maxdepth 1 -type f -exec basename {} \;) fi + # Prevent ShellCheck from giving a warning because 'image' is defined and 'IMAGE' is not. + declare IMAGE + unshare -Uf $UNSHARE_ARGS --keep-caps -r --map-users 1,1,65536 --map-groups 1,1,65536 -w ${SOURCE_CODE_DIR}/$CONTEXT -- buildah build \ $VOLUME_MOUNTS \ "${BUILDAH_ARGS[@]}" \ "${LABELS[@]}" \ --tls-verify=$TLSVERIFY --no-cache \ --ulimit nofile=4096:4096 \ - -f "$dockerfile_copy" -t $IMAGE . + -f "$dockerfile_copy" -t "$IMAGE" . - container=$(buildah from --pull-never $IMAGE) + container=$(buildah from --pull-never "$IMAGE") buildah mount $container | tee /shared/container_path # delete symlinks - they may point outside the container rootfs, messing with SBOM scanners find $(cat /shared/container_path) -xtype l -delete diff --git a/task/buildah/0.2/buildah.yaml b/task/buildah/0.2/buildah.yaml index 42dc7cf2b0..8c8719b253 100644 --- a/task/buildah/0.2/buildah.yaml +++ b/task/buildah/0.2/buildah.yaml @@ -354,15 +354,18 @@ spec: done < <(find $ADDITIONAL_SECRET_TMP -maxdepth 1 -type f -exec basename {} \;) fi + # Prevent ShellCheck from giving a warning because 'image' is defined and 'IMAGE' is not. + declare IMAGE + unshare -Uf $UNSHARE_ARGS --keep-caps -r --map-users 1,1,65536 --map-groups 1,1,65536 -w ${SOURCE_CODE_DIR}/$CONTEXT -- buildah build \ $VOLUME_MOUNTS \ "${BUILDAH_ARGS[@]}" \ "${LABELS[@]}" \ --tls-verify=$TLSVERIFY --no-cache \ --ulimit nofile=4096:4096 \ - -f "$dockerfile_copy" -t $IMAGE . + -f "$dockerfile_copy" -t "$IMAGE" . - container=$(buildah from --pull-never $IMAGE) + container=$(buildah from --pull-never "$IMAGE") buildah mount $container | tee /shared/container_path # delete symlinks - they may point outside the container rootfs, messing with SBOM scanners find $(cat /shared/container_path) -xtype l -delete