Repository: TraceMachina/nativelink (language: rust)

Issue:
Invalid json example configs
The example configs are using comments which are not allowed in json.


Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index ca310c732..785c654d8 100644
--- a/README.md
+++ b/README.md
@@ -72,12 +72,12 @@ for how to build the images yourself.
 
 ```bash
 curl -O \
-    https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json
+    https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json5
 
 # See https://github.com/TraceMachina/nativelink/pkgs/container/nativelink
 # to find the latest tag
 docker run \
-    -v $(pwd)/basic_cas.json:/config \
+    -v $(pwd)/basic_cas.json5:/config \
     -p 50051:50051 \
     ghcr.io/tracemachina/nativelink:v0.5.3 \
     config
@@ -88,13 +88,13 @@ docker run \
 ```powershell
 # Download the configuration file
 Invoke-WebRequest `
-    -Uri "https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json" `
-    -OutFile "basic_cas.json"
+    -Uri "https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json5" `
+    -OutFile "basic_cas.json5"
 
 # Run the Docker container
 # Note: Adjust the path if the script is not run from the directory containing basic_cas.json
 docker run `
-    -v ${PWD}/basic_cas.json:/config `
+    -v ${PWD}/basic_cas.json5:/config `
     -p 50051:50051 `
     ghcr.io/tracemachina/nativelink:v0.5.3 `
     config
@@ -116,9 +116,9 @@ it via the [next-gen nix installer](https://github.com/NixOS/experimental-nix-in
 
 ```bash
 curl -O \
-    https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json
+    https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json5
 
-nix run github:TraceMachina/nativelink ./basic_cas.json
+nix run github:TraceMachina/nativelink ./basic_cas.json5
 ```
 
 See the [contribution docs](https://nativelink.com/docs/contribute/nix) for further information.
diff --git a/deployment-examples/docker-compose/docker-compose.yml b/deployment-examples/docker-compose/docker-compose.yml
index 60af6bc22..e6db0fed5 100644
--- a/deployment-examples/docker-compose/docker-compose.yml
+++ b/deployment-examples/docker-compose/docker-compose.yml
@@ -32,7 +32,7 @@ services:
       RUST_LOG: ${RUST_LOG:-warn}
     ports: [ "50051:50051/tcp", "127.0.0.1:50061:50061", "50071:50071/tcp", ]
     command: |
-      nativelink /root/local-storage-cas.json
+      nativelink /root/local-storage-cas.json5
 
   nativelink_scheduler:
     image: trace_machina/nativelink:latest
@@ -51,7 +51,7 @@ services:
       CAS_ENDPOINT: nativelink_local_cas
     ports: [ "50052:50052/tcp" ]
     command: |
-      nativelink /root/scheduler.json
+      nativelink /root/scheduler.json5
 
   nativelink_executor:
     image: trace_machina/nativelink:latest
@@ -71,4 +71,4 @@ services:
       CAS_ENDPOINT: nativelink_local_cas
       SCHEDULER_ENDPOINT: nativelink_scheduler
     command: |
-      nativelink /root/worker.json
+      nativelink /root/worker.json5
diff --git a/deployment-examples/docker-compose/local-storage-cas.json b/deployment-examples/docker-compose/local-storage-cas.json5
similarity index 93%
rename from deployment-examples/docker-compose/local-storage-cas.json
rename to deployment-examples/docker-compose/local-storage-cas.json5
index b847ec2ac..273b7fafc 100644
--- a/deployment-examples/docker-compose/local-storage-cas.json
+++ b/deployment-examples/docker-compose/local-storage-cas.json5
@@ -16,7 +16,7 @@
             "temp_path": "~/.cache/nativelink/tmp_path-cas",
             "eviction_policy": {
               // 10gb.
-              "max_bytes": 10000000000,
+              "max_bytes": 10000000000
             }
           }
         }
@@ -28,7 +28,7 @@
         "temp_path": "~/.cache/nativelink/tmp_path-ac",
         "eviction_policy": {
           // 500mb.
-          "max_bytes": 500000000,
+          "max_bytes": 500000000
         }
       }
     }
