chore: publish IntegraCI build modules dafcf6d0e87d
This commit is contained in:
1 parent
395617ae63
commit
e6bc5d215e
6 files changed
+60
-14
No files matched your search
+4
-4
@@ -135,8 +135,8 @@ dagger -m ./dagger/cosign call attest-sbom \
|
||||
```bash
|
||||
dagger -m ./dagger/cosign call attest-provenance \
|
||||
--image ghcr.io/integraci/payments-api:1.2.3@sha256:<64 hex image digest> \
|
||||
--builder-id "https://github.com/integraci/integraci/.github/workflows/release.yml@refs/tags/v1.2.3" \
|
||||
--source-uri "git+https://github.com/integraci/integraci@refs/tags/v1.2.3" \
|
||||
--builder-id "https://github.com/integraci-co/integraci/.github/workflows/release.yml@refs/tags/v1.2.3" \
|
||||
--source-uri "git+https://github.com/integraci-co/integraci@refs/tags/v1.2.3" \
|
||||
--source-digest "$(git rev-parse HEAD)" \
|
||||
--invocation-id "${{ github.run_id }}" \
|
||||
--keyless
|
||||
@@ -165,8 +165,8 @@ dagger -m ./dagger/cosign call attest-provenance \
|
||||
```bash
|
||||
dagger -m ./dagger/cosign call verify-provenance \
|
||||
--image ghcr.io/integraci/payments-api:1.2.3@sha256:<64 hex> \
|
||||
--expected-builder-id "https://github.com/integraci/integraci/.github/workflows/release.yml@refs/tags/v1.2.3" \
|
||||
--expected-source-repo "https://github.com/integraci/integraci" \
|
||||
--expected-builder-id "https://github.com/integraci-co/integraci/.github/workflows/release.yml@refs/tags/v1.2.3" \
|
||||
--expected-source-repo "https://github.com/integraci-co/integraci" \
|
||||
--issuer-regex 'https://token\.actions\.githubusercontent\.com'
|
||||
```
|
||||
|
||||
|
||||
@@ -169,3 +169,21 @@ func CheckRegex(flag, re string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnpublishedSignatureNotice is printed (and returned in SignResult.Notice)
|
||||
// by the gpg and in-toto cases of SignMethod. Both produce their output inside
|
||||
// a throwaway container and neither pushes nor exports it, so no one (the
|
||||
// platform or a human) can check that signature afterwards. The step keeps
|
||||
// succeeding (owner rule 2026-11-08: pipelines already rendered with these
|
||||
// methods must keep working); it just stops claiming a usable signature.
|
||||
// Empty for every other method.
|
||||
func UnpublishedSignatureNotice(method string) string {
|
||||
switch method {
|
||||
case "gpg", "in-toto":
|
||||
return "WARNING: --method " + method + " produced a signature that is NOT published " +
|
||||
"(not pushed to the registry, not exported), so it cannot be verified by the " +
|
||||
"platform or anyone else. A deploy that requires a signed artifact will be refused. " +
|
||||
"Use --method cosign for a signature the platform verifies."
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -200,3 +200,17 @@ func TestRekorURLRefusesUnsafeValues(t *testing.T) {
|
||||
t.Fatalf("a plain https URL must pass: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnpublishedSignatureNotice(t *testing.T) {
|
||||
for _, m := range []string{"gpg", "in-toto"} {
|
||||
n := UnpublishedSignatureNotice(m)
|
||||
if !strings.Contains(n, "NOT published") || !strings.Contains(n, m) {
|
||||
t.Fatalf("%s: notice must say the signature is not published and name the method, got %q", m, n)
|
||||
}
|
||||
}
|
||||
for _, m := range []string{"cosign", "notation", "none", ""} {
|
||||
if n := UnpublishedSignatureNotice(m); n != "" {
|
||||
t.Fatalf("%s publishes a signature (or claims none); want no notice, got %q", m, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-6
@@ -221,8 +221,12 @@ func (m *Cosign) Sign(
|
||||
// (keyless) and prints a deprecation notice: pipelines rendered before
|
||||
// 2026-10-18 make exactly that call and must keep working.
|
||||
// - notation: NotaryProject `notation sign` (COSE) using the supplied key.
|
||||
// - gpg: GPG detached-sign of the image manifest.
|
||||
// - in-toto: in-toto CLI attestation (link metadata) over the manifest.
|
||||
// Pushed as an OCI referrer; the platform does NOT verify it (cosign only).
|
||||
// - gpg: GPG detached-sign of the image manifest. NOT published: the
|
||||
// .asc stays in the step's container, so nothing can verify it.
|
||||
// - in-toto: in-toto CLI attestation (link metadata). NOT published either.
|
||||
// gpg and in-toto print attestation.UnpublishedSignatureNotice and still
|
||||
// succeed, so pipelines already rendered with them keep running.
|
||||
// - none: no-op skip (mirrors the adapter's _comment_skip).
|
||||
//
|
||||
// Usage (keyed cosign — the default):
|
||||
@@ -393,10 +397,15 @@ func (m *Cosign) SignMethod(
|
||||
if _, err := c.WithExec([]string{"sh", "-c", script}).Sync(ctx); err != nil {
|
||||
return nil, fmt.Errorf("gpg sign failed: %w", err)
|
||||
}
|
||||
// The .asc stays in the container: say so instead of naming it as if
|
||||
// it could be fetched (attestation.UnpublishedSignatureNotice).
|
||||
notice := attestation.UnpublishedSignatureNotice("gpg")
|
||||
fmt.Fprintln(os.Stderr, notice)
|
||||
return &SignResult{
|
||||
Image: imageRef,
|
||||
Signature: imageRef + " (gpg detached manifest.json.asc)",
|
||||
Signature: imageRef + " (gpg detached signature, not published)",
|
||||
Success: true,
|
||||
Notice: notice,
|
||||
}, nil
|
||||
|
||||
case "in-toto":
|
||||
@@ -415,10 +424,14 @@ func (m *Cosign) SignMethod(
|
||||
if _, err := c.WithExec([]string{"sh", "-c", script}).Sync(ctx); err != nil {
|
||||
return nil, fmt.Errorf("in-toto attestation failed: %w", err)
|
||||
}
|
||||
// The link file stays in the container (attestation.UnpublishedSignatureNotice).
|
||||
notice := attestation.UnpublishedSignatureNotice("in-toto")
|
||||
fmt.Fprintln(os.Stderr, notice)
|
||||
return &SignResult{
|
||||
Image: imageRef,
|
||||
Signature: imageRef + " (in-toto link attestation)",
|
||||
Signature: imageRef + " (in-toto link attestation, not published)",
|
||||
Success: true,
|
||||
Notice: notice,
|
||||
}, nil
|
||||
|
||||
default:
|
||||
@@ -523,8 +536,8 @@ func (m *Cosign) Verify(
|
||||
//
|
||||
// dagger call attest-provenance \
|
||||
// --image ghcr.io/integraci/payments-api:1.2.3@sha256:<64 hex image digest> \
|
||||
// --builder-id https://github.com/integraci/integraci/.github/workflows/release.yml@refs/tags/v1.2.3 \
|
||||
// --source-uri git+https://github.com/integraci/integraci@refs/tags/v1.2.3 \
|
||||
// --builder-id https://github.com/integraci-co/integraci/.github/workflows/release.yml@refs/tags/v1.2.3 \
|
||||
// --source-uri git+https://github.com/integraci-co/integraci@refs/tags/v1.2.3 \
|
||||
// --source-digest "$(git rev-parse HEAD)" \
|
||||
// --build-type https://actions.github.io/buildtypes/workflow/v1 \
|
||||
// --invocation-id ${{ github.run_id }} \
|
||||
|
||||
Reference in new issue
Block a user