Fix provenance JSON: use jq instead of heredoc to avoid whitespace
Some checks failed
Check for Upstream Stable Updates / Rebuild and push all variants (apko/flutter-sdk.yaml, flutter-sdk) (push) Blocked by required conditions
Check for Upstream Stable Updates / Create release for new Flutter version (push) Blocked by required conditions
Weekly Rebuild (CVE Updates) / rebuild (apko/base.yaml, base) (push) Failing after 24s
Weekly Rebuild (CVE Updates) / rebuild (apko/build.yaml, build) (push) Failing after 24s
Weekly Rebuild (CVE Updates) / rebuild (apko/dotnet-sdk.yaml, dotnet-sdk) (push) Failing after 27s
Weekly Rebuild (CVE Updates) / rebuild (apko/dotnet-runtime.yaml, dotnet-runtime) (push) Failing after 28s
Check for Upstream Stable Updates / Check Wolfi package updates (push) Successful in 14s
Check for Upstream Stable Updates / Check .NET stable releases (push) Successful in 1s
Check for Upstream Stable Updates / Check Flutter stable releases (push) Successful in 1s
Check for Upstream Stable Updates / Rebuild and push all variants (apko/base.yaml, base) (push) Failing after 17s
Check for Upstream Stable Updates / Rebuild and push all variants (apko/build.yaml, build) (push) Failing after 21s
Check for Upstream Stable Updates / Rebuild and push all variants (apko/dotnet-runtime.yaml, dotnet-runtime) (push) Failing after 20s
Weekly Rebuild (CVE Updates) / rebuild (apko/flutter-sdk.yaml, flutter-sdk) (push) Has been cancelled
Check for Upstream Stable Updates / Rebuild and push all variants (apko/dotnet-sdk.yaml, dotnet-sdk) (push) Has been cancelled
Some checks failed
Check for Upstream Stable Updates / Rebuild and push all variants (apko/flutter-sdk.yaml, flutter-sdk) (push) Blocked by required conditions
Check for Upstream Stable Updates / Create release for new Flutter version (push) Blocked by required conditions
Weekly Rebuild (CVE Updates) / rebuild (apko/base.yaml, base) (push) Failing after 24s
Weekly Rebuild (CVE Updates) / rebuild (apko/build.yaml, build) (push) Failing after 24s
Weekly Rebuild (CVE Updates) / rebuild (apko/dotnet-sdk.yaml, dotnet-sdk) (push) Failing after 27s
Weekly Rebuild (CVE Updates) / rebuild (apko/dotnet-runtime.yaml, dotnet-runtime) (push) Failing after 28s
Check for Upstream Stable Updates / Check Wolfi package updates (push) Successful in 14s
Check for Upstream Stable Updates / Check .NET stable releases (push) Successful in 1s
Check for Upstream Stable Updates / Check Flutter stable releases (push) Successful in 1s
Check for Upstream Stable Updates / Rebuild and push all variants (apko/base.yaml, base) (push) Failing after 17s
Check for Upstream Stable Updates / Rebuild and push all variants (apko/build.yaml, build) (push) Failing after 21s
Check for Upstream Stable Updates / Rebuild and push all variants (apko/dotnet-runtime.yaml, dotnet-runtime) (push) Failing after 20s
Weekly Rebuild (CVE Updates) / rebuild (apko/flutter-sdk.yaml, flutter-sdk) (push) Has been cancelled
Check for Upstream Stable Updates / Rebuild and push all variants (apko/dotnet-sdk.yaml, dotnet-sdk) (push) Has been cancelled
The heredoc with YAML indentation produced JSON with leading spaces, causing cosign to fail with "required field builder missing". Use jq -n with --arg to generate clean JSON. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2e07c31e99
commit
dcedc113e8
@ -96,44 +96,34 @@ jobs:
|
|||||||
COSIGN_YES: "true"
|
COSIGN_YES: "true"
|
||||||
run: |
|
run: |
|
||||||
IMAGE_DIGEST="${{ secrets.REGISTRY_URL }}/${{ env.IMAGE_NAME }}@${{ steps.publish.outputs.digest }}"
|
IMAGE_DIGEST="${{ secrets.REGISTRY_URL }}/${{ env.IMAGE_NAME }}@${{ steps.publish.outputs.digest }}"
|
||||||
# Generate SLSA-style provenance
|
DIGEST_SHA=$(echo '${{ steps.publish.outputs.digest }}' | sed 's/sha256://')
|
||||||
cat > /tmp/provenance.json << PROVEOF
|
jq -n \
|
||||||
{
|
--arg type "https://in-toto.io/Statement/v0.1" \
|
||||||
"_type": "https://in-toto.io/Statement/v0.1",
|
--arg predType "https://slsa.dev/provenance/v0.2" \
|
||||||
"predicateType": "https://slsa.dev/provenance/v0.2",
|
--arg name "${{ steps.publish.outputs.image_ref }}" \
|
||||||
"subject": [
|
--arg sha "$DIGEST_SHA" \
|
||||||
{
|
--arg builder "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
|
||||||
"name": "${{ steps.publish.outputs.image_ref }}",
|
--arg buildType "https://apko.dev/build/v1" \
|
||||||
"digest": {
|
--arg uri "${{ github.server_url }}/${{ github.repository }}" \
|
||||||
"sha256": "$(echo '${{ steps.publish.outputs.digest }}' | sed 's/sha256://')"
|
--arg sha1 "${{ github.sha }}" \
|
||||||
}
|
--arg entry "${{ matrix.config }}" \
|
||||||
}
|
--arg runId "${{ github.run_id }}" \
|
||||||
],
|
'{
|
||||||
|
"_type": $type,
|
||||||
|
"predicateType": $predType,
|
||||||
|
"subject": [{"name": $name, "digest": {"sha256": $sha}}],
|
||||||
"predicate": {
|
"predicate": {
|
||||||
"buildType": "https://apko.dev/build/v1",
|
"builder": {"id": $builder},
|
||||||
"builder": {
|
"buildType": $buildType,
|
||||||
"id": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
||||||
},
|
|
||||||
"invocation": {
|
"invocation": {
|
||||||
"configSource": {
|
"configSource": {"uri": $uri, "digest": {"sha1": $sha1}, "entryPoint": $entry}
|
||||||
"uri": "${{ github.server_url }}/${{ github.repository }}",
|
|
||||||
"digest": {
|
|
||||||
"sha1": "${{ github.sha }}"
|
|
||||||
},
|
|
||||||
"entryPoint": "${{ matrix.config }}"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"buildInvocationID": "${{ github.run_id }}",
|
"buildInvocationID": $runId,
|
||||||
"completeness": {
|
"completeness": {"parameters": true, "environment": true, "materials": true}
|
||||||
"parameters": true,
|
|
||||||
"environment": true,
|
|
||||||
"materials": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}' > /tmp/provenance.json
|
||||||
}
|
|
||||||
PROVEOF
|
|
||||||
cosign attest --predicate /tmp/provenance.json --type slsaprovenance "${IMAGE_DIGEST}"
|
cosign attest --predicate /tmp/provenance.json --type slsaprovenance "${IMAGE_DIGEST}"
|
||||||
echo "Provenance attestation attached successfully"
|
echo "Provenance attestation attached successfully"
|
||||||
|
|
||||||
|
|||||||
@ -89,43 +89,34 @@ jobs:
|
|||||||
COSIGN_YES: "true"
|
COSIGN_YES: "true"
|
||||||
run: |
|
run: |
|
||||||
IMAGE_DIGEST="${{ secrets.REGISTRY_URL }}/${{ env.IMAGE_NAME }}@${{ steps.publish.outputs.digest }}"
|
IMAGE_DIGEST="${{ secrets.REGISTRY_URL }}/${{ env.IMAGE_NAME }}@${{ steps.publish.outputs.digest }}"
|
||||||
cat > /tmp/provenance.json << PROVEOF
|
DIGEST_SHA=$(echo '${{ steps.publish.outputs.digest }}' | sed 's/sha256://')
|
||||||
{
|
jq -n \
|
||||||
"_type": "https://in-toto.io/Statement/v0.1",
|
--arg type "https://in-toto.io/Statement/v0.1" \
|
||||||
"predicateType": "https://slsa.dev/provenance/v0.2",
|
--arg predType "https://slsa.dev/provenance/v0.2" \
|
||||||
"subject": [
|
--arg name "${{ steps.publish.outputs.image_ref }}" \
|
||||||
{
|
--arg sha "$DIGEST_SHA" \
|
||||||
"name": "${{ steps.publish.outputs.image_ref }}",
|
--arg builder "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
|
||||||
"digest": {
|
--arg buildType "https://apko.dev/build/v1" \
|
||||||
"sha256": "$(echo '${{ steps.publish.outputs.digest }}' | sed 's/sha256://')"
|
--arg uri "${{ github.server_url }}/${{ github.repository }}" \
|
||||||
}
|
--arg sha1 "${{ github.sha }}" \
|
||||||
}
|
--arg entry "${{ matrix.config }}" \
|
||||||
],
|
--arg runId "${{ github.run_id }}" \
|
||||||
|
'{
|
||||||
|
"_type": $type,
|
||||||
|
"predicateType": $predType,
|
||||||
|
"subject": [{"name": $name, "digest": {"sha256": $sha}}],
|
||||||
"predicate": {
|
"predicate": {
|
||||||
"buildType": "https://apko.dev/build/v1",
|
"builder": {"id": $builder},
|
||||||
"builder": {
|
"buildType": $buildType,
|
||||||
"id": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
||||||
},
|
|
||||||
"invocation": {
|
"invocation": {
|
||||||
"configSource": {
|
"configSource": {"uri": $uri, "digest": {"sha1": $sha1}, "entryPoint": $entry}
|
||||||
"uri": "${{ github.server_url }}/${{ github.repository }}",
|
|
||||||
"digest": {
|
|
||||||
"sha1": "${{ github.sha }}"
|
|
||||||
},
|
|
||||||
"entryPoint": "${{ matrix.config }}"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"buildInvocationID": "${{ github.run_id }}",
|
"buildInvocationID": $runId,
|
||||||
"completeness": {
|
"completeness": {"parameters": true, "environment": true, "materials": true}
|
||||||
"parameters": true,
|
|
||||||
"environment": true,
|
|
||||||
"materials": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}' > /tmp/provenance.json
|
||||||
}
|
|
||||||
PROVEOF
|
|
||||||
cosign attest --predicate /tmp/provenance.json --type slsaprovenance "${IMAGE_DIGEST}"
|
cosign attest --predicate /tmp/provenance.json --type slsaprovenance "${IMAGE_DIGEST}"
|
||||||
echo "Provenance attestation attached successfully"
|
echo "Provenance attestation attached successfully"
|
||||||
|
|
||||||
|
|||||||
@ -179,43 +179,34 @@ jobs:
|
|||||||
COSIGN_YES: "true"
|
COSIGN_YES: "true"
|
||||||
run: |
|
run: |
|
||||||
IMAGE_DIGEST="${{ secrets.REGISTRY_URL }}/${{ env.IMAGE_NAME }}@${{ steps.publish.outputs.digest }}"
|
IMAGE_DIGEST="${{ secrets.REGISTRY_URL }}/${{ env.IMAGE_NAME }}@${{ steps.publish.outputs.digest }}"
|
||||||
cat > /tmp/provenance.json << PROVEOF
|
DIGEST_SHA=$(echo '${{ steps.publish.outputs.digest }}' | sed 's/sha256://')
|
||||||
{
|
jq -n \
|
||||||
"_type": "https://in-toto.io/Statement/v0.1",
|
--arg type "https://in-toto.io/Statement/v0.1" \
|
||||||
"predicateType": "https://slsa.dev/provenance/v0.2",
|
--arg predType "https://slsa.dev/provenance/v0.2" \
|
||||||
"subject": [
|
--arg name "${{ steps.publish.outputs.image_ref }}" \
|
||||||
{
|
--arg sha "$DIGEST_SHA" \
|
||||||
"name": "${{ steps.publish.outputs.image_ref }}",
|
--arg builder "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
|
||||||
"digest": {
|
--arg buildType "https://apko.dev/build/v1" \
|
||||||
"sha256": "$(echo '${{ steps.publish.outputs.digest }}' | sed 's/sha256://')"
|
--arg uri "${{ github.server_url }}/${{ github.repository }}" \
|
||||||
}
|
--arg sha1 "${{ github.sha }}" \
|
||||||
}
|
--arg entry "${{ matrix.config }}" \
|
||||||
],
|
--arg runId "${{ github.run_id }}" \
|
||||||
|
'{
|
||||||
|
"_type": $type,
|
||||||
|
"predicateType": $predType,
|
||||||
|
"subject": [{"name": $name, "digest": {"sha256": $sha}}],
|
||||||
"predicate": {
|
"predicate": {
|
||||||
"buildType": "https://apko.dev/build/v1",
|
"builder": {"id": $builder},
|
||||||
"builder": {
|
"buildType": $buildType,
|
||||||
"id": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
||||||
},
|
|
||||||
"invocation": {
|
"invocation": {
|
||||||
"configSource": {
|
"configSource": {"uri": $uri, "digest": {"sha1": $sha1}, "entryPoint": $entry}
|
||||||
"uri": "${{ github.server_url }}/${{ github.repository }}",
|
|
||||||
"digest": {
|
|
||||||
"sha1": "${{ github.sha }}"
|
|
||||||
},
|
|
||||||
"entryPoint": "${{ matrix.config }}"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"buildInvocationID": "${{ github.run_id }}",
|
"buildInvocationID": $runId,
|
||||||
"completeness": {
|
"completeness": {"parameters": true, "environment": true, "materials": true}
|
||||||
"parameters": true,
|
|
||||||
"environment": true,
|
|
||||||
"materials": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}' > /tmp/provenance.json
|
||||||
}
|
|
||||||
PROVEOF
|
|
||||||
cosign attest --predicate /tmp/provenance.json --type slsaprovenance "${IMAGE_DIGEST}"
|
cosign attest --predicate /tmp/provenance.json --type slsaprovenance "${IMAGE_DIGEST}"
|
||||||
echo "Provenance attestation attached successfully"
|
echo "Provenance attestation attached successfully"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user