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
+103 -38
View File
@@ -31,7 +31,7 @@ const docTemplate = `{
"summary": "Check API support",
"responses": {
"200": {
"description": "ok\".",
"description": "ok",
"schema": {
"type": "string"
}
@@ -114,13 +114,13 @@ const docTemplate = `{
}
},
"400": {
"description": "bad request\".",
"description": "bad request",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal server error\".",
"description": "internal server error",
"schema": {
"type": "string"
}
@@ -157,7 +157,7 @@ const docTemplate = `{
}
},
"500": {
"description": "internal server error\".",
"description": "internal server error",
"schema": {
"type": "string"
}
@@ -200,13 +200,13 @@ const docTemplate = `{
}
},
"400": {
"description": "bad request\".",
"description": "bad request",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal server error\".",
"description": "internal server error",
"schema": {
"type": "string"
}
@@ -300,9 +300,6 @@ const docTemplate = `{
"responses": {
"202": {
"description": "accepted",
"schema": {
"type": "string"
},
"headers": {
"Location": {
"type": "string",
@@ -364,6 +361,19 @@ const docTemplate = `{
"responses": {
"204": {
"description": "no content",
"headers": {
"Location": {
"type": "string",
"description": "/v2/{name}/blobs/uploads/{session_id}"
},
"Range": {
"type": "string",
"description": "0-128"
}
}
},
"400": {
"description": "bad request",
"schema": {
"type": "string"
}
@@ -417,8 +427,15 @@ const docTemplate = `{
"responses": {
"201": {
"description": "created",
"schema": {
"type": "string"
"headers": {
"Docker-Content-Digest": {
"type": "string",
"description": "Digest of the committed blob"
},
"Location": {
"type": "string",
"description": "/v2/{name}/blobs/{digest}"
}
}
},
"404": {
@@ -461,11 +478,8 @@ const docTemplate = `{
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"type": "string"
}
"204": {
"description": "no content"
},
"404": {
"description": "not found",
@@ -509,10 +523,11 @@ const docTemplate = `{
"responses": {
"202": {
"description": "accepted",
"schema": {
"type": "string"
},
"headers": {
"Blob-Upload-UUID": {
"type": "string",
"description": "Opaque blob upload session identifier"
},
"Location": {
"type": "string",
"description": "/v2/{name}/blobs/uploads/{session_id}"
@@ -612,10 +627,7 @@ const docTemplate = `{
],
"responses": {
"202": {
"description": "accepted",
"schema": {
"type": "string"
}
"description": "accepted"
}
}
},
@@ -651,8 +663,9 @@ const docTemplate = `{
"$ref": "#/definitions/api.ImageManifest"
},
"headers": {
"constants.DistContentDigestKey": {
"type": "object"
"Docker-Content-Digest": {
"type": "string",
"description": "Manifest digest of the content"
}
}
}
@@ -692,8 +705,9 @@ const docTemplate = `{
"$ref": "#/definitions/api.ImageManifest"
},
"headers": {
"constants.DistContentDigestKey": {
"type": "object"
"Docker-Content-Digest": {
"type": "string",
"description": "Manifest digest of the content"
}
}
},
@@ -712,7 +726,7 @@ const docTemplate = `{
}
},
"put": {
"description": "Update an image's manifest given a reference or a digest",
"description": "Update an image's manifest given a reference or a digest. On digest pushes with ` + "`" + `tag=` + "`" + ` query\nparameters, 201 responses repeat the ` + "`" + `OCI-Tag` + "`" + ` header once per tag value.",
"consumes": [
"application/json"
],
@@ -734,13 +748,30 @@ const docTemplate = `{
"name": "reference",
"in": "path",
"required": true
},
{
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"description": "additional tag(s) for digest pushes",
"name": "tag",
"in": "query"
}
],
"responses": {
"201": {
"description": "created",
"schema": {
"type": "string"
"headers": {
"Docker-Content-Digest": {
"type": "string",
"description": "Manifest digest of the uploaded content"
},
"OCI-Tag": {
"type": "string",
"description": "Echoed tag= value; this header is repeatable (one field per tag= query parameter)"
}
}
},
"400": {
@@ -755,6 +786,12 @@ const docTemplate = `{
"type": "string"
}
},
"414": {
"description": "too many tag query parameters",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal server error",
"schema": {
@@ -789,8 +826,35 @@ const docTemplate = `{
}
],
"responses": {
"200": {
"description": "ok",
"202": {
"description": "accepted"
},
"400": {
"description": "bad request",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"405": {
"description": "method not allowed",
"schema": {
"type": "string"
}
},
"409": {
"description": "conflict",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal server error",
"schema": {
"type": "string"
}
@@ -829,8 +893,9 @@ const docTemplate = `{
"type": "string"
},
"headers": {
"constants.DistContentDigestKey": {
"type": "object"
"Docker-Content-Digest": {
"type": "string",
"description": "Manifest digest of the content"
}
}
},
@@ -841,7 +906,7 @@ const docTemplate = `{
}
},
"500": {
"description": "internal server error\".",
"description": "internal server error",
"schema": {
"type": "string"
}
@@ -944,7 +1009,7 @@ const docTemplate = `{
}
},
"400": {
"description": "bad request\".",
"description": "bad request",
"schema": {
"type": "string"
}
@@ -1094,13 +1159,13 @@ const docTemplate = `{
"summary": "Logout by removing current session",
"responses": {
"200": {
"description": "ok\".",
"description": "ok",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal server error\".",
"description": "internal server error",
"schema": {
"type": "string"
}