blueprint-shared-facts 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  "package": "blueprint-shared-facts",
5
5
  "entry": "blueprint-shared",
6
6
  "describes": {
7
- "blueprint-shared-facts": "0.4.0"
7
+ "blueprint-shared-facts": "0.5.0"
8
8
  },
9
9
  "layer": "org",
10
10
  "facts": [
@@ -4872,7 +4872,7 @@
4872
4872
  "infra-layout"
4873
4873
  ],
4874
4874
  "title": "叢集與租戶的命名",
4875
- "description": "名稱是 `<用途>`,只看上層(位置、母叢集、虛擬叢集)的名稱。上層有任何一層帶環境後綴時不補環境,該上層只放那個環境。上層都沒帶時,只服務一個環境的補成 `<用途>-<環境>`,服務多個環境的母叢集不補,由裡面的租戶補。同上層同用途的第二個補區域或序號。`decide` 與 `examples` 是可機讀的判斷順序與範例。AWS 位置只寫了命名規則,其餘未查證也沒有設計。",
4875
+ "description": "名稱是 `<用途>`,只看上層(位置、母叢集、虛擬叢集)的名稱。上層有任何一層帶環境後綴時不補環境,該上層只放實例路徑上是那個環境的實例,環境指服務自己部署的環境,不是使用它的單元的環境。組織的服務有自己的測試與正式部署時,實例名用自己的部署環境(例如 `secrets/stg`、`secrets/prod`)。VM 用用途命名,不用專案名或產品名。上層都沒帶時,只服務一個環境的補成 `<用途>-<環境>`,服務多個環境的母叢集不補,由裡面的租戶補。同上層同用途的第二個補區域或序號。`decide` 與 `examples` 是可機讀的判斷順序與範例。AWS 位置只寫了命名規則,其餘未查證也沒有設計。",
4876
4876
  "variants": [
4877
4877
  {
4878
4878
  "since": "0.4.0",
@@ -5149,6 +5149,284 @@
5149
5149
  "instancePath": "The instance path stays <purpose>/<environment>. The names of the clusters and namespaces are worked out from the instance path and the parents. Clusters of the same name are told apart by their parents, for example gcp-prod/platform/events, and monitoring adds a location label to tell them apart. A virtual cluster is installed in the namespace of the same name in its parent cluster."
5150
5150
  }
5151
5151
  }
