Skip to content

Commit 88bcea1

Browse files
Merge pull request #140 from SaschaSchwarze0/sascha-docs-v0.14.0
Sync documentation from shipwright-io/build at v0.14.0 level
2 parents 0038e73 + 49d8c0e commit 88bcea1

File tree

10 files changed

+349
-159
lines changed

10 files changed

+349
-159
lines changed

content/en/blog/posts/2024-11-15-release-v0.14.0.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ In this release, we have put together some nice features:
1515

1616
Keeping your environments secure is key these days. For container images, scanning them is widely adopted. Shipwright now performs a shift left of those scans by incorporating image scanning into the image build itself. We'll ensure that a vulnerable image never makes it into your container registry (though, you'd still have to re-scan it regularly to determine when it becomes vulnerable). This is a great safeguard for example against base images you consume in your Dockerfile that suddenly are not updated anymore.
1717

18-
You can read more about it in the separate blog post [Building Secure Container images with Shipwright](2024-07-15-vulnerability-scanning.md).
18+
You can read more about it in the separate blog post [Building Secure Container images with Shipwright](../../../07/15/building-secure-container-images-with-shipwright).
1919

2020
### Parameters in the CLI
2121

22-
The Shipwright CLI finally received the first support for [build parameters](../../docs/build/build.md#defining-paramvalues). You can use the `--param-value` argument to provide values for strategy parameters such as the Go version and Go flags in our [ko sample build strategy](https://github.com/shipwright-io/build/blob/v0.14.0/samples/v1beta1/buildstrategy/ko/buildstrategy_ko_cr.yaml#L8-L13) like this: `shp build create my-app --param-value go-version=1.23 --param-value go-flags=-mod=vendor`.
22+
The Shipwright CLI finally received the first support for [build parameters](../../../../../docs/build/build#defining-paramvalues). You can use the `--param-value` argument to provide values for strategy parameters such as the Go version and Go flags in our [ko sample build strategy](https://github.com/shipwright-io/build/blob/v0.14.0/samples/v1beta1/buildstrategy/ko/buildstrategy_ko_cr.yaml#L8-L13) like this: `shp build create my-app --param-value go-version=1.23 --param-value go-flags=-mod=vendor`.
2323

2424
### The smaller but still nice things
2525

2626
Often the small changes are what help you, here are some:
2727

2828
* If a step in your BuildRun goes out of memory, then it is now easier to determine that as the BuildRun status will have `StepOutOfMemory` as reason.
29-
* A [new sample build strategy](https://github.com/shipwright-io/build/blob/v0.14.0/samples/v1beta1/buildstrategy/multiarch-native-buildah/buildstrategy_multiarch_native_buildah_cr.yaml) has been added which orchestrates a multi-arch build using Kubernetes Jobs. See [our documentation](https://github.com/shipwright-io/build/blob/v0.14.0/docs/buildstrategies.md#multi-arch-native-buildah) for more information.
29+
* A [new sample build strategy](https://github.com/shipwright-io/build/blob/v0.14.0/samples/v1beta1/buildstrategy/multiarch-native-buildah/buildstrategy_multiarch_native_buildah_cr.yaml) has been added which orchestrates a multi-arch build using Kubernetes Jobs. See [our documentation](../../../../../docs/build/buildstrategies#multi-arch-native-buildah) for more information.
3030
* We started to implement node selection properties on Builds and BuildRuns with [node selector support](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector). Tolerations are planned to be added in v0.15.
3131
* As usual, we have done our due diligence. DependaBot helped us to keep our dependencies secure. We are now building with Go 1.22. Kubernetes and Tekton dependencies have been updated. We are also in the process of establishing automation across our repositories that gives us a GitHub issue once our latest release becomes vulnerable. You'll probably see more patch releases in the future where we keep our release free of vulnerabilities.
3232

content/en/docs/build/authentication.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
22
title: Authentication during builds
3+
weight: 40
34
---
45

56
The following document provides an introduction around the different authentication methods that can take place during an image build when using the Build controller.
67

78
- [Overview](#overview)
89
- [Build Secrets Annotation](#build-secrets-annotation)
910
- [Authentication for Git](#authentication-for-git)
10-
- [Basic authentication](#basic-authentication)
1111
- [SSH authentication](#ssh-authentication)
12+
- [Basic authentication](#basic-authentication)
1213
- [Usage of git secret](#usage-of-git-secret)
1314
- [Authentication to container registries](#authentication-to-container-registries)
1415
- [Docker Hub](#docker-hub)
@@ -17,7 +18,7 @@ The following document provides an introduction around the different authenticat
1718

1819
## Overview
1920

20-
There are two places where users might need to define authentication when building images. Authentication to a container registry is the most common one, but also users might have the need to define authentications for pulling source-code from Git. Overall, the authentication is done via the definition of [secrets](https://kubernetes.io/docs/concepts/configuration/secret/) in which the require sensitive data will be stored.
21+
There are two places where users might need to define authentication when building images. Authentication to a container registry is the most common one, but also users might have the need to define authentications for pulling source-code from Git. Overall, the authentication is done via the definition of [secrets](https://kubernetes.io/docs/concepts/configuration/secret/) in which the required sensitive data will be stored.
2122

2223
## Build Secrets Annotation
2324

@@ -74,7 +75,10 @@ data:
7475
The Basic authentication is very similar to the ssh one, but with the following differences:
7576

7677
- The Kubernetes secret should be of the type `kubernetes.io/basic-auth`
77-
- The `stringData` should host your user and password in clear text.
78+
- The `stringData` should host your user and personal access token in clear text.
79+
80+
Note: GitHub and GitLab no longer accept account passwords when authenticating Git operations.
81+
Instead, you must use token-based authentication for all authenticated Git operations. You can create your own personal access token on [GitHub](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) and [GitLab](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html).
7882

7983
```yaml
8084
apiVersion: v1
@@ -86,7 +90,7 @@ metadata:
8690
type: kubernetes.io/basic-auth
8791
stringData:
8892
username: <cleartext username>
89-
password: <cleartext password>
93+
password: <cleartext token>
9094
```
9195

9296
### Usage of git secret
@@ -98,29 +102,29 @@ Depending on the secret type, there are two ways of doing this:
98102
When using ssh auth, users should follow:
99103

100104
```yaml
101-
apiVersion: shipwright.io/v1alpha1
105+
apiVersion: shipwright.io/v1beta1
102106
kind: Build
103107
metadata:
104108
name: buildah-golang-build
105109
spec:
106110
source:
107-
url: git@gitlab.com:eduardooli/newtaxi.git
108-
credentials:
109-
name: secret-git-ssh-auth
111+
git:
112+
url: [email protected]:eduardooli/newtaxi.git
113+
cloneSecret: secret-git-ssh-auth
110114
```
111115

112116
When using basic auth, users should follow:
113117

114118
```yaml
115-
apiVersion: shipwright.io/v1alpha1
119+
apiVersion: shipwright.io/v1beta1
116120
kind: Build
117121
metadata:
118122
name: buildah-golang-build
119123
spec:
120124
source:
121-
url: https://gitlab.com/eduardooli/newtaxi.git
122-
credentials:
123-
name: secret-git-basic-auth
125+
git:
126+
url: https://gitlab.com/eduardooli/newtaxi.git
127+
cloneSecret: secret-git-basic-auth
124128
```
125129

126130
## Authentication to container registries
@@ -146,18 +150,17 @@ _Notes:_ The value of `PASSWORD` can be your user docker hub password, or an acc
146150
### Usage of registry secret
147151

148152
With the right secret in place (_note: Ensure creation of secret in the proper Kubernetes namespace_), users should reference it on their Build YAML definitions.
149-
For container registries, the secret should be placed under the `spec.output.credentials` path.
153+
For container registries, the secret should be placed under the `spec.output.pushSecret` path.
150154

151155
```yaml
152-
apiVersion: shipwright.io/v1alpha1
156+
apiVersion: shipwright.io/v1beta1
153157
kind: Build
154158
metadata:
155159
name: buildah-golang-build
156160
...
157161
output:
158162
image: docker.io/foobar/sample:latest
159-
credentials:
160-
name: <CONTAINER_REGISTRY_SECRET_NAME>
163+
pushSecret: <CONTAINER_REGISTRY_SECRET_NAME>
161164
```
162165

163166
## References

content/en/docs/build/build.md

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Build
3-
weight: 10
3+
weight: 20
44
---
55
<!--
66
Copyright The Shipwright Contributors
@@ -15,12 +15,17 @@ SPDX-License-Identifier: Apache-2.0
1515
- [Defining the Source](#defining-the-source)
1616
- [Defining the Strategy](#defining-the-strategy)
1717
- [Defining ParamValues](#defining-paramvalues)
18+
- [Example](#example)
1819
- [Defining the Builder or Dockerfile](#defining-the-builder-or-dockerfile)
1920
- [Defining the Output](#defining-the-output)
21+
- [Defining the vulnerabilityScan](#defining-the-vulnerabilityscan)
2022
- [Defining Retention Parameters](#defining-retention-parameters)
2123
- [Defining Volumes](#defining-volumes)
2224
- [Defining Triggers](#defining-triggers)
23-
- [BuildRun deletion](#buildrun-deletion)
25+
- [GitHub](#github)
26+
- [Image](#image)
27+
- [Tekton Pipeline](#tekton-pipeline)
28+
- [BuildRun Deletion](#buildrun-deletion)
2429

2530
## Overview
2631

@@ -35,6 +40,7 @@ A `Build` resource allows the user to define:
3540
- env
3641
- retention
3742
- volumes
43+
- nodeSelector
3844

3945
A `Build` is available within a namespace.
4046

@@ -99,7 +105,7 @@ The `Build` definition supports the following fields:
99105
- [`kind`](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields) - Specifies the Kind type, for example `Build`.
100106
- [`metadata`](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields) - Metadata that identify the custom resource instance, especially the name of the `Build`, and in which [namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) you place it. **Note**: You should use your own namespace, and not put your builds into the shipwright-build namespace where Shipwright's system components run.
101107
- `spec.source` - Refers to the location of the source code, for example a Git repository or OCI artifact image.
102-
- `spec.strategy` - Refers to the `BuildStrategy` to be used, see the [examples](../samples/v1beta1/buildstrategy)
108+
- `spec.strategy` - Refers to the `BuildStrategy` to be used, see the [examples](https://github.com/shipwright-io/build/tree/v0.14.0/samples/v1beta1/buildstrategy)
103109
- `spec.output`- Refers to the location where the generated image would be pushed.
104110
- `spec.output.pushSecret`- Reference an existing secret to get access to the container registry.
105111

@@ -113,12 +119,14 @@ The `Build` definition supports the following fields:
113119
- Use string `SourceTimestamp` to set the image timestamp to the source timestamp, i.e. the timestamp of the Git commit that was used.
114120
- Use string `BuildTimestamp` to set the image timestamp to the timestamp of the build run.
115121
- Use any valid UNIX epoch seconds number as a string to set this as the image timestamp.
122+
- `spec.output.vulnerabilityScan` to enable a security vulnerability scan for your generated image. Further options in vulnerability scanning are defined [here](#defining-the-vulnerabilityscan)
116123
- `spec.env` - Specifies additional environment variables that should be passed to the build container. The available variables depend on the tool that is being used by the chosen build strategy.
117124
- `spec.retention.atBuildDeletion` - Defines if all related BuildRuns needs to be deleted when deleting the Build. The default is false.
118125
- `spec.retention.ttlAfterFailed` - Specifies the duration for which a failed buildrun can exist.
119126
- `spec.retention.ttlAfterSucceeded` - Specifies the duration for which a successful buildrun can exist.
120127
- `spec.retention.failedLimit` - Specifies the number of failed buildrun that can exist.
121128
- `spec.retention.succeededLimit` - Specifies the number of successful buildrun can exist.
129+
- `spec.nodeSelector` - Specifies a selector which must match a node's labels for the build pod to be scheduled on that node.
122130

123131
### Defining the Source
124132

@@ -127,7 +135,7 @@ A `Build` resource can specify a source type, such as a Git repository or an OCI
127135
- `source.type` - Specify the type of the data-source. Currently, the supported types are "Git", "OCIArtifact", and "Local".
128136
- `source.git.url` - Specify the source location using a Git repository.
129137
- `source.git.cloneSecret` - For private repositories or registries, the name references a secret in the namespace that contains the SSH private key or Docker access credentials, respectively.
130-
- `source.git.revision` - A specific revision to select from the source repository, this can be a commit, tag or branch name. If not defined, it will fallback to the Git repository default branch.
138+
- `source.git.revision` - A specific revision to select from the source repository, this can be a commit, tag or branch name. If not defined, it will fall back to the Git repository default branch.
131139
- `source.contextDir` - For repositories where the source code is not located at the root folder, you can specify this path here.
132140

133141
By default, the Build controller does not validate that the Git repository exists. If the validation is desired, users can explicitly define the `build.shipwright.io/verify.repository` annotation with `true`. For example:
@@ -262,12 +270,12 @@ spec:
262270

263271
A `Build` resource can specify the `BuildStrategy` to use, these are:
264272

265-
- [Buildah](buildstrategies.md#buildah)
266-
- [Buildpacks-v3](buildstrategies.md#buildpacks-v3)
267-
- [BuildKit](buildstrategies.md#buildkit)
268-
- [Kaniko](buildstrategies.md#kaniko)
269-
- [ko](buildstrategies.md#ko)
270-
- [Source-to-Image](buildstrategies.md#source-to-image)
273+
- [Buildah](../buildstrategies#buildah)
274+
- [Buildpacks-v3](../buildstrategies#buildpacks-v3)
275+
- [BuildKit](../buildstrategies#buildkit)
276+
- [Kaniko](../buildstrategies#kaniko)
277+
- [ko](../buildstrategies#ko)
278+
- [Source-to-Image](../buildstrategies#source-to-image)
271279

272280
Defining the strategy is straightforward. You define the `name` and the `kind`. For example:
273281

@@ -284,7 +292,7 @@ spec:
284292

285293
### Defining ParamValues
286294

287-
A `Build` resource can specify _paramValues_ for parameters that are defined in the referenced `BuildStrategy`. You specify these parameter values to control how the steps of the build strategy behave. You can overwrite values in the `BuildRun` resource. See the related [documentation](./buildrun.md#defining-params) for more information.
295+
A `Build` resource can specify _paramValues_ for parameters that are defined in the referenced `BuildStrategy`. You specify these parameter values to control how the steps of the build strategy behave. You can overwrite values in the `BuildRun` resource. See the related [documentation](../buildrun#defining-paramvalues) for more information.
288296

289297
The build strategy author can define a parameter as either a simple string or an array. Depending on that, you must specify the value accordingly. The build strategy parameter can be specified with a default value. You must specify a value in the `Build` or `BuildRun` for parameters without a default.
290298

@@ -299,7 +307,7 @@ In general, _paramValues_ are tightly bound to Strategy _parameters_. Please mak
299307

300308
#### Example
301309

302-
The [BuildKit sample `BuildStrategy`](../samples/v1beta1/buildstrategy/buildkit/buildstrategy_buildkit_cr.yaml) contains various parameters. Two of them are outlined here:
310+
The [BuildKit sample `BuildStrategy`](https://github.com/shipwright-io/build/tree/v0.14.0/samples/v1beta1/buildstrategy/buildkit/buildstrategy_buildkit_cr.yaml) contains various parameters. Two of them are outlined here:
303311

304312
```yaml
305313
apiVersion: shipwright.io/v1beta1
@@ -594,6 +602,48 @@ spec:
594602
timestamp: SourceTimestamp
595603
```
596604

605+
### Defining the vulnerabilityScan
606+
607+
`vulnerabilityScan` provides configurations to run a scan for your generated image.
608+
609+
- `vulnerabilityScan.enabled` - Specify whether to run vulnerability scan for image. The supported values are true and false.
610+
- `vulnerabilityScan.failOnFinding` - indicates whether to fail the build run if the vulnerability scan results in vulnerabilities. The supported values are true and false. This field is optional and false by default.
611+
- `vulnerabilityScan.ignore.issues` - references the security issues to be ignored in vulnerability scan
612+
- `vulnerabilityScan.ignore.severity` - denotes the severity levels of security issues to be ignored, valid values are:
613+
- `low`: it will exclude low severity vulnerabilities, displaying only medium, high and critical vulnerabilities
614+
- `medium`: it will exclude low and medium severity vulnerabilities, displaying only high and critical vulnerabilities
615+
- `high`: it will exclude low, medium and high severity vulnerabilities, displaying only the critical vulnerabilities
616+
- `vulnerabilityScan.ignore.unfixed` - indicates to ignore vulnerabilities for which no fix exists. The supported types are true and false.
617+
618+
Example of user specified image vulnerability scanning options:
619+
620+
```yaml
621+
apiVersion: shipwright.io/v1beta1
622+
kind: Build
623+
metadata:
624+
name: sample-go-build
625+
spec:
626+
source:
627+
type: Git
628+
git:
629+
url: https://github.com/shipwright-io/sample-go
630+
contextDir: source-build
631+
strategy:
632+
name: buildkit
633+
kind: ClusterBuildStrategy
634+
output:
635+
image: some.registry.com/namespace/image:tag
636+
pushSecret: credentials
637+
vulnerabilityScan:
638+
enabled: true
639+
failOnFinding: true
640+
ignore:
641+
issues:
642+
- CVE-2022-12345
643+
severity: Low
644+
unfixed: true
645+
```
646+
597647
Annotations added to the output image can be verified by running the command:
598648

599649
```sh

0 commit comments

Comments
 (0)