Skip to content

Commit

Permalink
Remove that kaniko-trivy build strategy sample in favor of the first-…
Browse files Browse the repository at this point in the history
…class image scanning support
  • Loading branch information
SaschaSchwarze0 committed Jun 21, 2024
1 parent 60fa094 commit 336162e
Show file tree
Hide file tree
Showing 16 changed files with 1 addition and 446 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/check-latest-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ jobs:
include:
- image: gcr.io/kaniko-project/executor
latest-release-url: https://api.github.com/repos/GoogleContainerTools/kaniko/releases/latest
- image: docker.io/aquasec/trivy
latest-release-url: https://api.github.com/repos/aquasecurity/trivy/releases/latest
- image: quay.io/containers/buildah
latest-release-url: https://quay.io/api/v1/repository/containers/buildah/tag/
- image: gcr.io/go-containerregistry/crane
latest-release-url: https://api.github.com/repos/google/go-containerregistry/releases/latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
15 changes: 1 addition & 14 deletions docs/buildstrategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ SPDX-License-Identifier: Apache-2.0
- [Installing Buildpacks v3 Strategy](#installing-buildpacks-v3-strategy)
- [Kaniko](#kaniko)
- [Installing Kaniko Strategy](#installing-kaniko-strategy)
- [Scanning with Trivy](#scanning-with-trivy)
- [BuildKit](#buildkit)
- [Cache Exporters](#cache-exporters)
- [Build-args and secrets](#build-args-and-secrets)
Expand Down Expand Up @@ -129,7 +128,7 @@ kubectl apply -f samples/v1beta1/buildstrategy/buildpacks-v3/buildstrategy_build

## Kaniko

The `kaniko` ClusterBuildStrategy is composed by Kaniko's `executor` [kaniko], with the objective of building a container-image, out of a `Dockerfile` and context directory. The `kaniko-trivy` ClusterBuildStrategy adds [trivy](https://github.com/aquasecurity/trivy) scanning and refuses to push images with critical vulnerabilities.
The `kaniko` ClusterBuildStrategy is composed by Kaniko's `executor` [kaniko], with the objective of building a container-image, out of a `Dockerfile` and context directory.

### Installing Kaniko Strategy

Expand All @@ -139,18 +138,6 @@ To install the cluster scope strategy, use:
kubectl apply -f samples/v1beta1/buildstrategy/kaniko/buildstrategy_kaniko_cr.yaml
```

#### Scanning with Trivy

You can also incorporate scanning into the ClusterBuildStrategy. The `kaniko-trivy` ClusterBuildStrategy builds the image with `kaniko`, then scans with [trivy](https://github.com/aquasecurity/trivy). The BuildRun will then exit with an error if there is a critical vulnerability, instead of pushing the vulnerable image into the container registry.

To install the cluster scope strategy, use:

```sh
kubectl apply -f samples/v1beta1/buildstrategy/kaniko/buildstrategy_kaniko-trivy_cr.yaml
```

*Note: doing image scanning is not a substitute for trusting the Dockerfile you are building. The build process itself is also susceptible if the Dockerfile has a vulnerability. Frameworks/strategies such as build-packs or source-to-image (which avoid directly building a Dockerfile) should be considered if you need guardrails around the code you want to build.*

---

## BuildKit
Expand Down
5 changes: 0 additions & 5 deletions hack/check-latest-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ function update() {
fi
LATEST_TAG="$(curl --silent --retry 3 "${LATEST_RELEASE_URL}" | jq --raw-output "${QUERY}")"

# Trivy image tag (0.31.3) is different from release tag name (v0.31.3)
if [[ ${IMAGE} == *trivy* ]]; then
LATEST_TAG="${LATEST_TAG:1}"
fi

echo "[INFO] Determined latest tag ${LATEST_TAG}"

# Search and modify the image tag with the latest
Expand Down
16 changes: 0 additions & 16 deletions samples/v1alpha1/build/build_kaniko-trivy-bad_cr.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions samples/v1alpha1/build/build_kaniko-trivy-good_cr.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions samples/v1alpha1/buildrun/buildrun_kaniko-trivy-bad_cr.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions samples/v1alpha1/buildrun/buildrun_kaniko-trivy-good_cr.yaml

This file was deleted.

This file was deleted.

56 changes: 0 additions & 56 deletions samples/v1alpha1/buildstrategy/kaniko/buildstrategy_kaniko_cr.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions samples/v1beta1/build/build_kaniko-trivy-bad_cr.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions samples/v1beta1/build/build_kaniko-trivy-good_cr.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions samples/v1beta1/buildrun/buildrun_kaniko-trivy-bad_cr.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions samples/v1beta1/buildrun/buildrun_kaniko-trivy-good_cr.yaml

This file was deleted.

Loading

0 comments on commit 336162e

Please sign in to comment.