5152
+ },
5153
+ {
5154
+ "since": "0.5.0",
5155
+ "content": {
5156
+ "value": {
5157
+ "appliesTo": "every location: a GCP project, an AWS account and a physical machine alike. For an AWS location only this naming rule is written; nothing else is designed for AWS yet (unverified).",
5158
+ "looksAt": "the names of the parents only. The parents of a cluster or tenant are its location, its parent cluster and its virtual cluster, from the outside in",
5159
+ "environmentSuffixes": [
5160
+ "-dev",
5161
+ "-stg",
5162
+ "-prod",
5163
+ "-shared"
5164
+ ],
5165
+ "rules": [
5166
+ "The name is <purpose>.",
5167
+ "A parent whose name has an environment suffix holds the instances of that environment only. The environment of an instance is the <environment> of its instance path, which is the environment the service itself is deployed in. The environments of the units that use the instance are not compared with the suffix.",
5168
+ "When any parent has an environment suffix, the environment is not added.",
5169
+ "When no parent has an environment suffix, a cluster or tenant whose instance path has one environment is named <purpose>-<environment>.",
5170
+ "When no parent has an environment suffix, a parent cluster that serves several environments takes no environment, because it has no single one to write. The tenants inside it take the environment instead.",
5171
+ "A second one of the same purpose under the same parent adds the region, or a sequence number when both are in the same region, for example platform-asia-northeast1 or events-2."
5172
+ ],
5173
+ "decide": [
5174
+ {
5175
+ "when": "a parent name ends in an environment suffix",
5176
+ "name": "<purpose>",
5177
+ "check": "every environment served is the environment of that suffix"
5178
+ },
5179
+ {
5180
+ "when": "no parent has an environment suffix and one environment is served",
5181
+ "name": "<purpose>-<environment>"
5182
+ },
5183
+ {
5184
+ "when": "no parent has an environment suffix and several environments are served",
5185
+ "name": "<purpose>"
5186
+ }
5187
+ ],
5188
+ "duplicate": {
5189
+ "when": "a second one of the same purpose under the same parent",
5190
+ "region": "<name>-<region>",
5191
+ "sequence": "<name>-<n>, n from 2"
5192
+ },
5193
+ "examples": [
5194
+ {
5195
+ "kind": "parent cluster",
5196
+ "parents": [
5197
+ "gcp-shared"
5198
+ ],
5199
+ "purpose": "platform",
5200
+ "serves": [
5201
+ "shared"
5202
+ ],
5203
+ "name": "platform",
5204
+ "reason": "the location ends in -shared"
5205
+ },
5206
+ {
5207
+ "kind": "parent cluster",
5208
+ "parents": [
5209
+ "gcp-dev"
5210
+ ],
5211
+ "purpose": "platform",
5212
+ "serves": [
5213
+ "dev"
5214
+ ],
5215
+ "name": "platform",
5216
+ "reason": "the location ends in -dev"
5217
+ },
5218
+ {
5219
+ "kind": "parent cluster",
5220
+ "parents": [
5221
+ "gcp-stg"
5222
+ ],
5223
+ "purpose": "platform",
5224
+ "serves": [
5225
+ "stg"
5226
+ ],
5227
+ "name": "platform",
5228
+ "reason": "the location ends in -stg"
5229
+ },
5230
+ {
5231
+ "kind": "parent cluster",
5232
+ "parents": [
5233
+ "gcp-prod"
5234
+ ],
5235
+ "purpose": "platform",
5236
+ "serves": [
5237
+ "prod"
5238
+ ],
5239
+ "name": "platform",
5240
+ "reason": "the location ends in -prod"
5241
+ },
5242
+ {
5243
+ "kind": "parent cluster",
5244
+ "parents": [
5245
+ "macbook"
5246
+ ],
5247
+ "purpose": "platform",
5248
+ "serves": [
5249
+ "dev"
5250
+ ],
5251
+ "name": "platform-dev",
5252
+ "reason": "the location has no suffix and the cluster serves dev only"
5253
+ },
5254
+ {
5255
+ "kind": "parent cluster",
5256
+ "parents": [
5257
+ "mac-mini"
5258
+ ],
5259
+ "purpose": "platform",
5260
+ "serves": [
5261
+ "prod"
5262
+ ],
5263
+ "name": "platform-prod",
5264
+ "reason": "the location has no suffix and the cluster serves prod only"
5265
+ },
5266
+ {
5267
+ "kind": "parent cluster",
5268
+ "parents": [
5269
+ "macbook"
5270
+ ],
5271
+ "purpose": "platform",
5272
+ "serves": [
5273
+ "dev",
5274
+ "stg"
5275
+ ],
5276
+ "name": "platform",
5277
+ "reason": "the location has no suffix and the cluster has no single environment"
5278
+ },
5279
+ {
5280
+ "kind": "virtual cluster",
5281
+ "parents": [
5282
+ "gcp-stg",
5283
+ "platform"
5284
+ ],
5285
+ "purpose": "events",
5286
+ "serves": [
5287
+ "stg"
5288
+ ],
5289
+ "name": "events",
5290
+ "reason": "the location ends in -stg"
5291
+ },
5292
+ {
5293
+ "kind": "virtual cluster",
5294
+ "parents": [
5295
+ "gcp-prod",
5296
+ "platform"
5297
+ ],
5298
+ "purpose": "events",
5299
+ "serves": [
5300
+ "prod"
5301
+ ],
5302
+ "name": "events",
5303
+ "reason": "the location ends in -prod"
5304
+ },
5305
+ {
5306
+ "kind": "virtual cluster",
5307
+ "parents": [
5308
+ "macbook",
5309
+ "platform-dev"
5310
+ ],
5311
+ "purpose": "events",
5312
+ "serves": [
5313
+ "dev"
5314
+ ],
5315
+ "name": "events",
5316
+ "reason": "the parent cluster ends in -dev"
5317
+ },
5318
+ {
5319
+ "kind": "virtual cluster",
5320
+ "parents": [
5321
+ "macbook",
5322
+ "platform"
5323
+ ],
5324
+ "purpose": "events",
5325
+ "serves": [
5326
+ "dev"
5327
+ ],
5328
+ "name": "events-dev",
5329
+ "reason": "neither the location nor the parent cluster has a suffix"
5330
+ },
5331
+ {
5332
+ "kind": "virtual cluster",
5333
+ "parents": [
5334
+ "macbook",
5335
+ "platform"
5336
+ ],
5337
+ "purpose": "events",
5338
+ "serves": [
5339
+ "stg"
5340
+ ],
5341
+ "name": "events-stg",
5342
+ "reason": "neither the location nor the parent cluster has a suffix"
5343
+ },
5344
+ {
5345
+ "kind": "virtual cluster",
5346
+ "parents": [
5347
+ "gcp-prod",
5348
+ "platform"
5349
+ ],
5350
+ "purpose": "events",
5351
+ "serves": [
5352
+ "prod"
5353
+ ],
5354
+ "sequence": 2,
5355
+ "name": "events-2",
5356
+ "reason": "the second of the purpose in one cluster, in one region, so a sequence number"
5357
+ },
5358
+ {
5359
+ "kind": "namespace",
5360
+ "parents": [
5361
+ "gcp-dev",
5362
+ "platform"
5363
+ ],
5364
+ "purpose": "orbit",
5365
+ "serves": [
5366
+ "dev"
5367
+ ],
5368
+ "name": "orbit",
5369
+ "reason": "the location ends in -dev"
5370
+ },
5371
+ {
5372
+ "kind": "namespace",
5373
+ "parents": [
5374
+ "gcp-stg",
5375
+ "platform"
5376
+ ],
5377
+ "purpose": "orbit",
5378
+ "serves": [
5379
+ "stg"
5380
+ ],
5381
+ "name": "orbit",
5382
+ "reason": "the location ends in -stg"
5383
+ },
5384
+ {
5385
+ "kind": "namespace",
5386
+ "parents": [
5387
+ "gcp-prod",
5388
+ "platform"
5389
+ ],
5390
+ "purpose": "orbit",
5391
+ "serves": [
5392
+ "prod"
5393
+ ],
5394
+ "name": "orbit",
5395
+ "reason": "the location ends in -prod"
5396
+ },
5397
+ {
5398
+ "kind": "namespace",
5399
+ "parents": [
5400
+ "mac-mini",
5401
+ "platform-prod"
5402
+ ],
5403
+ "purpose": "ci",
5404
+ "serves": [
5405
+ "prod"
5406
+ ],
5407
+ "name": "ci",
5408
+ "reason": "the parent cluster ends in -prod"
5409
+ },
5410
+ {
5411
+ "kind": "namespace in a virtual cluster",
5412
+ "parents": [
5413
+ "gcp-prod",
5414
+ "platform",
5415
+ "events"
5416
+ ],
5417
+ "purpose": "stream",
5418
+ "serves": [
5419
+ "prod"
5420
+ ],
5421
+ "name": "stream",
5422
+ "reason": "the location ends in -prod"
5423
+ }
5424
+ ],
5425
+ "instancePath": "The instance path stays <purpose>/<environment>. The names of the clusters and namespaces are worked out from the instance path and the parents. Clusters of the same name are told apart by their parents, for example gcp-prod/platform/events, and monitoring adds a location label to tell them apart. A virtual cluster is installed in the namespace of the same name in its parent cluster.",
5426
+ "serviceEnvironment": "A service of the organization that has its own test and production deployments takes the environment of its own deployment as the <environment> of its instance path, for example secrets/stg and secrets/prod. It does not take shared, and it does not take the environment of the units that use it. Which environments an instance serves is a separate matter from its name.",
5427
+ "vmName": "A VM is named after its purpose, for example secrets or ci. It is never named after a project or a product."
5428
+ }
5429
+ }
5152
5430
  }