@@ -53,7 +53,7 @@
       "capabilities": {},
       "bytestream": {
         "cas_stores": {
-          "": "CAS_MAIN_STORE",
+          "": "CAS_MAIN_STORE"
         }
       }
     }
@@ -99,10 +99,10 @@
       "capabilities": {},
       "bytestream": {
         "cas_stores": {
-          "": "CAS_MAIN_STORE",
+          "": "CAS_MAIN_STORE"
         }
       },
-      "health": {},
+      "health": {}
     }
   }]
 }
diff --git a/deployment-examples/docker-compose/scheduler.json b/deployment-examples/docker-compose/scheduler.json5
similarity index 88%
rename from deployment-examples/docker-compose/scheduler.json
rename to deployment-examples/docker-compose/scheduler.json5
index 02eebb31f..7fa154878 100644
--- a/deployment-examples/docker-compose/scheduler.json
+++ b/deployment-examples/docker-compose/scheduler.json5
@@ -35,7 +35,7 @@
   "servers": [{
     "listener": {
       "http": {
-        "socket_address": "0.0.0.0:50052",
+        "socket_address": "0.0.0.0:50052"
       }
     },
     // Each of the services below is keyed on an instance_name.
@@ -52,13 +52,13 @@
       "execution": {
         "": {
           "cas_store": "GRPC_LOCAL_STORE",
-          "scheduler": "MAIN_SCHEDULER",
+          "scheduler": "MAIN_SCHEDULER"
         }
       },
       "capabilities": {
         "": {
           "remote_execution": {
-            "scheduler": "MAIN_SCHEDULER",
+            "scheduler": "MAIN_SCHEDULER"
           }
         }
       }
@@ -66,7 +66,7 @@
   }, {
     "listener": {
       "http": {
-        "socket_address": "0.0.0.0:50061",
+        "socket_address": "0.0.0.0:50061"
       }
     },
     "services": {
@@ -75,9 +75,9 @@
       // In other words, this service is a backend api. The ones above
       // are a frontend api.
       "worker_api": {
-        "scheduler": "MAIN_SCHEDULER",
+        "scheduler": "MAIN_SCHEDULER"
       },
-      "health": {},
+      "health": {}
     }
   }]
 }
diff --git a/deployment-examples/docker-compose/worker.json b/deployment-examples/docker-compose/worker.json5
similarity index 88%
rename from deployment-examples/docker-compose/worker.json
rename to deployment-examples/docker-compose/worker.json5
index 08ee5d2bb..782e0b012 100644
--- a/deployment-examples/docker-compose/worker.json
+++ b/deployment-examples/docker-compose/worker.json5
@@ -28,13 +28,13 @@
             "temp_path": "/root/.cache/nativelink/data-worker-test/tmp_path-cas",
             "eviction_policy": {
               // 10gb.
-              "max_bytes": 10000000000,
+              "max_bytes": 10000000000
             }
           }
         },
         "slow": {
           "ref_store": {
-            "name": "GRPC_LOCAL_STORE",
+            "name": "GRPC_LOCAL_STORE"
           }
         }
       }
