Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(KFLUXBUGS-1666): Only analyze build context for dependencies #1476

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions task/buildah-oci-ta/0.2/buildah-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ spec:
value: $(params.IMAGE_EXPIRES_AFTER)
- name: SKIP_UNUSED_STAGES
value: $(params.SKIP_UNUSED_STAGES)
- name: SOURCE_CODE_DIR
value: source
- name: SQUASH
value: $(params.SQUASH)
- name: STORAGE_DRIVER
Expand Down Expand Up @@ -251,7 +253,6 @@ spec:
update-ca-trust
fi

SOURCE_CODE_DIR=source
if [ -e "$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" ]; then
dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE"
elif [ -e "$SOURCE_CODE_DIR/$DOCKERFILE" ]; then
Expand Down Expand Up @@ -459,9 +460,9 @@ spec:
name: shared
script: |
echo "Running syft on the source directory"
syft dir:/var/workdir/source --output cyclonedx-json=/var/workdir/sbom-source.json
syft dir:"/var/workdir/$SOURCE_CODE_DIR/$CONTEXT" --output cyclonedx-json="/var/workdir/sbom-source.json"
echo "Running syft on the image filesystem"
syft dir:$(cat /shared/container_path) --output cyclonedx-json=/var/workdir/sbom-image.json
syft dir:"$(cat /shared/container_path)" --output cyclonedx-json="/var/workdir/sbom-image.json"
computeResources:
limits:
cpu: "2"
Expand Down
8 changes: 5 additions & 3 deletions task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ spec:
value: $(params.IMAGE_EXPIRES_AFTER)
- name: SKIP_UNUSED_STAGES
value: $(params.SKIP_UNUSED_STAGES)
- name: SOURCE_CODE_DIR
value: source
- name: SQUASH
value: $(params.SQUASH)
- name: STORAGE_DRIVER
Expand Down Expand Up @@ -286,7 +288,6 @@ spec:
update-ca-trust
fi

SOURCE_CODE_DIR=source
if [ -e "$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" ]; then
dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE"
elif [ -e "$SOURCE_CODE_DIR/$DOCKERFILE" ]; then
Expand Down Expand Up @@ -494,6 +495,7 @@ spec:
-e IMAGE="$IMAGE" \
-e IMAGE_EXPIRES_AFTER="$IMAGE_EXPIRES_AFTER" \
-e SKIP_UNUSED_STAGES="$SKIP_UNUSED_STAGES" \
-e SOURCE_CODE_DIR="$SOURCE_CODE_DIR" \
-e SQUASH="$SQUASH" \
-e STORAGE_DRIVER="$STORAGE_DRIVER" \
-e TARGET_STAGE="$TARGET_STAGE" \
Expand Down Expand Up @@ -562,9 +564,9 @@ spec:
export IMAGE
fi
echo "Running syft on the source directory"
syft dir:/var/workdir/source --output cyclonedx-json=/var/workdir/sbom-source.json
syft dir:"/var/workdir/$SOURCE_CODE_DIR/$CONTEXT" --output cyclonedx-json="/var/workdir/sbom-source.json"
echo "Running syft on the image filesystem"
syft dir:$(cat /shared/container_path) --output cyclonedx-json=/var/workdir/sbom-image.json
syft dir:"$(cat /shared/container_path)" --output cyclonedx-json="/var/workdir/sbom-image.json"
volumeMounts:
- mountPath: /var/lib/containers
name: varlibcontainers
Expand Down
8 changes: 5 additions & 3 deletions task/buildah-remote/0.2/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ spec:
value: $(params.STORAGE_DRIVER)
- name: HERMETIC
value: $(params.HERMETIC)
- name: SOURCE_CODE_DIR
value: source
- name: CONTEXT
value: $(params.CONTEXT)
- name: DOCKERFILE
Expand Down Expand Up @@ -268,7 +270,6 @@ spec:
update-ca-trust
fi

SOURCE_CODE_DIR=source
if [ -e "$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" ]; then
dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE"
elif [ -e "$SOURCE_CODE_DIR/$DOCKERFILE" ]; then
Expand Down Expand Up @@ -467,6 +468,7 @@ spec:
-e BUILDAH_FORMAT="$BUILDAH_FORMAT" \
-e STORAGE_DRIVER="$STORAGE_DRIVER" \
-e HERMETIC="$HERMETIC" \
-e SOURCE_CODE_DIR="$SOURCE_CODE_DIR" \
-e CONTEXT="$CONTEXT" \
-e DOCKERFILE="$DOCKERFILE" \
-e IMAGE="$IMAGE" \
Expand Down Expand Up @@ -544,9 +546,9 @@ spec:
export IMAGE
fi
echo "Running syft on the source directory"
syft dir:$(workspaces.source.path)/source --output cyclonedx-json=$(workspaces.source.path)/sbom-source.json
syft dir:"$(workspaces.source.path)/$SOURCE_CODE_DIR/$CONTEXT" --output cyclonedx-json="$(workspaces.source.path)/sbom-source.json"
echo "Running syft on the image filesystem"
syft dir:$(cat /shared/container_path) --output cyclonedx-json=$(workspaces.source.path)/sbom-image.json
syft dir:"$(cat /shared/container_path)" --output cyclonedx-json="$(workspaces.source.path)/sbom-image.json"
volumeMounts:
- mountPath: /var/lib/containers
name: varlibcontainers
Expand Down
7 changes: 4 additions & 3 deletions task/buildah/0.2/buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ spec:
value: $(params.STORAGE_DRIVER)
- name: HERMETIC
value: $(params.HERMETIC)
- name: SOURCE_CODE_DIR
value: source
- name: CONTEXT
value: $(params.CONTEXT)
- name: DOCKERFILE
Expand Down Expand Up @@ -188,7 +190,6 @@ spec:
update-ca-trust
fi

SOURCE_CODE_DIR=source
if [ -e "$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" ]; then
dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE"
elif [ -e "$SOURCE_CODE_DIR/$DOCKERFILE" ]; then
Expand Down Expand Up @@ -408,9 +409,9 @@ spec:
cpu: 500m
script: |
echo "Running syft on the source directory"
syft dir:$(workspaces.source.path)/source --output cyclonedx-json=$(workspaces.source.path)/sbom-source.json
syft dir:"$(workspaces.source.path)/$SOURCE_CODE_DIR/$CONTEXT" --output cyclonedx-json="$(workspaces.source.path)/sbom-source.json"
echo "Running syft on the image filesystem"
syft dir:$(cat /shared/container_path) --output cyclonedx-json=$(workspaces.source.path)/sbom-image.json
syft dir:"$(cat /shared/container_path)" --output cyclonedx-json="$(workspaces.source.path)/sbom-image.json"
volumeMounts:
- mountPath: /var/lib/containers
name: varlibcontainers
Expand Down
Loading