5153
5431
  ],
5154
5432
  "source": {
@@ -5166,9 +5444,9 @@
5166
5444
  ],
5167
5445
  "rules": [
5168
5446
  "The name is <purpose>.",
5169
- "A parent whose name has an environment suffix holds that environment only.",
5447
+ "A parent whose name has an environment suffix holds the instances of that environment only. The environment of an instance is the <environment> of its instance path, which is the environment the service itself is deployed in. The environments of the units that use the instance are not compared with the suffix.",
5170
5448
  "When any parent has an environment suffix, the environment is not added.",
5171
- "When no parent has an environment suffix, a cluster or tenant that serves one environment is named <purpose>-<environment>.",
5449
+ "When no parent has an environment suffix, a cluster or tenant whose instance path has one environment is named <purpose>-<environment>.",
5172
5450
  "When no parent has an environment suffix, a parent cluster that serves several environments takes no environment, because it has no single one to write. The tenants inside it take the environment instead.",
5173
5451
  "A second one of the same purpose under the same parent adds the region, or a sequence number when both are in the same region, for example platform-asia-northeast1 or events-2."
5174
5452
  ],
@@ -5424,7 +5702,9 @@
5424
5702
  "reason": "the location ends in -prod"
5425
5703
  }
5426
5704
  ],
5427
- "instancePath": "The instance path stays <purpose>/<environment>. The names of the clusters and namespaces are worked out from the instance path and the parents. Clusters of the same name are told apart by their parents, for example gcp-prod/platform/events, and monitoring adds a location label to tell them apart. A virtual cluster is installed in the namespace of the same name in its parent cluster."
5705
+ "instancePath": "The instance path stays <purpose>/<environment>. The names of the clusters and namespaces are worked out from the instance path and the parents. Clusters of the same name are told apart by their parents, for example gcp-prod/platform/events, and monitoring adds a location label to tell them apart. A virtual cluster is installed in the namespace of the same name in its parent cluster.",
5706
+ "serviceEnvironment": "A service of the organization that has its own test and production deployments takes the environment of its own deployment as the <environment> of its instance path, for example secrets/stg and secrets/prod. It does not take shared, and it does not take the environment of the units that use it. Which environments an instance serves is a separate matter from its name.",
5707
+ "vmName": "A VM is named after its purpose, for example secrets or ci. It is never named after a project or a product."
5428
5708
  }
5429
5709
  }
5430
5710
  },
@@ -5954,63 +6234,277 @@
5954
6234
  "trigger": "the program pulls",
5955
6235
  "how": "it pulls its GitHub Release and swaps to the new version after the work it is running ends"
5956
6236
  }