@@ -43,11 +43,11 @@
   "workers": [{
     "local": {
       "worker_api_endpoint": {
-        "uri": "grpc://${SCHEDULER_ENDPOINT:-127.0.0.1}:50061",
+        "uri": "grpc://${SCHEDULER_ENDPOINT:-127.0.0.1}:50061"
       },
       "cas_fast_slow_store": "WORKER_FAST_SLOW_STORE",
       "upload_action_result": {
-        "ac_store": "GRPC_LOCAL_AC_STORE",
+        "ac_store": "GRPC_LOCAL_AC_STORE"
       },
       "work_directory": "/root/.cache/nativelink/work",
       "platform_properties": {
diff --git a/kubernetes/base/nativelink.yaml b/kubernetes/base/nativelink.yaml
index ec18df291..579b11cc9 100644
--- a/kubernetes/base/nativelink.yaml
+++ b/kubernetes/base/nativelink.yaml
@@ -27,12 +27,12 @@ spec:
             - containerPort: 50061
           volumeMounts:
             - name: nativelink-config
-              mountPath: /nativelink-config.json
-              subPath: nativelink-config.json
+              mountPath: /nativelink-config.json5
+              subPath: nativelink-config.json5
             - name: tls-volume
               mountPath: /root
               readOnly: true
-          args: ["/nativelink-config.json"]
+          args: ["/nativelink-config.json5"]
       volumes:
         - name: nativelink-config
           configMap:
diff --git a/kubernetes/base/worker.yaml b/kubernetes/base/worker.yaml
index d683b6b0d..f635decd9 100644
--- a/kubernetes/base/worker.yaml
+++ b/kubernetes/base/worker.yaml
@@ -32,12 +32,12 @@ spec:
               value: nativelink
           volumeMounts:
             - name: worker-config
-              mountPath: /worker.json
-              subPath: worker.json
+              mountPath: /worker.json5
+              subPath: worker.json5
             - name: shared
               mountPath: /shared
           command: ["/shared/nativelink"]
-          args: ["/worker.json"]
+          args: ["/worker.json5"]
       volumes:
         - name: shared
           emptyDir: {}
diff --git a/kubernetes/configmaps/kustomization.yaml b/kubernetes/configmaps/kustomization.yaml
index 601abcdd2..98d8c589d 100644
--- a/kubernetes/configmaps/kustomization.yaml
+++ b/kubernetes/configmaps/kustomization.yaml
@@ -5,13 +5,13 @@ kind: Kustomization
 configMapGenerator:
   - name: nativelink-config
     files:
-      - nativelink-config.json
+      - nativelink-config.json5
     options:
       annotations:
         kustomize.toolkit.fluxcd.io/substitute: disabled
   - name: worker
     files:
-      - worker.json
+      - worker.json5
     options:
       annotations:
         kustomize.toolkit.fluxcd.io/substitute: disabled
diff --git a/kubernetes/configmaps/nativelink-config.json b/kubernetes/configmaps/nativelink-config.json5
similarity index 88%
rename from kubernetes/configmaps/nativelink-config.json
rename to kubernetes/configmaps/nativelink-config.json5
index 21ad84b63..528b625e6 100644
--- a/kubernetes/configmaps/nativelink-config.json
+++ b/kubernetes/configmaps/nativelink-config.json5
@@ -15,7 +15,7 @@
                 "content_path": "~/.cache/nativelink/content_path-cas",
                 "temp_path": "~/.cache/nativelink/tmp_path-cas",
                 "eviction_policy": {
-                  "max_bytes": "10Gb",
+                  "max_bytes": "10Gb"
                 }
               }
             }
@@ -30,7 +30,7 @@
             "content_path": "~/.cache/nativelink/content_path-ac",
             "temp_path": "~/.cache/nativelink/tmp_path-ac",
             "eviction_policy": {
-              "max_bytes": "500Mb",
+              "max_bytes": "500Mb"
             }
           }
         },
@@ -63,7 +63,7 @@
           "cpu_model": "priority",
           "kernel_version": "priority",
           "OSFamily": "priority",
-          "container-image": "priority",
+          "container-image": "priority"
         }
       }
     }
@@ -101,20 +101,20 @@
       "capabilities": {
         "": {
           "remote_execution": {
-            "scheduler": "MAIN_SCHEDULER",
+            "scheduler": "MAIN_SCHEDULER"
           }
         }
       },
       "execution": {
         "": {
           "cas_store": "CAS_MAIN_STORE",
-          "scheduler": "MAIN_SCHEDULER",
+          "scheduler": "MAIN_SCHEDULER"
         }
       },
       "bytestream": {
         "cas_stores": {
-          "": "CAS_MAIN_STORE",
-        },
+          "": "CAS_MAIN_STORE"
+        }
       }
     }
   },
