Skip to main content
Hermetic Execution Mode enables running TaskRun steps without network access, following release engineering best practices for reliable and consistent software builds.
Hermetic execution mode is currently an alpha experimental feature.

Overview

A Hermetic Build is a release engineering best practice that ensures builds are:
  • Self-contained - Don’t depend on anything outside the build environment
  • Reproducible - Same inputs always produce same outputs
  • Isolated - No network access during execution
  • Reliable - Cannot fetch dependencies at runtime
When hermetic execution mode is enabled, all TaskRun steps run without network access, preventing:
  • Downloading dependencies during build time
  • Accessing external services
  • Fetching remote resources
  • Network-based attacks
Hermetic execution mode does NOT apply to sidecar containers. Only Steps in the TaskRun are isolated from the network.

Enabling Hermetic Execution

Prerequisites

  1. Set enable-api-fields to "alpha" in the feature-flags ConfigMap:

Enable for a TaskRun

  1. Add the hermetic execution annotation to your TaskRun:

Example: Hermetic TaskRun

This example demonstrates a TaskRun that should fail when hermetic mode is working correctly:
The Step attempts to install curl, which requires network access. This SHOULD FAIL if the hermetic environment is working correctly, as the container cannot reach external package repositories.

Successful Hermetic TaskRun

Here’s an example that works correctly in hermetic mode by using only what’s in the container image:
This succeeds because:
  • The Go image contains the compiler
  • Dependencies are vendored (included in the source)
  • No network access is required

Use Cases

Secure CI/CD Pipelines

Ensure build steps cannot exfiltrate data or download malicious code:

Reproducible Builds

Guarantee that builds produce identical outputs:

Compliance and Auditing

Meet regulatory requirements for build isolation:

Preparing for Hermetic Builds

To successfully run hermetic builds, prepare your environment:

1. Vendor Dependencies

2. Use Appropriate Base Images

Choose images that contain all necessary tools:

3. Pre-stage Artifacts

Mount workspaces with pre-downloaded dependencies:

Troubleshooting

Network Access Errors

If you see errors like:
  • Could not resolve host
  • Connection timeout
  • Network is unreachable
This confirms hermetic mode is working. Ensure dependencies are vendored or cached.

Debugging Hermetic Failures

Temporarily disable hermetic mode to identify network dependencies:
Run the TaskRun with network access and observe which URLs are accessed.

Implementation Details

Hermetic execution mode is implemented by:
  1. Configuring network policies for the TaskRun pod
  2. Disabling network interfaces in Step containers
  3. Blocking DNS resolution
  4. Preventing outbound connections
For technical details, see TEP-0025: Hermekton.

Limitations

Current limitations of hermetic execution mode:
  • Does not apply to sidecar containers
  • Requires alpha API fields to be enabled
  • May not work with all cluster networking configurations
  • Container image pulls must complete before hermetic mode activates

Best Practices

  1. Test incrementally - Start with simple TaskRuns and gradually add complexity
  2. Vendor all dependencies - Don’t rely on network access during builds
  3. Use dependency locking - Pin exact versions (e.g., package-lock.json, Cargo.lock)
  4. Pre-populate caches - Mount workspaces with pre-downloaded artifacts
  5. Verify offline mode - Test build commands with --offline flags locally
  6. Document dependencies - Clearly list all required tools and libraries
  7. Separate fetch from build - Use separate Tasks for dependency download and compilation