5957
- ],
5958
- "noInbound": "Pulling needs no inbound connection. A program that updates itself is never deployed by a job that runs on that program.",
5959
- "productOps": "ArgoCD syncs the ops repository of a product with the permissions of its tenant, so it can change only its own namespace (restricted through an ArgoCD AppProject, unverified). That sync is declared in the tenant declaration of the configuration repository of the organization layer.",
5960
- "status": "Applying is asynchronous, so each location reports its apply status. How it reports is to be designed.",
5961
- "unverified": "The sync and permission details of ArgoCD are unverified."
6237
+ ],
6238
+ "noInbound": "Pulling needs no inbound connection. A program that updates itself is never deployed by a job that runs on that program.",
6239
+ "productOps": "ArgoCD syncs the ops repository of a product with the permissions of its tenant, so it can change only its own namespace (restricted through an ArgoCD AppProject, unverified). That sync is declared in the tenant declaration of the configuration repository of the organization layer.",
6240
+ "status": "Applying is asynchronous, so each location reports its apply status. How it reports is to be designed.",
6241
+ "unverified": "The sync and permission details of ArgoCD are unverified."
6242
+ }
6243
+ }
6244
+ }
6245
+ ],
6246
+ "source": {
6247
+ "kind": "published"
6248
+ },
6249
+ "content": {
6250
+ "value": {
6251
+ "rule": "A location that cannot be reached from outside, for example a machine behind NAT, pulls its configuration itself. CI pushes only to platforms that have a public API.",
6252
+ "modes": [
6253
+ {
6254
+ "target": "cloud resources of a platform with a public API",
6255
+ "trigger": "CI pushes",
6256
+ "how": "a GitHub-hosted runner runs tofu plan and tofu apply, and takes the cloud identity through GitHub OIDC"
6257
+ },
6258
+ {
6259
+ "target": "the system and services of a machine",
6260
+ "trigger": "the machine pulls",
6261
+ "how": "launchd runs ansible-pull on a schedule, at a tag of the configuration repository of the organization layer"
6262
+ },
6263
+ {
6264
+ "target": "the tenants and services inside a cluster",
6265
+ "trigger": "the cluster pulls",
6266
+ "how": "the ArgoCD of each parent cluster pulls from the configuration repository of the organization layer and from the ops repository of each product"
6267
+ },
6268
+ {
6269
+ "target": "a long-running program that updates itself",
6270
+ "trigger": "the program pulls",
6271
+ "how": "it pulls its GitHub Release and swaps to the new version after the work it is running ends"
6272
+ }
6273
+ ],
6274
+ "noInbound": "Pulling needs no inbound connection. A program that updates itself is never deployed by a job that runs on that program.",
6275
+ "productOps": "ArgoCD syncs the ops repository of a product with the permissions of its tenant, so it can change only its own namespace (restricted through an ArgoCD AppProject, unverified). That sync is declared in the tenant declaration of the configuration repository of the organization layer.",
6276
+ "status": "Applying is asynchronous, so each location reports its apply status. How it reports is to be designed.",
6277
+ "unverified": "The sync and permission details of ArgoCD are unverified."
6278
+ }
6279
+ }
6280
+ },
6281
+ {
6282
+ "id": "blueprint-shared.infra-layout.targets",
6283
+ "tool": "blueprint-shared",
6284
+ "topics": [
6285
+ "infra-layout"
6286
+ ],
6287
+ "title": "targets.json 的格式",
6288
+ "variants": [
6289
+ {
6290
+ "since": "0.4.0",
6291
+ "content": {
6292
+ "schema": {
6293
+ "description": "`ops/targets.json` 的格式,組織層與產品層共用。`hosts` 宣告位置與它的能力,`instances` 宣告實例。實例的位置二選一:自己寫 `host`(放在母叢集或租戶裡時加 `cluster`),或用 `ref` 指向別的倉宣告的實例。`host` 指向別的倉宣告的位置時加 `<RepoName>:` 前綴。只有 `shared` 實例必寫 `serves`。這份 schema 驗證鍵的格式、`host` 與 `ref` 二選一、`serves` 只在 `shared` 實例、`provider` 是 `orbstack` 時只能有一個母叢集。三項由程式檢查:`ref` 指到的實例 `kind` 相同、`host` 與 `cluster` 指到的位置與母叢集存在、帶環境後綴的上層裡實例環境相同。",
6294
+ "type": "object",
6295
+ "additionalProperties": false,
6296
+ "properties": {
6297
+ "hosts": {
6298
+ "type": "object",
6299
+ "description": "鍵是位置名,`hosts` 與 `clusters` 是保留名",
6300
+ "propertyNames": {
6301
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
6302
+ "not": {
6303
+ "enum": [
6304
+ "hosts",
6305
+ "clusters"
6306
+ ]
6307
+ }
6308
+ },
6309
+ "additionalProperties": {
6310
+ "type": "object",
6311
+ "required": [
6312
+ "provider"
6313
+ ],
6314
+ "additionalProperties": false,
6315
+ "properties": {
6316
+ "provider": {
6317
+ "type": "string",
6318
+ "minLength": 1,
6319
+ "description": "供應商,例如 `gcp`、`cloudflare`、`orbstack`"
6320
+ },
6321
+ "machine": {
6322
+ "enum": [
6323
+ "macos",
6324
+ "linux"
6325
+ ],
6326
+ "description": "實體機器才寫"
6327
+ },
6328
+ "project": {
6329
+ "type": "string",
6330
+ "pattern": "^[a-z][a-z0-9-]{4,28}[a-z0-9]$",
6331
+ "description": "雲端專案 ID,GCP 與 AWS 才寫。專案 ID 全域唯一、建立後不能改,所以和位置名分開記"
6332
+ },
6333
+ "region": {
6334
+ "type": "string",
6335
+ "minLength": 1
6336
+ },
6337
+ "vm": {
6338
+ "type": "boolean",
6339
+ "description": "能開 VM"
6340
+ },
6341
+ "serverless": {
6342
+ "type": "boolean",
6343
+ "description": "能跑 serverless"
6344
+ },
6345
+ "clusters": {
6346
+ "type": "object",
6347
+ "description": "鍵是母叢集名,值是那個母叢集提供的層",
6348
+ "propertyNames": {
6349
+ "pattern": "^[a-z0-9][a-z0-9-]*$"
6350
+ },
6351
+ "additionalProperties": {
6352
+ "type": "array",
6353
+ "uniqueItems": true,
6354
+ "minItems": 1,
6355
+ "items": {
6356
+ "enum": [
6357
+ "namespace",
6358
+ "vcluster",
6359
+ "node"
6360
+ ]
6361
+ }
6362
+ }
6363
+ }
6364
+ },
6365
+ "if": {
6366
+ "properties": {
6367
+ "provider": {
6368
+ "const": "orbstack"
6369
+ }
6370
+ },
6371
+ "required": [
6372
+ "provider"
6373
+ ]
6374
+ },
6375
+ "then": {
6376
+ "properties": {
6377
+ "clusters": {
6378
+ "maxProperties": 1
6379
+ }
6380
+ }
6381
+ }
6382
+ }
6383
+ },
6384
+ "instances": {
6385
+ "type": "object",
6386
+ "description": "鍵是 `<用途>/<環境>`",
6387
+ "propertyNames": {
6388
+ "pattern": "^[a-z0-9][a-z0-9-]*/(dev|stg|prod|shared)$",
6389
+ "not": {
6390
+ "pattern": "^(hosts|clusters)/"
6391
+ }
6392
+ },
6393
+ "patternProperties": {
6394
+ "^[a-z0-9][a-z0-9-]*/shared$": {
6395
+ "allOf": [
6396
+ {
6397
+ "$ref": "#/$defs/instance"
6398
+ }
6399
+ ],
6400
+ "required": [
6401
+ "serves"
6402
+ ]
6403
+ },
6404
+ "^[a-z0-9][a-z0-9-]*/(dev|stg|prod)$": {
6405
+ "allOf": [
6406
+ {
6407
+ "$ref": "#/$defs/instance"
6408
+ }
6409
+ ],
6410
+ "not": {
6411
+ "required": [
6412
+ "serves"
6413
+ ]
6414
+ }
6415
+ }
6416
+ },
6417
+ "additionalProperties": false
6418
+ }
6419
+ },
6420
+ "$defs": {
6421
+ "instance": {
6422
+ "type": "object",
6423
+ "required": [
6424
+ "kind"
6425
+ ],
6426
+ "additionalProperties": false,
6427
+ "properties": {
6428
+ "kind": {
6429
+ "enum": [
6430
+ "vm",
6431
+ "cluster",
6432
+ "vcluster",
6433
+ "namespace",
6434
+ "serverless",
6435
+ "cloud"
6436
+ ]
6437
+ },
6438
+ "host": {
6439
+ "type": "string",
6440
+ "pattern": "^([A-Za-z0-9_.-]+:)?[a-z0-9][a-z0-9-]*$",
6441
+ "description": "位置,別的倉宣告的位置寫 `<RepoName>:<位置>`"
6442
+ },
6443
+ "cluster": {
6444
+ "type": "string",
6445
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
6446
+ "description": "放在母叢集或租戶裡時寫母叢集名"
6447
+ },
6448
+ "ref": {
6449
+ "type": "string",
6450
+ "pattern": "^[A-Za-z0-9_.-]+:[a-z0-9][a-z0-9-]*/(dev|stg|prod|shared)$",
6451
+ "description": "別的倉宣告的實例 `<RepoName>:<用途>/<環境>`"
6452
+ },
6453
+ "serves": {
6454
+ "type": "array",
6455
+ "minItems": 1,
6456
+ "uniqueItems": true,
6457
+ "items": {
6458
+ "enum": [
6459
+ "dev",
6460
+ "stg",
6461
+ "prod"
6462
+ ]
6463
+ },
6464
+ "description": "`shared` 實例服務的環境"
6465
+ }
6466
+ },
6467
+ "oneOf": [
6468
+ {
6469
+ "required": [
6470
+ "host"
6471
+ ],
6472
+ "not": {
6473
+ "required": [
6474
+ "ref"
6475
+ ]
6476
+ }
6477
+ },
6478
+ {
6479
+ "required": [
6480
+ "ref"
6481
+ ],
6482
+ "not": {
6483
+ "anyOf": [
6484
+ {
6485
+ "required": [
6486
+ "host"
6487
+ ]
6488
+ },
6489
+ {
6490
+ "required": [
6491
+ "cluster"
6492
+ ]
6493
+ }
6494
+ ]
6495
+ }
6496
+ }
6497
+ ]
6498
+ }
6499
+ }
5962
6500
  }
5963
6501
  }
5964
- }
5965
- ],
5966
- "source": {
5967
- "kind": "published"
5968
- },
5969
- "content": {
5970
- "value": {
5971
- "rule": "A location that cannot be reached from outside, for example a machine behind NAT, pulls its configuration itself. CI pushes only to platforms that have a public API.",
5972
- "modes": [
5973
- {
5974
- "target": "cloud resources of a platform with a public API",
5975
- "trigger": "CI pushes",
5976
- "how": "a GitHub-hosted runner runs tofu plan and tofu apply, and takes the cloud identity through GitHub OIDC"
5977
- },
5978
- {
5979
- "target": "the system and services of a machine",
5980
- "trigger": "the machine pulls",
5981
- "how": "launchd runs ansible-pull on a schedule, at a tag of the configuration repository of the organization layer"
5982
- },
5983
- {
5984
- "target": "the tenants and services inside a cluster",
5985
- "trigger": "the cluster pulls",
5986
- "how": "the ArgoCD of each parent cluster pulls from the configuration repository of the organization layer and from the ops repository of each product"
5987
- },
5988
- {
5989
- "target": "a long-running program that updates itself",
5990
- "trigger": "the program pulls",
5991
- "how": "it pulls its GitHub Release and swaps to the new version after the work it is running ends"
5992
- }
5993
- ],
5994
- "noInbound": "Pulling needs no inbound connection. A program that updates itself is never deployed by a job that runs on that program.",
5995
- "productOps": "ArgoCD syncs the ops repository of a product with the permissions of its tenant, so it can change only its own namespace (restricted through an ArgoCD AppProject, unverified). That sync is declared in the tenant declaration of the configuration repository of the organization layer.",
5996
- "status": "Applying is asynchronous, so each location reports its apply status. How it reports is to be designed.",
5997
- "unverified": "The sync and permission details of ArgoCD are unverified."
5998
- }
5999
- }
6000
- },
6001
- {
6002
- "id": "blueprint-shared.infra-layout.targets",
6003
- "tool": "blueprint-shared",
6004
- "topics": [
6005
- "infra-layout"
6006
- ],
6007
- "title": "targets.json 的格式",
6008
- "variants": [
6502
+ },
6009
6503
  {
6010
- "since": "0.4.0",
6504
+ "since": "0.5.0",
6011
6505
  "content": {
6012
6506
  "schema": {
6013
- "description": "`ops/targets.json` 的格式,組織層與產品層共用。`hosts` 宣告位置與它的能力,`instances` 宣告實例。實例的位置二選一:自己寫 `host`(放在母叢集或租戶裡時加 `cluster`),或用 `ref` 指向別的倉宣告的實例。`host` 指向別的倉宣告的位置時加 `<RepoName>:` 前綴。只有 `shared` 實例必寫 `serves`。這份 schema 驗證鍵的格式、`host` 與 `ref` 二選一、`serves` 只在 `shared` 實例、`provider` 是 `orbstack` 時只能有一個母叢集。三項由程式檢查:`ref` 指到的實例 `kind` 相同、`host` 與 `cluster` 指到的位置與母叢集存在、帶環境後綴的上層裡實例環境相同。",
6507
+ "description": "`ops/targets.json` 的格式,組織層與產品層共用。`hosts` 宣告位置與它的能力,`instances` 宣告實例。實例的位置二選一:自己寫 `host`(放在母叢集或租戶裡時加 `cluster`),或用 `ref` 指向別的倉宣告的實例。`host` 指向別的倉宣告的位置時加 `<RepoName>:` 前綴。這份 schema 驗證鍵的格式、`host` 與 `ref` 二選一、`provider` 是 `orbstack` 時只能有一個母叢集。三項由程式檢查:`ref` 指到的實例 `kind` 相同、`host` 與 `cluster` 指到的位置與母叢集存在、帶環境後綴的上層裡實例環境相同。",
6014
6508
  "type": "object",
6015
6509
  "additionalProperties": false,
6016
6510
  "properties": {
@@ -6110,31 +6604,9 @@
6110
6604
  "pattern": "^(hosts|clusters)/"
6111
6605
  }
6112
6606
  },
6113
- "patternProperties": {
6114
- "^[a-z0-9][a-z0-9-]*/shared$": {
6115
- "allOf": [
6116
- {
6117
- "$ref": "#/$defs/instance"
6118
- }
6119
- ],
6120
- "required": [
6121
- "serves"
6122
- ]
6123
- },
6124
- "^[a-z0-9][a-z0-9-]*/(dev|stg|prod)$": {
6125
- "allOf": [
6126
- {
6127
- "$ref": "#/$defs/instance"
6128
- }
6129
- ],
6130
- "not": {
6131
- "required": [
6132
- "serves"
6133
- ]
6134
- }
6135
- }
6136
- },
6137
- "additionalProperties": false
6607
+ "additionalProperties": {
6608
+ "$ref": "#/$defs/instance"
6609
+ }
6138
6610
  }
6139
6611
  },
6140
6612
  "$defs": {
@@ -6169,19 +6641,6 @@
6169
6641
  "type": "string",
6170
6642
  "pattern": "^[A-Za-z0-9_.-]+:[a-z0-9][a-z0-9-]*/(dev|stg|prod|shared)$",
6171
6643
  "description": "別的倉宣告的實例 `<RepoName>:<用途>/<環境>`"
6172
- },
6173
- "serves": {
6174
- "type": "array",
6175
- "minItems": 1,
6176
- "uniqueItems": true,
6177
- "items": {
6178
- "enum": [
6179
- "dev",
6180
- "stg",
6181
- "prod"
6182
- ]
6183
- },
6184
- "description": "`shared` 實例服務的環境"
6185
6644
  }
6186
6645
  },
