Skip to content

Commit 08654b0

Browse files
committed
registry: deprecate RepositoryInfo.Official field
This field indicates whether a repository is an official image (Docker Library / Docker Official Images). This information is deducted from the image reference, and not used anywhere, other than in tests. The `RepositoryInfo` and `IndexInfo` types were originally introduced in 568f86e, with their fields documented in 4fcb9ac. At the time, the `Official` field was only used for `docker push` to produce a custom error message if someone would attempt to push an official image to docker hub (assuming nobody would be able to do so); https://github.com/moby/moby/blob/6870bde5847d4484d87f91baf58edc52f575ea5d/api/client/commands.go#L1184-L1194 Before that commit, the condition for this error message was based on the given image reference directly; b370acd https://github.com/moby/moby/blob/b370acd679622239849b1dfbe05d61804aeb7162/commands.go#L421-L428 This patch deprecates the field, because it's not used, and removes tests related to it. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent d86dd75 commit 08654b0

2 files changed

Lines changed: 2 additions & 22 deletions

File tree

registry/registry_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func TestParseRepositoryInfo(t *testing.T) {
4040
RemoteName string
4141
CanonicalName string
4242
LocalName string
43-
Official bool
4443
}
4544

4645
expectedRepoInfos := map[string]staticRepositoryInfo{
@@ -52,7 +51,6 @@ func TestParseRepositoryInfo(t *testing.T) {
5251
RemoteName: "fooo/bar",
5352
LocalName: "fooo/bar",
5453
CanonicalName: "docker.io/fooo/bar",
55-
Official: false,
5654
},
5755
"library/ubuntu": {
5856
Index: &registry.IndexInfo{
@@ -62,7 +60,6 @@ func TestParseRepositoryInfo(t *testing.T) {
6260
RemoteName: "library/ubuntu",
6361
LocalName: "ubuntu",
6462
CanonicalName: "docker.io/library/ubuntu",
65-
Official: true,
6663
},
6764
"nonlibrary/ubuntu": {
6865
Index: &registry.IndexInfo{
@@ -72,7 +69,6 @@ func TestParseRepositoryInfo(t *testing.T) {
7269
RemoteName: "nonlibrary/ubuntu",
7370
LocalName: "nonlibrary/ubuntu",
7471
CanonicalName: "docker.io/nonlibrary/ubuntu",
75-
Official: false,
7672
},
7773
"ubuntu": {
7874
Index: &registry.IndexInfo{
@@ -82,7 +78,6 @@ func TestParseRepositoryInfo(t *testing.T) {
8278
RemoteName: "library/ubuntu",
8379
LocalName: "ubuntu",
8480
CanonicalName: "docker.io/library/ubuntu",
85-
Official: true,
8681
},
8782
"other/library": {
8883
Index: &registry.IndexInfo{
@@ -92,7 +87,6 @@ func TestParseRepositoryInfo(t *testing.T) {
9287
RemoteName: "other/library",
9388
LocalName: "other/library",
9489
CanonicalName: "docker.io/other/library",
95-
Official: false,
9690
},
9791
"127.0.0.1:8000/private/moonbase": {
9892
Index: &registry.IndexInfo{
@@ -102,7 +96,6 @@ func TestParseRepositoryInfo(t *testing.T) {
10296
RemoteName: "private/moonbase",
10397
LocalName: "127.0.0.1:8000/private/moonbase",
10498
CanonicalName: "127.0.0.1:8000/private/moonbase",
105-
Official: false,
10699
},
107100
"127.0.0.1:8000/privatebase": {
108101
Index: &registry.IndexInfo{
@@ -112,7 +105,6 @@ func TestParseRepositoryInfo(t *testing.T) {
112105
RemoteName: "privatebase",
113106
LocalName: "127.0.0.1:8000/privatebase",
114107
CanonicalName: "127.0.0.1:8000/privatebase",
115-
Official: false,
116108
},
117109
"localhost:8000/private/moonbase": {
118110
Index: &registry.IndexInfo{
@@ -122,7 +114,6 @@ func TestParseRepositoryInfo(t *testing.T) {
122114
RemoteName: "private/moonbase",
123115
LocalName: "localhost:8000/private/moonbase",
124116
CanonicalName: "localhost:8000/private/moonbase",
125-
Official: false,
126117
},
127118
"localhost:8000/privatebase": {
128119
Index: &registry.IndexInfo{
@@ -132,7 +123,6 @@ func TestParseRepositoryInfo(t *testing.T) {
132123
RemoteName: "privatebase",
133124
LocalName: "localhost:8000/privatebase",
134125
CanonicalName: "localhost:8000/privatebase",
135-
Official: false,
136126
},
137127
"example.com/private/moonbase": {
138128
Index: &registry.IndexInfo{
@@ -142,7 +132,6 @@ func TestParseRepositoryInfo(t *testing.T) {
142132
RemoteName: "private/moonbase",
143133
LocalName: "example.com/private/moonbase",
144134
CanonicalName: "example.com/private/moonbase",
145-
Official: false,
146135
},
147136
"example.com/privatebase": {
148137
Index: &registry.IndexInfo{
@@ -152,7 +141,6 @@ func TestParseRepositoryInfo(t *testing.T) {
152141
RemoteName: "privatebase",
153142
LocalName: "example.com/privatebase",
154143
CanonicalName: "example.com/privatebase",
155-
Official: false,
156144
},
157145
"example.com:8000/private/moonbase": {
158146
Index: &registry.IndexInfo{
@@ -162,7 +150,6 @@ func TestParseRepositoryInfo(t *testing.T) {
162150
RemoteName: "private/moonbase",
163151
LocalName: "example.com:8000/private/moonbase",
164152
CanonicalName: "example.com:8000/private/moonbase",
165-
Official: false,
166153
},
167154
"example.com:8000/privatebase": {
168155
Index: &registry.IndexInfo{
@@ -172,7 +159,6 @@ func TestParseRepositoryInfo(t *testing.T) {
172159
RemoteName: "privatebase",
173160
LocalName: "example.com:8000/privatebase",
174161
CanonicalName: "example.com:8000/privatebase",
175-
Official: false,
176162
},
177163
"localhost/private/moonbase": {
178164
Index: &registry.IndexInfo{
@@ -182,7 +168,6 @@ func TestParseRepositoryInfo(t *testing.T) {
182168
RemoteName: "private/moonbase",
183169
LocalName: "localhost/private/moonbase",
184170
CanonicalName: "localhost/private/moonbase",
185-
Official: false,
186171
},
187172
"localhost/privatebase": {
188173
Index: &registry.IndexInfo{
@@ -192,7 +177,6 @@ func TestParseRepositoryInfo(t *testing.T) {
192177
RemoteName: "privatebase",
193178
LocalName: "localhost/privatebase",
194179
CanonicalName: "localhost/privatebase",
195-
Official: false,
196180
},
197181
IndexName + "/public/moonbase": {
198182
Index: &registry.IndexInfo{
@@ -202,7 +186,6 @@ func TestParseRepositoryInfo(t *testing.T) {
202186
RemoteName: "public/moonbase",
203187
LocalName: "public/moonbase",
204188
CanonicalName: "docker.io/public/moonbase",
205-
Official: false,
206189
},
207190
"index." + IndexName + "/public/moonbase": {
208191
Index: &registry.IndexInfo{
@@ -212,7 +195,6 @@ func TestParseRepositoryInfo(t *testing.T) {
212195
RemoteName: "public/moonbase",
213196
LocalName: "public/moonbase",
214197
CanonicalName: "docker.io/public/moonbase",
215-
Official: false,
216198
},
217199
"ubuntu-12.04-base": {
218200
Index: &registry.IndexInfo{
@@ -222,7 +204,6 @@ func TestParseRepositoryInfo(t *testing.T) {
222204
RemoteName: "library/ubuntu-12.04-base",
223205
LocalName: "ubuntu-12.04-base",
224206
CanonicalName: "docker.io/library/ubuntu-12.04-base",
225-
Official: true,
226207
},
227208
IndexName + "/ubuntu-12.04-base": {
228209
Index: &registry.IndexInfo{
@@ -232,7 +213,6 @@ func TestParseRepositoryInfo(t *testing.T) {
232213
RemoteName: "library/ubuntu-12.04-base",
233214
LocalName: "ubuntu-12.04-base",
234215
CanonicalName: "docker.io/library/ubuntu-12.04-base",
235-
Official: true,
236216
},
237217
"index." + IndexName + "/ubuntu-12.04-base": {
238218
Index: &registry.IndexInfo{
@@ -242,7 +222,6 @@ func TestParseRepositoryInfo(t *testing.T) {
242222
RemoteName: "library/ubuntu-12.04-base",
243223
LocalName: "ubuntu-12.04-base",
244224
CanonicalName: "docker.io/library/ubuntu-12.04-base",
245-
Official: true,
246225
},
247226
}
248227

@@ -261,7 +240,6 @@ func TestParseRepositoryInfo(t *testing.T) {
261240
assert.Check(t, is.Equal(reference.FamiliarName(repoInfo.Name), expectedRepoInfo.LocalName), reposName)
262241
assert.Check(t, is.Equal(repoInfo.Name.Name(), expectedRepoInfo.CanonicalName), reposName)
263242
assert.Check(t, is.Equal(repoInfo.Index.Official, expectedRepoInfo.Index.Official), reposName)
264-
assert.Check(t, is.Equal(repoInfo.Official, expectedRepoInfo.Official), reposName)
265243
}
266244
}
267245
}

registry/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ type RepositoryInfo struct {
1313
// Official indicates whether the repository is considered official.
1414
// If the registry is official, and the normalized name does not
1515
// contain a '/' (e.g. "foo"), then it is considered an official repo.
16+
//
17+
// Deprecated: this field is no longer used and will be removed in the next release. The information captured in this field can be obtained from the [Name] field instead.
1618
Official bool
1719
// Class represents the class of the repository, such as "plugin"
1820
// or "image".

0 commit comments

Comments
 (0)