Skip to content

Commit e99897c

Browse files
authored
Merge pull request #940 from saschagrunert/digest
Include digest for normalized edges and bump to v4.0.4
2 parents 1f339cc + faa3af8 commit e99897c

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.3
1+
4.0.4

cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ substitutions:
3131
# vYYYYMMDD-hash, and can be used as a substitution
3232
_GIT_TAG: '12345'
3333
_PULL_BASE_REF: 'dev'
34-
_IMG_VERSION: 'v4.0.3-0'
34+
_IMG_VERSION: 'v4.0.4-0'
3535

3636
tags:
3737
- 'kpromo'

dependencies.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependencies:
22
# Release version
33
- name: "repo release version"
4-
version: 4.0.3
4+
version: 4.0.4
55
refPaths:
66
- path: VERSION
77

@@ -57,7 +57,7 @@ dependencies:
5757
match: go \d+.\d+
5858

5959
- name: "k8s.gcr.io/artifact-promoter/kpromo"
60-
version: v4.0.3-0
60+
version: v4.0.4-0
6161
refPaths:
6262
- path: cloudbuild.yaml
6363
match: "_IMG_VERSION: 'v((([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)-([0-9]+)'"

internal/promoter/image/sign.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,12 @@ func (di *DefaultPromoterImplementation) SignImages(
121121
// used at all and images would be signed with a wrong identity.
122122
di.signer = sign.New(signOpts)
123123

124-
// We only sign the first normalized image of each edge.
125-
sortedEdges := map[string][]reg.PromotionEdge{}
124+
// We only sign the first normalized image per digest of each edge.
125+
type key struct {
126+
identity string
127+
digest image.Digest
128+
}
129+
sortedEdges := map[key][]reg.PromotionEdge{}
126130
for edge := range edges {
127131
// Skip signing the signature, sbom and attestation layers
128132
if strings.HasSuffix(string(edge.DstImageTag.Tag), ".sig") ||
@@ -131,19 +135,19 @@ func (di *DefaultPromoterImplementation) SignImages(
131135
continue
132136
}
133137

134-
identity := targetIdentity(&edge)
135-
if _, ok := sortedEdges[identity]; !ok {
136-
sortedEdges[identity] = []reg.PromotionEdge{}
138+
k := key{identity: targetIdentity(&edge), digest: edge.Digest}
139+
if _, ok := sortedEdges[k]; !ok {
140+
sortedEdges[k] = []reg.PromotionEdge{}
137141
}
138-
sortedEdges[identity] = append(sortedEdges[identity], edge)
142+
sortedEdges[k] = append(sortedEdges[k], edge)
139143
}
140144

141145
t := throttler.New(opts.MaxSignatureOps, len(sortedEdges))
142146
// Sign the required edges
143147
for d := range sortedEdges {
144148
d := d
145-
go func(identity string) {
146-
t.Done(di.signAndReplicate(signOpts, identity, sortedEdges[identity]))
149+
go func(k key) {
150+
t.Done(di.signAndReplicate(signOpts, k.identity, sortedEdges[k]))
147151
}(d)
148152
if t.Throttle() > 0 {
149153
break

workspace_status.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ p_ IMG_REGISTRY gcr.io
6565
p_ IMG_REPOSITORY k8s-staging-artifact-promoter
6666
p_ IMG_NAME kpromo
6767
p_ IMG_TAG "${image_tag}"
68-
p_ IMG_VERSION v4.0.3-0
68+
p_ IMG_VERSION v4.0.4-0
6969
p_ TEST_AUDIT_PROD_IMG_REPOSITORY us.gcr.io/k8s-gcr-audit-test-prod
7070
p_ TEST_AUDIT_STAGING_IMG_REPOSITORY gcr.io/k8s-gcr-audit-test-prod
7171
p_ TEST_AUDIT_PROJECT_ID k8s-gcr-audit-test-prod

0 commit comments

Comments
 (0)