From cd381267af74c60f3092331449d369cfff5afc17 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Tue, 2 Jul 2024 12:43:13 -0400 Subject: [PATCH] fix: squash also the sbom layer This was omitted by accident in https://github.com/konflux-ci/build-definitions/pull/1107 --- task/buildah-oci-ta/0.1/buildah-oci-ta.yaml | 8 +++++++- task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml | 8 +++++++- task/buildah-remote/0.1/buildah-remote.yaml | 8 +++++++- task/buildah/0.1/buildah.yaml | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/task/buildah-oci-ta/0.1/buildah-oci-ta.yaml b/task/buildah-oci-ta/0.1/buildah-oci-ta.yaml index f5a6928297..a614188de0 100644 --- a/task/buildah-oci-ta/0.1/buildah-oci-ta.yaml +++ b/task/buildah-oci-ta/0.1/buildah-oci-ta.yaml @@ -498,7 +498,13 @@ spec: container=$(buildah from --pull-never $IMAGE) buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/ buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container - buildah commit $container $IMAGE + + BUILDAH_ARGS=() + if [ "${SQUASH}" == "true" ]; then + BUILDAH_ARGS+=("--squash") + fi + + buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE status=-1 max_run=5 diff --git a/task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml b/task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml index 2ca6c1a77e..d63452936c 100644 --- a/task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml +++ b/task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml @@ -568,7 +568,13 @@ spec: container=$(buildah from --pull-never $IMAGE) buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/ buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container - buildah commit $container $IMAGE + + BUILDAH_ARGS=() + if [ "${SQUASH}" == "true" ]; then + BUILDAH_ARGS+=("--squash") + fi + + buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE status=-1 max_run=5 diff --git a/task/buildah-remote/0.1/buildah-remote.yaml b/task/buildah-remote/0.1/buildah-remote.yaml index a6108c133d..6d12d9425c 100644 --- a/task/buildah-remote/0.1/buildah-remote.yaml +++ b/task/buildah-remote/0.1/buildah-remote.yaml @@ -565,7 +565,13 @@ spec: container=$(buildah from --pull-never $IMAGE) buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/ buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container - buildah commit $container $IMAGE + + BUILDAH_ARGS=() + if [ "${SQUASH}" == "true" ]; then + BUILDAH_ARGS+=("--squash") + fi + + buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE status=-1 max_run=5 diff --git a/task/buildah/0.1/buildah.yaml b/task/buildah/0.1/buildah.yaml index cf74553521..8504172645 100644 --- a/task/buildah/0.1/buildah.yaml +++ b/task/buildah/0.1/buildah.yaml @@ -467,7 +467,13 @@ spec: container=$(buildah from --pull-never $IMAGE) buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/ buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container - buildah commit $container $IMAGE + + BUILDAH_ARGS=() + if [ "${SQUASH}" == "true" ]; then + BUILDAH_ARGS+=("--squash") + fi + + buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE status=-1 max_run=5