chore: publish IntegraCI build modules c7167a3a27c2

This commit is contained in:
dhimaz0445 committed 2026-10-30 02:20:32 +00:00
1 parent 5f8a24d014
commit f58e80187a
7 files changed
+250 -20

No files matched your search

+31
View File
@@ -18,9 +18,36 @@ dagger call generate --source . [--image-ref REF] [--generator NAME]
| `--source` | yes | — | source directory to analyze |
| `--image-ref`| no | "" | container image to scan instead of the filesystem |
| `--generator`| no | `syft` | `syft \| cyclonedx \| spdx-tools \| trivy \| none` |
| `--registry-insecure` | no | false | the `--image-ref` registry is plain HTTP / self-signed (syft only) |
| `--registry-username` | no | "" | login for pulling `--image-ref` (paired with `--registry-password`) |
| `--registry-password` | no | — | Dagger secret (`env://VAR`), never a literal |
Returns the SBOM document as a `File`.
### Registry login
A registry that authenticates reads (Nexus with `forceBasicAuth`, most private
Harbor projects) refuses an anonymous manifest GET with `UNAUTHORIZED`. Give the
pull the same login the build pushed with:
- `syft` / `spdx-tools`: `SYFT_REGISTRY_AUTH_AUTHORITY` (the registry host of
`--image-ref`), `SYFT_REGISTRY_AUTH_USERNAME`, and `SYFT_REGISTRY_AUTH_PASSWORD`
as a secret variable — the names syft v1.18.1 reads
(`cmd/syft/internal/options/registry.go`).
- `trivy`: NOT `TRIVY_USERNAME`/`TRIVY_PASSWORD`, which trivy presents on every
OCI pull including its vulnerability-DB downloads. The exec line writes a
private `DOCKER_CONFIG` with one `auths` entry for the `--image-ref` host only,
from a secret variable.
- With a login, the repository checkout is **not** mounted and the working
directory is an empty `/work`: the image scan does not need the tree, and a
repository-controlled `.syft.yaml` / `trivy.yaml` could otherwise send the
login over plain HTTP or to another host.
Only both halves turn the login on. A complete pair with an `--image-ref` that
names no registry host is refused rather than sent to a guessed host. The
host-resolution logic lives in the stdlib-only `pullauth/` package so it can be
unit-tested without an engine session.
## Generators
| generator | image | output | notes |
@@ -40,6 +67,10 @@ dagger call generate --source . -o sbom.cdx.json
# Trivy scanning a built image
dagger call generate --source . --image-ref ghcr.io/org/app:tag --generator trivy -o sbom.cdx.json
# Private registry: the password is read from the environment as a secret
dagger call generate --source . --image-ref registry.example.test:8082/app:tag \
--registry-username "$REG_USER" --registry-password env://REG_PASS -o sbom.cdx.json
# SPDX document
dagger call generate --source . --generator spdx-tools -o sbom.spdx.json
```