6187
6646
  "oneOf": [
@@ -6226,7 +6685,7 @@
6226
6685
  },
6227
6686
  "content": {
6228
6687
  "schema": {
6229
- "description": "`ops/targets.json` 的格式,組織層與產品層共用。`hosts` 宣告位置與它的能力,`instances` 宣告實例。實例的位置二選一:自己寫 `host`(放在母叢集或租戶裡時加 `cluster`),或用 `ref` 指向別的倉宣告的實例。`host` 指向別的倉宣告的位置時加 `<RepoName>:` 前綴。只有 `shared` 實例必寫 `serves`。這份 schema 驗證鍵的格式、`host` 與 `ref` 二選一、`serves` 只在 `shared` 實例、`provider` 是 `orbstack` 時只能有一個母叢集。三項由程式檢查:`ref` 指到的實例 `kind` 相同、`host` 與 `cluster` 指到的位置與母叢集存在、帶環境後綴的上層裡實例環境相同。",
6688
+ "description": "`ops/targets.json` 的格式,組織層與產品層共用。`hosts` 宣告位置與它的能力,`instances` 宣告實例。實例的位置二選一:自己寫 `host`(放在母叢集或租戶裡時加 `cluster`),或用 `ref` 指向別的倉宣告的實例。`host` 指向別的倉宣告的位置時加 `<RepoName>:` 前綴。這份 schema 驗證鍵的格式、`host` 與 `ref` 二選一、`provider` 是 `orbstack` 時只能有一個母叢集。三項由程式檢查:`ref` 指到的實例 `kind` 相同、`host` 與 `cluster` 指到的位置與母叢集存在、帶環境後綴的上層裡實例環境相同。",
6230
6689
  "type": "object",
6231
6690
  "additionalProperties": false,
6232
6691
  "properties": {
@@ -6326,31 +6785,9 @@
6326
6785
  "pattern": "^(hosts|clusters)/"
6327
6786
  }
6328
6787
  },
6329
- "patternProperties": {
6330
- "^[a-z0-9][a-z0-9-]*/shared$": {
6331
- "allOf": [
6332
- {
6333
- "$ref": "#/$defs/instance"
6334
- }
6335
- ],
6336
- "required": [
6337
- "serves"
6338
- ]
6339
- },
6340
- "^[a-z0-9][a-z0-9-]*/(dev|stg|prod)$": {
6341
- "allOf": [
6342
- {
6343
- "$ref": "#/$defs/instance"
6344
- }
6345
- ],
6346
- "not": {
6347
- "required": [
6348
- "serves"
6349
- ]
6350
- }
6351
- }
6352
- },
6353
- "additionalProperties": false
6788
+ "additionalProperties": {
6789
+ "$ref": "#/$defs/instance"
6790
+ }
6354
6791
  }