@@ -142,27 +142,27 @@
       "capabilities": {
         "": {
           "remote_execution": {
-            "scheduler": "MAIN_SCHEDULER",
+            "scheduler": "MAIN_SCHEDULER"
           }
         }
       },
       "execution": {
         "": {
           "cas_store": "CAS_MAIN_STORE",
-          "scheduler": "MAIN_SCHEDULER",
+          "scheduler": "MAIN_SCHEDULER"
         }
       },
       "bytestream": {
         "cas_stores": {
-          "": "CAS_MAIN_STORE",
-        },
+          "": "CAS_MAIN_STORE"
+        }
       }
     }
   },
   {
     "listener": {
       "http": {
-        "socket_address": "0.0.0.0:50061",
+        "socket_address": "0.0.0.0:50061"
       }
     },
     "services": {
@@ -171,9 +171,9 @@
       // In other words, this service is a backend api. The ones above
       // are a frontend api.
       "worker_api": {
-        "scheduler": "MAIN_SCHEDULER",
+        "scheduler": "MAIN_SCHEDULER"
       },
-      "health": {},
+      "health": {}
     }
   }]
 }
diff --git a/kubernetes/configmaps/worker.json b/kubernetes/configmaps/worker.json5
similarity index 87%
rename from kubernetes/configmaps/worker.json
rename to kubernetes/configmaps/worker.json5
index b3dccb448..21dcb6f95 100644
--- a/kubernetes/configmaps/worker.json
+++ b/kubernetes/configmaps/worker.json5
@@ -33,7 +33,7 @@
         },
         "slow": {
           "ref_store": {
-            "name": "GRPC_LOCAL_STORE",
+            "name": "GRPC_LOCAL_STORE"
           }
         }
       }
