Skip to content

Commit 9f88210

Browse files
committed
Add reverse domain name for annotation keys
Signed-off-by: robert-cronin <[email protected]>
1 parent e416e05 commit 9f88210

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

integration/multiarch/patch_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ func verifyAnnotations(t *testing.T, patchedRef string, platforms []string, repo
351351

352352
// Check index-level annotations (Copa metadata)
353353
assert.NotEmpty(t, manifest.Annotations, "index-level annotations should not be empty")
354-
assert.Equal(t, "true", manifest.Annotations["copacetic.patched"], "should have Copa patched annotation")
355-
assert.NotEmpty(t, manifest.Annotations["copacetic.patched.timestamp"], "should have Copa timestamp annotation")
354+
assert.Equal(t, "true", manifest.Annotations["sh.copa.patched"], "should have Copa patched annotation")
355+
assert.NotEmpty(t, manifest.Annotations["sh.copa.patched.timestamp"], "should have Copa timestamp annotation")
356356
assert.NotEmpty(t, manifest.Annotations["org.opencontainers.image.created"], "should have created annotation")
357357

358358
t.Logf("found %d index-level annotations", len(manifest.Annotations))

pkg/patch/patch.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ import (
4848
)
4949

5050
const (
51-
copaProduct = "copa"
52-
defaultRegistry = "docker.io"
53-
defaultTag = "latest"
54-
LINUX = "linux"
55-
trueString = "true"
51+
copaProduct = "copa"
52+
defaultRegistry = "docker.io"
53+
defaultTag = "latest"
54+
LINUX = "linux"
55+
trueString = "true"
56+
copaAnnotationKeyPrefix = "sh.copa"
5657
)
5758

5859
// for testing.
@@ -133,13 +134,13 @@ func createMultiPlatformManifest(
133134
// add a custom annotation to indicate this image was patched by Copa
134135
patchedKey := exptypes.AnnotationKey{
135136
Type: exptypes.AnnotationIndex,
136-
Key: "copacetic.patched",
137+
Key: copaAnnotationKeyPrefix + ".patched",
137138
}
138139
annotations[patchedKey] = trueString
139140

140141
patchedTimestampKey := exptypes.AnnotationKey{
141142
Type: exptypes.AnnotationIndex,
142-
Key: "copacetic.patched.timestamp",
143+
Key: copaAnnotationKeyPrefix + ".patched.timestamp",
143144
}
144145
annotations[patchedTimestampKey] = time.Now().UTC().Format(time.RFC3339)
145146

@@ -155,13 +156,13 @@ func createMultiPlatformManifest(
155156

156157
patchedKey := exptypes.AnnotationKey{
157158
Type: exptypes.AnnotationIndex,
158-
Key: "copacetic.patched",
159+
Key: copaAnnotationKeyPrefix + ".patched",
159160
}
160161
annotations[patchedKey] = trueString
161162

162163
patchedTimestampKey := exptypes.AnnotationKey{
163164
Type: exptypes.AnnotationIndex,
164-
Key: "copacetic.patched.timestamp",
165+
Key: copaAnnotationKeyPrefix + ".patched.timestamp",
165166
}
166167
annotations[patchedTimestampKey] = time.Now().UTC().Format(time.RFC3339)
167168
}

0 commit comments

Comments
 (0)