6355
6792
  },
6356
6793
  "$defs": {
@@ -6385,19 +6822,6 @@
6385
6822
  "type": "string",
6386
6823
  "pattern": "^[A-Za-z0-9_.-]+:[a-z0-9][a-z0-9-]*/(dev|stg|prod|shared)$",
6387
6824
  "description": "別的倉宣告的實例 `<RepoName>:<用途>/<環境>`"
6388
- },
6389
- "serves": {
6390
- "type": "array",
6391
- "minItems": 1,
6392
- "uniqueItems": true,
6393
- "items": {
6394
- "enum": [
6395
- "dev",
6396
- "stg",
6397
- "prod"
6398
- ]
6399
- },
6400
- "description": "`shared` 實例服務的環境"
6401
6825
  }
6402
6826
  },
6403
6827
  "oneOf": [
@@ -6877,6 +7301,24 @@
6877
7301
  "sameBranchOnly": "Only a pull request from a branch in the same repository is handled."
6878
7302
  }
6879
7303
  }
7304
+ },
7305
+ {
7306
+ "since": "0.5.0",
7307
+ "content": {
7308
+ "value": {
7309
+ "file": "auto-merge.yml",
7310
+ "source": "the base role of blueprint-shared-templates, synced into every repository",
7311
+ "repositories": "Every repository has the same workflow, private and public alike.",
7312
+ "ownWork": "The workflow merges the pull requests that carry the auto-merge label.",
7313
+ "triggers": [
7314
+ "A pull request gets the auto-merge label.",
7315
+ "The CI workflow finishes (workflow_run, completed)."
7316
+ ],
7317
+ "everyTime": "Each run reads the required checks of the latest head commit of the pull request again. If any check failed or is still running, the run ends and waits for the next trigger.",
7318
+ "sameBranchOnly": "Only a pull request from a branch in the same repository is handled.",
7319
+ "runName": "The workflow has a run-name `auto-merge <head sha of the pull request>`, quoted as a whole. A run of the workflow_run event has the head commit and branch of the default branch, so its own head sha says nothing about the pull request; the head sha in the name is what tells whose run it is."
7320
+ }
7321
+ }
6880
7322
  }
6881
7323
  ],
6882
7324
  "source": {
@@ -6893,7 +7335,8 @@
6893
7335
  "The CI workflow finishes (workflow_run, completed)."
6894
7336
  ],
6895
7337
  "everyTime": "Each run reads the required checks of the latest head commit of the pull request again. If any check failed or is still running, the run ends and waits for the next trigger.",
6896
- "sameBranchOnly": "Only a pull request from a branch in the same repository is handled."
7338
+ "sameBranchOnly": "Only a pull request from a branch in the same repository is handled.",
7339
+ "runName": "The workflow has a run-name `auto-merge <head sha of the pull request>`, quoted as a whole. A run of the workflow_run event has the head commit and branch of the default branch, so its own head sha says nothing about the pull request; the head sha in the name is what tells whose run it is."
6897
7340
  }
6898
7341
  }
6899
7342
  },
@@ -8197,6 +8640,104 @@
8197
8640
  "additionalProperties": false
8198
8641
  }
8199
8642
  }
8643
+ },
8644
+ {
8645
+ "since": "0.5.0",
8646
+ "content": {
8647
+ "schema": {
8648
+ "type": "object",
8649
+ "description": "The values an organization gives for the facts of blueprint-shared that list field names in `orgValues`. Every field a shared fact lists is a property here, and no other field is allowed.",
8650
+ "properties": {
8651
+ "mergeBotApp": {
8652
+ "type": "string",
8653
+ "description": "The name of the GitHub App whose installation token the auto-merge workflow uses (blueprint-shared.merge.token)."
8654
+ },
8655
+ "privateRepoRunner": {
8656
+ "type": "string",
8657
+ "description": "The kind of runner that the build and deploy jobs of a private repository run on, for example self-hosted."
8658
+ },
8659
+ "selfHostedRunnerLabels": {
8660
+ "type": "object",
8661
+ "description": "The runs-on labels of a self-hosted runner. Needed only when privateRepoRunner is self-hosted.",
8662
+ "properties": {
8663
+ "default": {
8664
+ "type": "string",
8665
+ "description": "The label of a job that has no special need, and of the build job of publish.yml."
8666
+ },
8667
+ "docker": {
8668
+ "type": "string",
8669
+ "description": "The label of a job that needs docker."
8670
+ },
8671
+ "swift": {
8672
+ "type": "string",
8673
+ "description": "The label of a swift job."
8674
+ }
8675
+ },
8676
+ "required": [
8677
+ "default"
8678
+ ],
8679
+ "additionalProperties": false
8680
+ },
8681
+ "githubPackagesPublishRunner": {
8682
+ "type": "object",
8683
+ "description": "The runner of the single job that publishes to GitHub Packages.",
8684
+ "properties": {
8685
+ "runner": {
8686
+ "type": "string",
8687
+ "description": "The kind of runner, for example self-hosted."
8688
+ },
8689
+ "label": {
8690
+ "type": "string",
8691
+ "description": "The runs-on label of the job, when the runner kind needs one."
8692
+ }
8693
+ },
8694
+ "required": [
8695
+ "runner"
8696
+ ],
8697
+ "additionalProperties": false
8698
+ },
8699
+ "privatePackageRegistry": {
8700
+ "type": "string",
8701
+ "description": "The registry that private packages are published to, for example github-packages."
8702
+ },
8703
+ "aggregatePackageName": {
8704
+ "type": "string",
8705
+ "description": "The package name of the facts aggregate package of the organization, with its scope when it has one. Omitted when the organization has no aggregate package."
8706
+ },
8707
+ "aggregateRegistry": {
8708
+ "type": "string",
8709
+ "description": "The registry that the facts aggregate package is published to. Omitted when the organization has no aggregate package."
8710
+ },
8711
+ "unscopedPublicPackages": {
8712
+ "type": "array",
8713
+ "description": "The packages the organization publishes without an npm scope, each one listed by name.",
8714
+ "items": {
8715
+ "type": "string"
8716
+ }
8717
+ },
8718
+ "expectedExclude": {
8719
+ "type": "array",
8720
+ "description": "The expected entries of minimumReleaseAgeExclude in pnpm-workspace.yaml. Optional, because the entries follow from the scope, the -facts suffix and unscopedPublicPackages.",
8721
+ "items": {
8722
+ "type": "string"
8723
+ }
8724
+ },
8725
+ "mergeBotUserId": {
8726
+ "type": "string",
8727
+ "pattern": "^[0-9]+$",
8728
+ "description": "The numeric user id of the bot account of the GitHub App named in mergeBotApp (gh api '/users/<mergeBotApp>[bot]' --jq .id). The deploy templates write it into the commit author <id>+<mergeBotApp>[bot] of writeback-ops.sh. Required when a repository has the role deploy."
8729
+ }
8730
+ },
8731
+ "required": [
8732
+ "mergeBotApp",
8733
+ "privateRepoRunner",
8734
+ "githubPackagesPublishRunner",
8735
+ "privatePackageRegistry",
8736
+ "unscopedPublicPackages"
8737
+ ],
8738
+ "additionalProperties": false
8739
+ }
8740
+ }
8200
8741
  }
8201
8742
  ],
8202
8743
  "source": {
@@ -8280,6 +8821,11 @@
8280
8821
  "items": {
8281
8822
  "type": "string"
8282
8823
  }
8824
+ },
8825
+ "mergeBotUserId": {
8826
+ "type": "string",
8827
+ "pattern": "^[0-9]+$",
8828
+ "description": "The numeric user id of the bot account of the GitHub App named in mergeBotApp (gh api '/users/<mergeBotApp>[bot]' --jq .id). The deploy templates write it into the commit author <id>+<mergeBotApp>[bot] of writeback-ops.sh. Required when a repository has the role deploy."
8283
8829
  }
8284
8830
  },
8285
8831
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blueprint-shared-facts",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Facts shared by several products, published on its own",
5
5
  "license": "MIT",
6
6
  "author": "Carlos Space",