feat: support pushing multiple tags for a single manifest (#3885)

* feat: support pushing multiple tags for a single manifest

See https://github.com/opencontainers/distribution-spec/pull/600

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>

* fix: constants not replaced in swagger output

Also godot mandates comments ending in dots,
which produces bad results in the swagger generated files, see the extra ". which is now fixed below:

```
diff --git a/swagger/docs.go b/swagger/docs.go
index 84b08277..fb2c45c3 100644
--- a/swagger/docs.go
+++ b/swagger/docs.go
@@ -114,7 +114,7 @@ const docTemplate = `{
                         }
                     },
                     "400": {
-                        "description": "bad request\".",
+                        "description": "bad request",
                         "schema": {
                             "type": "string"
                         }
@@ -200,7 +200,7 @@ const docTemplate = `{
                         }
                     },
                     "400": {
-                        "description": "bad request\".",
+                        "description": "bad request",
                         "schema": {
                             "type": "string"
                         }
diff --git a/swagger/swagger.json b/swagger/swagger.json
index cfeb3900..247f95fa 100644
--- a/swagger/swagger.json
+++ b/swagger/swagger.json
@@ -106,7 +106,7 @@
                         }
                     },
                     "400": {
-                        "description": "bad request\".",
+                        "description": "bad request",
                         "schema": {
                             "type": "string"
                         }
@@ -192,7 +192,7 @@
                         }
                     },
                     "400": {
-                        "description": "bad request\".",
+                        "description": "bad request",
                         "schema": {
                             "type": "string"
                         }
diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml
index 57641c2f..09b30dcc 100644
--- a/swagger/swagger.yaml
+++ b/swagger/swagger.yaml
@@ -310,7 +310,7 @@ paths:
           schema:
             type: string
         "400":
-          description: bad request".
+          description: bad request
           schema:
             type: string
         "500":
@@ -366,7 +366,7 @@ paths:
           schema:
             type: string
         "400":
-          description: bad request".
+          description: bad request
           schema:
             type: string
         "500":
```

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>

---------

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
This commit is contained in:
Andrei Aaron
2026-03-29 21:13:24 +03:00
committed by GitHub
parent 705939aed3
commit a5cc8ab810
34 changed files with 2225 additions and 365 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ func WriteImageToFileSystem(image Image, repoName, ref string, storeController s
return err
}
_, _, err = store.PutImageManifest(repoName, ref, image.Manifest.MediaType, manifestBlob)
_, _, err = store.PutImageManifest(repoName, ref, image.Manifest.MediaType, manifestBlob, nil)
if err != nil {
return err
}
@@ -82,7 +82,7 @@ func WriteMultiArchImageToFileSystem(multiarchImage MultiarchImage, repoName, re
}
_, _, err = store.PutImageManifest(repoName, ref, multiarchImage.Index.MediaType,
indexBlob)
indexBlob, nil)
return err
}
+1 -1
View File
@@ -67,7 +67,7 @@ func TestWriteImageToFileSystem(t *testing.T) {
"tag",
storage.StoreController{
DefaultStore: mocks.MockedImageStore{
PutImageManifestFn: func(repo, reference, mediaType string, body []byte,
PutImageManifestFn: func(repo, reference, mediaType string, body []byte, _ []string,
) (godigest.Digest, godigest.Digest, error) {
return "", "", ErrTestError
},
+4 -3
View File
@@ -23,8 +23,8 @@ type MockedImageStore struct {
GetNextRepositoriesFn func(lastRepo string, maxEntries int, fn storageTypes.FilterRepoFunc) ([]string, bool, error)
GetImageTagsFn func(repo string) ([]string, error)
GetImageManifestFn func(repo string, reference string) ([]byte, godigest.Digest, string, error)
PutImageManifestFn func(repo string, reference string, mediaType string, body []byte) (godigest.Digest,
godigest.Digest, error)
PutImageManifestFn func(repo string, reference string, mediaType string, body []byte,
extraTags []string) (godigest.Digest, godigest.Digest, error)
DeleteImageManifestFn func(repo string, reference string, detectCollision bool) error
BlobUploadPathFn func(repo string, uuid string) string
StatBlobUploadFn func(repo string, uuid string) (bool, int64, time.Time, error)
@@ -163,9 +163,10 @@ func (is MockedImageStore) PutImageManifest(
reference string,
mediaType string,
body []byte,
extraTags []string,
) (godigest.Digest, godigest.Digest, error) {
if is.PutImageManifestFn != nil {
return is.PutImageManifestFn(repo, reference, mediaType, body)
return is.PutImageManifestFn(repo, reference, mediaType, body, extraTags)
}
return "", "", nil