Chapter 3. Build

Whereas the Serving component of Knative is how you go from container-to-URL, the Build component is how you go from source-to-container. Rather than pointing to a prebuilt container image, the Build resource lets you define how your code is compiled and the container is built. This ensures a consistent way to compile and package your code before shipping it to the container registry of your choice. There are a few new components that we’ll introduce in this chapter:

Builds

The custom Kubernetes resource that drives a build process. When you define a build, you define how to get your source code and how to create the container image that will run it.

Build Templates

A template that encapsulates a repeatable collection of build steps and allows builds to be parameterized.

Service Accounts

Allows for authentication to private resources, such as a Git repository or container registry.

Note

At the time of writing, there is active work to migrate Builds to Build Pipelines, a restructuring of builds in Knative that more closely resembles CI/CD pipelines. This means builds in Knative, in addition to compiling and packaging your code, can also easily run tests and publish those results. Make sure to keep an eye on future releases of Knative for this change.

Service Accounts

Before we begin to configure our Build we first face an immediate question: How do we reach out to services that require authentication at build-time? How do we pull code from a private Git repository ...

Get Getting Started with Knative now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.