@@ -42,25 +42,25 @@
   "workers": [{
     "local": {
       "worker_api_endpoint": {
-        "uri": "grpc://${NATIVELINK_ENDPOINT:-127.0.0.1}:50061",
+        "uri": "grpc://${NATIVELINK_ENDPOINT:-127.0.0.1}:50061"
       },
       "cas_fast_slow_store": "WORKER_FAST_SLOW_STORE",
       "upload_action_result": {
-        "ac_store": "GRPC_LOCAL_AC_STORE",
+        "ac_store": "GRPC_LOCAL_AC_STORE"
       },
       "work_directory": "~/.cache/nativelink/work",
       "platform_properties": {
         "cpu_count": {
-          "query_cmd": "nproc",
+          "query_cmd": "nproc"
         },
         "memory_kb": {
-          "values": ["500000"],
+          "values": ["500000"]
         },
         "network_kbps": {
-          "values": ["100000"],
+          "values": ["100000"]
         },
         "cpu_arch": {
-          "values": ["x86_64"],
+          "values": ["x86_64"]
         },
         "OSFamily": {
           "values": ["Linux"]
diff --git a/kubernetes/overlays/lre/worker-lre-cc.yaml b/kubernetes/overlays/lre/worker-lre-cc.yaml
index cbdb14c06..46ba6b646 100644
--- a/kubernetes/overlays/lre/worker-lre-cc.yaml
+++ b/kubernetes/overlays/lre/worker-lre-cc.yaml
@@ -39,7 +39,7 @@ spec:
             - name: entrypoint
               mountPath: /entrypoint
           command: ["/entrypoint/entrypoint.sh"]
-          args: ["/shared/nativelink", "/worker.json"]
+          args: ["/shared/nativelink", "/worker.json5"]
       volumes:
         - name: entrypoint
           emptyDir: {}
diff --git a/nativelink-config/examples/basic_cas.json b/nativelink-config/examples/basic_cas.json5
similarity index 88%
rename from nativelink-config/examples/basic_cas.json
rename to nativelink-config/examples/basic_cas.json5
index 173951deb..0dd73861c 100644
--- a/nativelink-config/examples/basic_cas.json
+++ b/nativelink-config/examples/basic_cas.json5
@@ -6,7 +6,7 @@
         "temp_path": "/tmp/nativelink/data-worker-test/tmp_path-ac",
         "eviction_policy": {
           // 1gb.
-          "max_bytes": 1000000000,
+          "max_bytes": 1000000000
         }
       }
     },
@@ -20,7 +20,7 @@
             "temp_path": "/tmp/nativelink/data-worker-test/tmp_path-cas",
             "eviction_policy": {
               // 10gb.
-              "max_bytes": 10000000000,
+              "max_bytes": 10000000000
             }
           }
         },
@@ -54,7 +54,7 @@
           "cpu_model": "exact",
           "kernel_version": "exact",
           "OSFamily": "priority",
-          "container-image": "priority",
+          "container-image": "priority"
           // Example of how to set which docker images are available and set
           // them in the platform properties.
           // "docker_image": "priority",
@@ -65,32 +65,32 @@
   "workers": [{
     "local": {
       "worker_api_endpoint": {
-        "uri": "grpc://127.0.0.1:50061",
+        "uri": "grpc://127.0.0.1:50061"
       },
       "cas_fast_slow_store": "WORKER_FAST_SLOW_STORE",
       "upload_action_result": {
-        "ac_store": "AC_MAIN_STORE",
+        "ac_store": "AC_MAIN_STORE"
       },
       "work_directory": "/tmp/nativelink/work",
       "platform_properties": {
         "cpu_count": {
-          "values": ["16"],
+          "values": ["16"]
         },
         "memory_kb": {
-          "values": ["500000"],
+          "values": ["500000"]
         },
         "network_kbps": {
-          "values": ["100000"],
+          "values": ["100000"]
         },
         "cpu_arch": {
-          "values": ["x86_64"],
+          "values": ["x86_64"]
         },
         "OSFamily": {
           "values": [""]
         },
         "container-image": {
           "values": [""]
-        },
+        }
         // Example of how to set which docker images are available and set
         // them in the platform properties.
         // "docker_image": {
@@ -120,19 +120,19 @@
       "execution": {
         "main": {
           "cas_store": "WORKER_FAST_SLOW_STORE",
-          "scheduler": "MAIN_SCHEDULER",
+          "scheduler": "MAIN_SCHEDULER"
         }
       },
       "capabilities": {
         "main": {
           "remote_execution": {
-            "scheduler": "MAIN_SCHEDULER",
+            "scheduler": "MAIN_SCHEDULER"
           }
         }
       },
       "bytestream": {
         "cas_stores": {
-          "main": "WORKER_FAST_SLOW_STORE",
+          "main": "WORKER_FAST_SLOW_STORE"
         }
       }
     }
@@ -152,10 +152,10 @@
       // In other words, this service is a backend api. The ones above
       // are a frontend api.
       "worker_api": {
-        "scheduler": "MAIN_SCHEDULER",
+        "scheduler": "MAIN_SCHEDULER"
       },
       "admin": {},
-      "health": {},
+      "health": {}
     }
   }],
   "global": {
diff --git a/nativelink-config/examples/filesystem_cas.json b/nativelink-config/examples/filesystem_cas.json5
similarity index 92%
rename from nativelink-config/examples/filesystem_cas.json
rename to nativelink-config/examples/filesystem_cas.json5
index 6f43bf6be..81e23fdaa 100644
--- a/nativelink-config/examples/filesystem_cas.json
+++ b/nativelink-config/examples/filesystem_cas.json5
@@ -16,7 +16,7 @@
             "temp_path": "/tmp/nativelink/data/tmp_path-cas",
             "eviction_policy": {
               // 2gb.
-              "max_bytes": 2000000000,
+              "max_bytes": 2000000000
             }
           }
         }
@@ -50,7 +50,7 @@
                       "memory": {
                         "eviction_policy": {
                           // 10mb.
-                          "max_bytes": 10000000,
+                          "max_bytes": 10000000
                         }
                       }
                     },
@@ -60,7 +60,7 @@
                         "temp_path": "/tmp/nativelink/data/tmp_path-index",
                         "eviction_policy": {
                           // 500mb.
-                          "max_bytes": 500000000,
+                          "max_bytes": 500000000
                         }
                       }
                     }
@@ -85,7 +85,7 @@
         "temp_path": "/tmp/nativelink/data/tmp_path-ac",
         "eviction_policy": {
           // 500mb.
-          "max_bytes": 500000000,
+          "max_bytes": 500000000
         }
       }
     }
@@ -108,7 +108,7 @@
           "cpu_arch": "exact",
           "cpu_model": "exact",
           "kernel_version": "exact",
-          "docker_image": "priority",
+          "docker_image": "priority"
         }
       }
     }
