Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Sync compose-schemas with upstream (docker/cli) #6642

Closed
wants to merge 1 commit into from

Conversation

thaJeztah
Copy link
Member

I wanted to update the compose-schemas to make sure they're in sync with upstream, but noticed there's changes in the schema in this repository that are not upstream.

Also; some of these patches were applied to older version, but are not in the latest (3.7) and upcoming (3.8) version.

We should make sure that both docker stack deploy and docker-compose up validation is equal, otherwise files may work for one, but won't work for the other.

If there's differences because of the implementation (Python vs Go), we should look if we can still use the same schema (if needed, upstream changes to docker/cli).

I was looking at reproducing the original issue () earlier this week (but not sure where I ended up, as I had to finish some other things 馃槀); I see I have these files still on my machine, which was what I was testing with;

I think I was testing if the problem presented itself on compose-file schema 3.6 and 3.7 as it doesn't appear to have the fix from #4904, thus "should be failing"; here's the diff between 3.6 and 3.7 (before this patch);

git diff --no-index config_schema_v3.5.json config_schema_v3.6.json
output:
diff --git a/config_schema_v3.5.json b/config_schema_v3.6.json
index e3bdecbc..95a552b3 100644
--- a/config_schema_v3.5.json
+++ b/config_schema_v3.6.json
@@ -1,6 +1,6 @@
 {
   "$schema": "http://json-schema.org/draft-04/schema#",
-  "id": "config_schema_v3.5.json",
+  "id": "config_schema_v3.6.json",
   "type": "object",
   "required": ["version"],
 
@@ -84,7 +84,7 @@
                 "context": {"type": "string"},
                 "dockerfile": {"type": "string"},
                 "args": {"$ref": "#/definitions/list_or_dict"},
-                "labels": {"$ref": "#/definitions/labels"},
+                "labels": {"$ref": "#/definitions/list_or_dict"},
                 "cache_from": {"$ref": "#/definitions/list_of_strings"},
                 "network": {"type": "string"},
                 "target": {"type": "string"},
@@ -156,7 +156,7 @@
         "image": {"type": "string"},
         "ipc": {"type": "string"},
         "isolation": {"type": "string"},
-        "labels": {"$ref": "#/definitions/labels"},
+        "labels": {"$ref": "#/definitions/list_or_dict"},
         "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
 
         "logging": {
@@ -300,6 +300,15 @@
                     "properties": {
                       "nocopy": {"type": "boolean"}
                     }
+                  },
+                  "tmpfs": {
+                    "type": "object",
+                    "properties": {
+                      "size": {
+                        "type": "integer",
+                        "minimum": 0
+                      }
+                    }
                   }
                 },
                 "additionalProperties": false
@@ -338,7 +347,7 @@
         "mode": {"type": "string"},
         "endpoint_mode": {"type": "string"},
         "replicas": {"type": "integer"},
-        "labels": {"$ref": "#/definitions/labels"},
+        "labels": {"$ref": "#/definitions/list_or_dict"},
         "update_config": {
           "type": "object",
           "properties": {
@@ -447,7 +456,7 @@
               "items": {
                 "type": "object",
                 "properties": {
-                  "subnet": {"type": "string", "format": "subnet_ip_address"}
+                  "subnet": {"type": "string"}
                 },
                 "additionalProperties": false
               }
@@ -464,7 +473,7 @@
         },
         "internal": {"type": "boolean"},
         "attachable": {"type": "boolean"},
-        "labels": {"$ref": "#/definitions/labels"}
+        "labels": {"$ref": "#/definitions/list_or_dict"}
       },
       "additionalProperties": false
     },
@@ -488,7 +497,7 @@
           },
           "additionalProperties": false
         },
-        "labels": {"$ref": "#/definitions/labels"}
+        "labels": {"$ref": "#/definitions/list_or_dict"}
       },
       "additionalProperties": false
     },
@@ -505,7 +514,7 @@
             "name": {"type": "string"}
           }
         },
-        "labels": {"$ref": "#/definitions/labels"}
+        "labels": {"$ref": "#/definitions/list_or_dict"}
       },
       "additionalProperties": false
     },
@@ -522,7 +531,7 @@
             "name": {"type": "string"}
           }
         },
-        "labels": {"$ref": "#/definitions/labels"}
+        "labels": {"$ref": "#/definitions/list_or_dict"}
       },
       "additionalProperties": false
     },
@@ -555,21 +564,6 @@
       ]
     },
 
-    "labels": {
-      "oneOf": [
-        {
-          "type": "object",
-          "patternProperties": {
-            ".+": {
-              "type": "string"
-            }
-          },
-          "additionalProperties": false
-        },
-        {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
-      ]
-    },
-
     "constraints": {
       "service": {
         "id": "#/definitions/constraints/service",

Posting my test files here in case someone has time to verify.

docker-compose.yml:

version: '3.7'
services:
  web:
    image: nginx:alpine
    labels:
      com.duo.access-gateway.builder.version: 89526235
      com.duo.access-gateway.code.version: v1.4.4-beta0
      com.duo.access-gateway.built: Fri, 02 Jun 2017 14:38:41 -0000
      com.duo.access-gateway.nil:

docker-compose.json:

{
  "version": "3.7",
  "services": {
    "web": {
      "image": "nginx:alpine",
      "labels": {
        "com.duo.access-gateway.builder.version": 89526235,
        "com.duo.access-gateway.code.version": "v1.4.4-beta0",
        "com.duo.access-gateway.built": "Fri, 02 Jun 2017 14:38:41 -0000",
        "com.duo.access-gateway.nil": null
      }
    }
  }
}

@thaJeztah
Copy link
Member Author

This is obviously not finished (as the modified schema's (and the new v3.8 schema) aren't in the python code yet

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@glours
Copy link
Contributor

glours commented Jul 13, 2022

Thanks for taking the time to create this issue/pull request!

Unfortunately, Docker Compose V1 has reached end-of-life and we are not accepting any more changes (except for security issues). Please try and reproduce your issue with Compose V2 or rewrite your pull request to be based on the v2 branch and create a new issue or PR with the relevant Compose V2 information.

@glours glours closed this Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A label with a value of only numbers causes unmarshal error config does not validate broken subnets
4 participants