@tdk-landscape/tdk-cli-core 1.3.101 → 1.3.102
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.
package/Tiltfile
CHANGED
|
@@ -35,6 +35,7 @@ load('./engine/topologies/tilt/resources/conditions.star', _Database='Database')
|
|
|
35
35
|
load('./engine/topologies/tilt/resources/declaration.star', _Orchestrator='Orchestrator')
|
|
36
36
|
load('./engine/topologies/tilt/resources/ordering.star', _Infra='Infra')
|
|
37
37
|
load('./engine/topologies/tilt/resources/triggers.star', _Watchers='Watchers')
|
|
38
|
+
load('./engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star', _resource_defers_start='resource_defers_start')
|
|
38
39
|
|
|
39
40
|
# =============================================================================
|
|
40
41
|
# SPECS (Tech stack and standards)
|
|
@@ -128,6 +129,10 @@ Orchestrator = _Orchestrator
|
|
|
128
129
|
Infra = _Infra
|
|
129
130
|
Watchers = _Watchers
|
|
130
131
|
|
|
132
|
+
# True when a manifest's deferStart is actually active (licensed); decides whether a `<name>-image` prebuild resource exists.
|
|
133
|
+
# The generated Tiltfile loads this from ext://tdk-cli, which resolves to this root Tiltfile.
|
|
134
|
+
resource_defers_start = _resource_defers_start
|
|
135
|
+
|
|
131
136
|
# Specs
|
|
132
137
|
assert_tech_stack = _assert_tech_stack
|
|
133
138
|
TECH_STACK = _TECH_STACK
|
package/cli/package.json
CHANGED
|
@@ -89,6 +89,7 @@ load('ext://tdk-cli',
|
|
|
89
89
|
'APP_RESOURCES',
|
|
90
90
|
'GLOBAL_CONFIG_EXPORT',
|
|
91
91
|
'Registry',
|
|
92
|
+
'resource_defers_start',
|
|
92
93
|
)
|
|
93
94
|
|
|
94
95
|
# =============================================================================
|
|
@@ -265,7 +266,9 @@ for _KNOWN_SVC in _app_resources_list:
|
|
|
265
266
|
_KNOWN_TILT_RESOURCES.add(_KNOWN_RES_NAME + '-config-gen')
|
|
266
267
|
_KNOWN_RES_MANIFEST = _KNOWN_RES.get('_manifest', {})
|
|
267
268
|
_KNOWN_RES_SABLIER = _KNOWN_RES_MANIFEST.get('sablier', {})
|
|
268
|
-
|
|
269
|
+
# Mirrors _register_single_resource: the prebuild only exists for
|
|
270
|
+
# a resource that gets a docker_build (has syncs, not a library/sdk/BYO).
|
|
271
|
+
if resource_defers_start(_KNOWN_RES_MANIFEST) and _KNOWN_RES_MANIFEST.get('appType', 'backend') not in ['library', 'sdk', 'bring-your-own'] and _KNOWN_RES_MANIFEST.get('syncs'):
|
|
269
272
|
_DEFERRED_IMAGE_RESOURCES.add(_KNOWN_RES_NAME + '-image')
|
|
270
273
|
if _KNOWN_SVC_STACK:
|
|
271
274
|
_STACK_TO_RESOURCE_NAMES.setdefault(_KNOWN_SVC_STACK, [])
|
|
@@ -291,7 +294,11 @@ if FOCUS_MODE and FOCUS_ENABLED_RESOURCES:
|
|
|
291
294
|
# local_resource because their dc_resource is not auto-init.
|
|
292
295
|
# Keep that prebuild in focus mode so `tdk up <stack>` still
|
|
293
296
|
# prepares the image before the first request wakes the service.
|
|
294
|
-
|
|
297
|
+
# Only when it exists: without a license deferStart is off and
|
|
298
|
+
# no `-image` resource is registered, and Tilt errors on an
|
|
299
|
+
# enabled name it cannot find.
|
|
300
|
+
if _STACK_RES_NAME + '-image' in _DEFERRED_IMAGE_RESOURCES:
|
|
301
|
+
_FILTERED_RESOURCES.append(_STACK_RES_NAME + '-image')
|
|
295
302
|
else:
|
|
296
303
|
_MATCHED = [kr for kr in _KNOWN_TILT_RESOURCES if kr != 'service-discovery-daemon' and kr.startswith(_R + '-')]
|
|
297
304
|
_FILTERED_RESOURCES.extend(_MATCHED)
|
package/engine/Tiltfile
CHANGED
|
@@ -39,6 +39,7 @@ load('./topologies/tilt/resources/conditions.star', _Database='Database')
|
|
|
39
39
|
load('./topologies/tilt/resources/declaration.star', _Orchestrator='Orchestrator')
|
|
40
40
|
load('./topologies/tilt/resources/ordering.star', _Infra='Infra')
|
|
41
41
|
load('./topologies/tilt/resources/triggers.star', _Watchers='Watchers')
|
|
42
|
+
load('./topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star', _resource_defers_start='resource_defers_start')
|
|
42
43
|
|
|
43
44
|
# =============================================================================
|
|
44
45
|
# RE-EXPORTS
|
|
@@ -77,4 +78,7 @@ Orchestrator = _Orchestrator
|
|
|
77
78
|
Infra = _Infra
|
|
78
79
|
Watchers = _Watchers
|
|
79
80
|
|
|
81
|
+
# True when a manifest's deferStart is actually active (licensed); decides whether a `<name>-image` prebuild resource exists.
|
|
82
|
+
resource_defers_start = _resource_defers_start
|
|
83
|
+
|
|
80
84
|
print("✅ TDK Engine loaded: orchestration, resources, and lifecycle")
|
package/engine/entrypoint.star
CHANGED
|
@@ -36,6 +36,7 @@ load("./topologies/tilt/resources/conditions.star", _Database = "Database")
|
|
|
36
36
|
load("./topologies/tilt/resources/declaration.star", _Orchestrator = "Orchestrator")
|
|
37
37
|
load("./topologies/tilt/resources/ordering.star", _Infra = "Infra")
|
|
38
38
|
load("./topologies/tilt/resources/triggers.star", _Watchers = "Watchers")
|
|
39
|
+
load("./topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star", _resource_defers_start = "resource_defers_start")
|
|
39
40
|
|
|
40
41
|
Utils = _Utils
|
|
41
42
|
Manifest = _Manifest
|
|
@@ -65,6 +66,7 @@ Database = _Database
|
|
|
65
66
|
Orchestrator = _Orchestrator
|
|
66
67
|
Infra = _Infra
|
|
67
68
|
Watchers = _Watchers
|
|
69
|
+
resource_defers_start = _resource_defers_start
|
|
68
70
|
|
|
69
71
|
# =============================================================================
|
|
70
72
|
# 🔮 AUTO-DISCOVERY DAEMON
|
package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star
CHANGED
|
@@ -290,6 +290,11 @@ def _wake_compose_invocation(project_root, resource_path, res_name, resource_nam
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
|
|
293
|
+
def _image_target(config):
|
|
294
|
+
"""The Dockerfile target Tilt builds and the deferStart prebuild must match: `development` for Go with `dev.liveReload`."""
|
|
295
|
+
return 'development' if Docker.go_live_reload(config.get('manifest', {})) else 'production'
|
|
296
|
+
|
|
297
|
+
|
|
293
298
|
def _register_docker_build(config, live_update_rules):
|
|
294
299
|
"""Register docker_build with live_update for hot-reload support."""
|
|
295
300
|
TypescriptBuilders.build_typescript_service(
|
|
@@ -298,7 +303,7 @@ def _register_docker_build(config, live_update_rules):
|
|
|
298
303
|
_resolve_dockerfile(config),
|
|
299
304
|
live_update_rules,
|
|
300
305
|
config['res_deps'],
|
|
301
|
-
target =
|
|
306
|
+
target = _image_target(config),
|
|
302
307
|
)
|
|
303
308
|
|
|
304
309
|
|
|
@@ -309,20 +314,23 @@ def _register_deferred_image_prebuild(config, auto_init_apps):
|
|
|
309
314
|
live on tdk-erp-system, task 7.2), so a fresh project's first request would
|
|
310
315
|
find no image and the wake gateway would fall back to `tilt trigger`, which
|
|
311
316
|
queues behind every other build. This local_resource builds the same image
|
|
312
|
-
(same Dockerfile
|
|
317
|
+
(same Dockerfile and target as docker_build: `production`, or `development` for Go with `dev.liveReload`; host network, and an allowlist
|
|
313
318
|
.dockerignore equivalent to docker_build's only=/ignore=) under the tag the
|
|
314
319
|
compose service declares, so the gateway can start it directly.
|
|
315
320
|
"""
|
|
316
321
|
project_root = config.get('project_root', '')
|
|
317
322
|
dockerfile = _resolve_dockerfile(config)
|
|
318
323
|
prebuild_dockerfile = dockerfile + '.prebuild'
|
|
324
|
+
# The same target _register_docker_build picks: a Go service with `dev.liveReload` runs the development image (the watcher), so
|
|
325
|
+
# prebuilding `production` under the same tag would start the compiled binary with no reload.
|
|
326
|
+
target = _image_target(config)
|
|
319
327
|
ignore_content = TypescriptBuilders.prebuild_dockerignore(dockerfile, project_root, config['res_path'])
|
|
320
328
|
# BuildKit reads `<dockerfile>.dockerignore` for `-f <dockerfile>`; the
|
|
321
329
|
# original Dockerfile already has a (denylist) one, hence the copy.
|
|
322
330
|
cmd = (
|
|
323
331
|
"cp '" + dockerfile + "' '" + prebuild_dockerfile + "'"
|
|
324
332
|
+ " && printf '%s' '" + ignore_content + "' > '" + prebuild_dockerfile + ".dockerignore'"
|
|
325
|
-
+ " && docker build --network host --target
|
|
333
|
+
+ " && docker build --network host --target " + target
|
|
326
334
|
+ " -f '" + prebuild_dockerfile + "'"
|
|
327
335
|
+ " -t '" + _app_image_name(config['resource_name'], config['res_name']) + "'"
|
|
328
336
|
+ " '" + (project_root or '.') + "'"
|