@@ -133,19 +133,19 @@
       "execution": {
         "main": {
           "cas_store": "CAS_MAIN_STORE",
-          "scheduler": "MAIN_SCHEDULER",
+          "scheduler": "MAIN_SCHEDULER"
         }
       },
       "capabilities": {
         "main": {
           "remote_execution": {
-            "scheduler": "MAIN_SCHEDULER",
+            "scheduler": "MAIN_SCHEDULER"
           }
         }
       },
       "bytestream": {
         "cas_stores": {
-          "main": "CAS_MAIN_STORE",
+          "main": "CAS_MAIN_STORE"
         }
       }
     }
@@ -161,9 +161,9 @@
       // In other words, this service is a backend api. The ones above
       // are a frontend api.
       "worker_api": {
-        "scheduler": "MAIN_SCHEDULER",
+        "scheduler": "MAIN_SCHEDULER"
       },
-      "health": {},
+      "health": {}
     }
   }]
 }
diff --git a/nativelink-config/examples/s3_backend_with_local_fast_cas.json b/nativelink-config/examples/s3_backend_with_local_fast_cas.json5
similarity index 90%
rename from nativelink-config/examples/s3_backend_with_local_fast_cas.json
rename to nativelink-config/examples/s3_backend_with_local_fast_cas.json5
index d74dd910d..26131146f 100644
--- a/nativelink-config/examples/s3_backend_with_local_fast_cas.json
+++ b/nativelink-config/examples/s3_backend_with_local_fast_cas.json5
@@ -12,7 +12,7 @@
                     "temp_path": "/tmp/nativelink/data/tmp_path-index",
                     "eviction_policy": {
                       // 500mb.
-                      "max_bytes": 500000000,
+                      "max_bytes": 500000000
                     }
                   }
                 },
@@ -24,7 +24,7 @@
                     "retry": {
                       "max_retries": 6,
                       "delay": 0.3,
-                      "jitter": 0.5,
+                      "jitter": 0.5
                     },
                     "additional_max_concurrent_requests": 10
                   }
@@ -44,7 +44,7 @@
                         "temp_path": "/tmp/nativelink/data/tmp_path-content",
                         "eviction_policy": {
                           // 2gb.
-                          "max_bytes": 2000000000,
+                          "max_bytes": 2000000000
                         }
                       }
                     },
@@ -56,7 +56,7 @@
                         "retry": {
                           "max_retries": 6,
                           "delay": 0.3,
-                          "jitter": 0.5,
+                          "jitter": 0.5
                         },
                         "additional_max_concurrent_requests": 10
                       }
@@ -77,7 +77,7 @@
           "memory": {
             "eviction_policy": {
               // 100mb.
-              "max_bytes": 100000000,
+              "max_bytes": 100000000
             }
           },
           "filesystem": {
@@ -85,7 +85,7 @@
             "temp_path": "/tmp/nativelink/data/tmp_path-ac",
             "eviction_policy": {
               // 500mb.
-              "max_bytes": 500000000,
+              "max_bytes": 500000000
             }
           }
         },
@@ -97,7 +97,7 @@
             "retry": {
               "max_retries": 6,
               "delay": 0.3,
-              "jitter": 0.5,
+              "jitter": 0.5
             },
             "additional_max_concurrent_requests": 10
           }
@@ -123,7 +123,7 @@
           "cpu_arch": "exact",
           "cpu_model": "exact",
           "kernel_version": "exact",
-          "docker_image": "priority",
+          "docker_image": "priority"
         }
       }
     }
@@ -148,22 +148,22 @@
       "execution": {
         "main": {
           "cas_store": "CAS_MAIN_STORE",
-          "scheduler": "MAIN_SCHEDULER",
+          "scheduler": "MAIN_SCHEDULER"
         }
       },
       "capabilities": {
         "main": {
           "remote_execution": {
-            "scheduler": "MAIN_SCHEDULER",
+            "scheduler": "MAIN_SCHEDULER"
           }
         }
       },
       "bytestream": {
         "cas_stores": {
-          "main": "CAS_MAIN_STORE",
+          "main": "CAS_MAIN_STORE"
         }
       },
-      "health": {},
+      "health": {}
     }
   }]
 }


Test patch: