Skip to content

Commit b532cbb

Browse files
authored
Revert "St0rmz1/feature/use securebuild for builds (#319)" (#326)
This reverts commit 7cde42e.
1 parent 38e448b commit b532cbb

File tree

14 files changed

+154
-1144
lines changed

14 files changed

+154
-1144
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ jobs:
7575
- uses: dagger/[email protected]
7676
id: dagger-publish
7777
env:
78-
USE_SECUREBUILD: true
7978
OP_SERVICE_ACCOUNT: ${{ secrets.OP_SERVICE_ACCOUNT }}
8079
OP_SERVICE_ACCOUNT_PRODUCTION: ${{ secrets.OP_SERVICE_ACCOUNT_PRODUCTION }}
8180
with:
@@ -100,7 +99,6 @@ jobs:
10099
- uses: dagger/[email protected]
101100
id: dagger-publish
102101
env:
103-
USE_SECUREBUILD: true
104102
OP_SERVICE_ACCOUNT: ${{ secrets.OP_SERVICE_ACCOUNT }}
105103
OP_SERVICE_ACCOUNT_PRODUCTION: ${{ secrets.OP_SERVICE_ACCOUNT_PRODUCTION }}
106104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

certs/README.md

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,36 @@
11
# Certificates and Verification Tools
22

3-
> **⚠️ DEPRECATION NOTICE**: This directory is transitioning away from manual image verification tools as SecureBuild now automatically handles SLSA attestations, SBOM generation, and image signing for staging and production builds. See migration notes below.
3+
This directory contains certificates and verification tools used for validating the authenticity and integrity of Replicated SDK container images.
44

5-
This directory contains legacy certificates and verification tools that were used for validating the authenticity and integrity of Replicated SDK container images.
6-
7-
## 🔄 Migration to SecureBuild
8-
9-
**As of September 2025**, the Replicated SDK build pipeline uses [SecureBuild](https://securebuild.com) for staging and production image builds, which provides:
10-
11-
- **Automatic SLSA Attestation**: Built-in provenance generation without manual workflows
12-
- **Automatic SBOM Generation**: Comprehensive software bill of materials with CVE remediation data
13-
- **Automatic Image Signing**: Cryptographic signatures managed by SecureBuild
14-
- **Multi-Registry Publishing**: Images published to Docker Hub, Replicated registries, and CVE0.io
15-
16-
### Current Build Architecture
17-
18-
- **Development Builds**: May still use traditional pipeline with manual verification (optional SecureBuild)
19-
- **Staging/Production Builds**: Use SecureBuild with automatic security attestations
20-
- **Environment Flag**: Controlled by `USE_SECUREBUILD=true` in GitHub Actions
21-
22-
## 📋 Legacy Contents (For Reference)
5+
## Contents
236

247
### Verification Script
25-
- `verify-image.sh` - **Legacy script** for manual SLSA attestation, image signatures, and SBOM verification
8+
- `verify-image.sh` - Script to verify SLSA attestation, image signatures, and SBOM for SDK images
269

2710
### Public Keys
28-
- `cosign-dev.pub` - **Legacy**: Development environment public key for image signature verification
29-
- `cosign-stage.pub` - **Legacy**: Staging environment public key for image signature verification
30-
- `cosign-prod.pub` - **Legacy**: Production environment public key for image signature verification
31-
32-
## 🔧 Verification Methods
11+
- `cosign-dev.pub` - Development environment public key for image signature verification
12+
- `cosign-stage.pub` - Staging environment public key for image signature verification
13+
- `cosign-prod.pub` - Production environment public key for image signature verification
3314

34-
### For SecureBuild Images (Recommended)
35-
SecureBuild images include built-in attestations and can be verified using SecureBuild's verification tools. Refer to the [SecureBuild documentation](https://securebuild.com) for current verification methods.
15+
## Usage
3616

37-
### For Legacy Images (Development/Fallback)
38-
If using traditional pipeline builds, the legacy verification script can still be used:
17+
The verification script supports three environments (dev, stage, prod) and can be run as follows:
3918

4019
```bash
4120
./verify-image.sh --env <environment> --version <version> --digest <image-digest>
4221
```
4322

44-
For detailed usage instructions:
23+
For detailed usage instructions and examples, run:
4524
```bash
4625
./verify-image.sh --help
4726
```
4827

49-
## ⚠️ Important Notes
28+
## Environment-Specific Verification
5029

51-
1. **Production Images**: All production images now use SecureBuild attestations - legacy verification may not apply
52-
2. **Staging Images**: All staging images now use SecureBuild attestations - legacy verification may not apply
53-
3. **Development Images**: May use either SecureBuild or legacy pipeline depending on `USE_SECUREBUILD` flag
54-
4. **Future Plans**: This directory may be removed in future releases once SecureBuild migration is complete
30+
- **Development**: Uses `cosign-dev.pub` for signature verification
31+
- **Staging**: Uses `cosign-stage.pub` for signature verification
32+
- **Production**: Uses `cosign-prod.pub` for signature verification
5533

56-
## 📚 Documentation References
34+
## Security Notes
5735

58-
- **Current Build Process**: See `/dagger/README.md` for comprehensive SecureBuild integration guide
59-
- **SecureBuild Benefits**: Zero-CVE images, enhanced security, compliance-ready attestations
60-
- **Migration Guide**: All GitHub Actions workflows automatically use SecureBuild for staging/production
36+
- The public keys in this directory are used only for verification

dagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "replicated-sdk",
3-
"engineVersion": "v0.18.14",
3+
"engineVersion": "v0.18.6",
44
"sdk": {
55
"source": "go"
66
},

dagger/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
/internal/dagger
33
/internal/querybuilder
44
/internal/telemetry
5-
/.env

dagger/README.md

Lines changed: 45 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,5 @@
11
# Dagger Pipeline Usage
22

3-
## Build Architecture Overview
4-
5-
This Dagger pipeline supports two build approaches:
6-
7-
### 🚀 **SecureBuild** (Default for staging/production)
8-
- **What**: Zero-CVE container images built by SecureBuild.com
9-
- **Benefits**: Enhanced security, compliance, automatic CVE remediation
10-
- **Requirements**: SecureBuild account + 1Password access
11-
- **Registries**: Docker Hub + Replicated registries + CVE0.io
12-
13-
### 🛠️ **Wolfi/TTL.sh** (Fallback for development)
14-
- **What**: Traditional Wolfi-based images for development
15-
- **Benefits**: No credentials required
16-
- **Requirements**: None (public repositories only)
17-
- **Registries**: TTL.sh
18-
19-
---
20-
21-
## 🔧 **Environment Configuration**
22-
23-
### SecureBuild Mode (Recommended)
24-
```bash
25-
export USE_SECUREBUILD=true
26-
export OP_SERVICE_ACCOUNT="your-1password-service-account-token"
27-
export OP_SERVICE_ACCOUNT_PRODUCTION="your-production-1password-token" # for production builds
28-
```
29-
30-
### Traditional Mode (Development Fallback)
31-
```bash
32-
# No environment variables needed - will use deploy/apko-wolfi.yaml
33-
# Images published to ttl.sh with 24h expiration
34-
```
35-
36-
---
37-
383
## Validation
394

405
To validate the codebase without publishing:
@@ -45,133 +10,47 @@ dagger call validate --progress=plain \
4510

4611
## Publishing
4712

48-
The publish pipeline supports different environments and configurations:
49-
50-
> **Note**: All version numbers in examples below (e.g., `1.0.0-dev.1`, `1.0.0-beta.1`, `1.0.0`) are for illustration purposes only. Use your actual release version numbers when running commands.
13+
The publish pipeline supports different environments and configurations. Here are the common usage patterns:
5114

5215
### Development Release (ttl.sh)
5316

54-
#### Option 1: SecureBuild Development (with credentials)
55-
In this scenario, the pipeline uses SecureBuild and will publish the image to ttl.sh
17+
For local testing using ttl.sh registry:
5618
```bash
57-
export USE_SECUREBUILD=true
5819
dagger call publish --progress=plain \
5920
--op-service-account=env:OP_SERVICE_ACCOUNT \
6021
--dev=true \
6122
--staging=false \
62-
--version=1.0.0-dev.1 \
23+
--version=1.6.0-dev.1 \
6324
--slsa=false
6425
```
65-
**Result**: Uses `deploy/apko-securebuild.yaml` → publishes to TTL.sh + CVE0.io
66-
In this scenario, the pipeline uses Wolfi and will publish to ttl.sh
67-
68-
#### Option 2: Traditional Wolfi Development (no credentials)
69-
```bash
70-
# DO NOT set USE_SECUREBUILD
71-
dagger call publish --progress=plain \
72-
--op-service-account=env:OP_SERVICE_ACCOUNT \
73-
--dev=true \
74-
--staging=false \
75-
--version=1.0.0-dev.1 \
76-
--slsa=false
77-
```
78-
**Result**: Uses `deploy/apko-wolfi.yaml` → publishes to TTL.sh only
7926

80-
### Staging Release (SecureBuild Required)
27+
### Staging Release
8128

8229
For publishing to staging environment:
8330
```bash
84-
export USE_SECUREBUILD=true # Required for staging builds
8531
dagger call publish --progress=plain \
8632
--op-service-account=env:OP_SERVICE_ACCOUNT \
8733
--op-service-account-production=env:OP_SERVICE_ACCOUNT_PRODUCTION \
8834
--dev=false \
8935
--staging=true \
90-
--version=1.0.0-beta.1
36+
--version=1.6.0-beta.5 \
37+
--slsa=true \
38+
--github-token=env:GITHUB_TOKEN
9139
```
92-
**Result**: Uses SecureBuild staging → publishes to:
93-
- `docker.io/replicated/replicated-sdk:1.0.0-beta.1`
94-
- `registry.staging.replicated.com/library/replicated-sdk-image:1.0.0-beta.1`
95-
- `cve0.io/replicated-sdk:1.0.0-beta.1`
9640

97-
### Production Release (SecureBuild Required)
41+
### Production Release
9842

9943
For publishing to production:
10044
```bash
101-
export USE_SECUREBUILD=true # Required for production builds
10245
dagger call publish --progress=plain \
10346
--op-service-account=env:OP_SERVICE_ACCOUNT \
10447
--op-service-account-production=env:OP_SERVICE_ACCOUNT_PRODUCTION \
10548
--dev=false \
10649
--staging=false \
107-
--version=1.0.0
50+
--version=1.6.0 \
51+
--slsa=true \
52+
--github-token=env:GITHUB_TOKEN
10853
```
109-
**Result**: Uses SecureBuild production → publishes to:
110-
- `docker.io/replicated/replicated-sdk:1.0.0`
111-
- `registry.replicated.com/library/replicated-sdk-image:1.0.0`
112-
- `cve0.io/replicated-sdk:1.0.0`
113-
114-
> **Note**: SecureBuild automatically handles SLSA attestations and SBOM generation, so `--slsa` and `--github-token` flags are not required (and are ignored) when using SecureBuild.
115-
116-
---
117-
118-
## 🔐 **SecureBuild Integration**
119-
120-
### Requirements for SecureBuild
121-
1. **SecureBuild Account**: Active account at SecureBuild.com
122-
2. **Team Configuration**:
123-
- Feature flags enabled for "Custom APKO Upload" and "Custom Melange Upload"
124-
- Team subscribed to the image/catalog item in SecureBuild
125-
3. **1Password Access**: Service account tokens for dev/production vaults
126-
4. **Credentials**: Proper 1Password items configured:
127-
- `SecureBuild-Dev-Token` (in developer automation vault)
128-
- `SecureBuild-Replicated-SDK-Prod-Token` (in production vault)
129-
130-
### SecureBuild Benefits
131-
- **Zero CVE Images**: Automatically patched base images
132-
- **Multi-Registry Publishing**: Single build → multiple registries
133-
- **Enhanced Security**: SLSA attestations + SBOM generation
134-
- **Compliance Ready**: Meets enterprise security requirements
135-
136-
### Image Naming Architecture
137-
SecureBuild handles different registry naming requirements:
138-
- **Docker Hub**: Uses `replicated-sdk` image name
139-
- **Replicated Registries**: Uses `replicated-sdk-image` image name
140-
- **CVE0.io**: Uses `replicated-sdk` image name
141-
142-
This ensures compatibility with existing Docker Hub users and Replicated Helm charts.
143-
144-
### Configuration Files
145-
- **SecureBuild**: Uses `deploy/apko-securebuild.yaml`
146-
- **Traditional**: Uses `deploy/apko-wolfi.yaml`
147-
- **Selection**: Automatic based on `USE_SECUREBUILD` environment variable
148-
149-
### Current Limitations
150-
**Package Dependency Requirement**: The SecureBuild pipeline dynamically modifies the APKO configuration:
151-
- Version substitution: `VERSION: 1.0.0``VERSION: "your-version"`
152-
- Package substitution: `- replicated``- replicated-your-version`
153-
154-
**Important**: The versioned package (e.g., `replicated-1.0.0-beta.1`) must already exist in the CVE0.io repository before the APKO build. The current pipeline does not automatically create these packages via melange submission.
155-
156-
### Troubleshooting SecureBuild
157-
Common issues and solutions:
158-
159-
**403 Forbidden Errors**:
160-
- Check 1Password service account has vault access
161-
- Verify SecureBuild team has "Custom APKO Upload" feature flag
162-
- Confirm API tokens are valid in 1Password items
163-
164-
**Missing Package Errors**:
165-
- SecureBuild uses CVE0.io repository for packages
166-
- Package `replicated-{version}` must exist before APKO build
167-
- **Current workaround**: Manually create packages in SecureBuild before running builds
168-
- **Future enhancement**: Automatic melange.yaml submission for package generation
169-
170-
**Build Timeouts**:
171-
- Monitor build status in SecureBuild dashboard
172-
- Check Dagger traces for detailed timing
173-
174-
---
17554

17655
## Available Flags
17756

@@ -181,19 +60,19 @@ Common issues and solutions:
18160
- `--dev`: (boolean) Use development environment (ttl.sh)
18261
- `--staging`: (boolean) Use staging environment
18362
- `--version`: Version string for the release
184-
- `--slsa`: (boolean) Enable SLSA provenance generation *(ignored when using SecureBuild)*
185-
- `--github-token`: GitHub token for SLSA workflow access *(ignored when using SecureBuild)*
63+
- `--slsa`: (boolean) Enable SLSA provenance generation
64+
- `--github-token`: GitHub token for SLSA workflow access
18665

187-
**Note**: When using SecureBuild (`USE_SECUREBUILD=true`), SLSA attestations and SBOM generation are automatic. The `--slsa` and `--github-token` flags are only used with the traditional Chainguard pipeline.
66+
Note: SLSA provenance generation requires both `--slsa=true` and a valid `--github-token`.
18867

18968
## SBOM Generation
19069

19170
Software Bill of Materials (SBOM) is automatically generated during the build process:
19271

19372
1. **Generation Method**:
194-
- **SecureBuild**: Automatically generates comprehensive SBOMs with CVE remediation data
195-
- **Traditional**: Uses Chainguard's melange and apko to create SPDX-formatted SBOMs
196-
- SBOMs include all direct and transitive dependencies with license information
73+
- Uses Chainguard's melange and apko to create SPDX-formatted SBOMs
74+
- SBOMs are generated for both the base image and application layers
75+
- Includes all direct and transitive dependencies
19776

19877
2. **SBOM Format**:
19978
- Format: SPDX JSON
@@ -204,25 +83,33 @@ Software Bill of Materials (SBOM) is automatically generated during the build pr
20483
- Creation metadata
20584

20685
3. **Verification**:
207-
- Refer to the instructions at securebuild.com
86+
- SBOMs are signed using cosign
87+
- Attestations are attached to the container image
88+
- Use the verification script in `certs/verify-image.sh` to verify:
89+
- SLSA provenance
90+
- Image signatures
91+
- SBOM attestations
92+
```bash
93+
./certs/verify-image.sh --env <dev|stage|prod> --version <version> --digest <image-digest>
94+
```
20895

20996
4. **Viewing SBOM**:
210-
- Refer to the instructions at securebuild.com
211-
212-
5. **Image Attestation**
213-
- Refer to the instructions at securebuild.com
214-
215-
---
216-
217-
## 🔄 **Migration Notes**
218-
219-
### GitHub Actions Integration
220-
As of September 2025, GitHub Actions workflows automatically use SecureBuild for staging and production builds:
221-
- **Environment Variable**: `USE_SECUREBUILD=true` is set in `.github/workflows/publish.yml`
222-
- **Backward Compatibility**: Wolfi based pipeline remains as fallback if flag is removed
223-
- **No Breaking Changes**: All existing interfaces and outputs remain unchanged
224-
225-
### For Contributors
226-
- **Development builds**: Can still use TTL.sh without any SecureBuild credentials
227-
- **No setup required**: Traditional Wolfi builds work without configuration
228-
- **Optional SecureBuild**: Set `USE_SECUREBUILD=true` only if you have access
97+
- Full SBOM content can be viewed using the `--show-sbom` flag with verify-image.sh:
98+
```bash
99+
./certs/verify-image.sh --env <dev|stage|prod> --version <version> --digest <image-digest> --show-sbom
100+
```
101+
102+
## Image Attestation
103+
104+
- Images pushed to Dockerhub are attested using cosign
105+
- This provides an additional layer of verification for public images
106+
- The attestation includes:
107+
- SBOM data
108+
- Build provenance
109+
- Image signatures
110+
111+
For production releases, SLSA provenance is automatically generated:
112+
- Triggered by the Dagger pipeline during production releases
113+
- Requires a GitHub token with permissions to trigger the SLSA workflow (`slsa.yml`)
114+
- The workflow is triggered via GitHub API to generate and attach provenance to the image
115+
- This step is skipped for development and staging releases

0 commit comments

Comments
 (0)