ldw-core 0.2.1__tar.gz
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.
- ldw_core-0.2.1/.gitignore +27 -0
- ldw_core-0.2.1/LICENSE +201 -0
- ldw_core-0.2.1/NOTICE +4 -0
- ldw_core-0.2.1/PKG-INFO +55 -0
- ldw_core-0.2.1/README.md +7 -0
- ldw_core-0.2.1/pyproject.toml +161 -0
- ldw_core-0.2.1/scripts/build_provenance.py +132 -0
- ldw_core-0.2.1/src/local_devops_workbench/__init__.py +42 -0
- ldw_core-0.2.1/src/local_devops_workbench/__main__.py +4 -0
- ldw_core-0.2.1/src/local_devops_workbench/_build_info.py +6 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/Chart.yaml +7 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/templates/_helpers.tpl +21 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/templates/access.yaml +34 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/templates/ingress.yaml +29 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/templates/migration.yaml +65 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/templates/networkpolicy.yaml +54 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/templates/statefulsets.yaml +111 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/templates/workloads.yaml +140 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/charts/local-stack/values.yaml +15 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/kind/kind-cluster-ci.yaml +23 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/kind/kind-cluster.yaml +25 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/runtime/Tiltfile +78 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/runtime/images.lock.toml +97 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/runtime/tools.lock.toml +84 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets/values/four-service.yaml +59 -0
- ldw_core-0.2.1/src/local_devops_workbench/assets.py +47 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/__init__.py +120 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/_context.py +314 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/acceptance.py +164 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/agent.py +207 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/backup.py +142 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/cache.py +50 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/cluster.py +52 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/export.py +155 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/integration.py +559 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/lifecycle.py +710 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/observe.py +297 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/onboarding.py +709 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/plans.py +396 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/plugin.py +68 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/project.py +132 -0
- ldw_core-0.2.1/src/local_devops_workbench/cli/runtime_cmds.py +196 -0
- ldw_core-0.2.1/src/local_devops_workbench/config.py +465 -0
- ldw_core-0.2.1/src/local_devops_workbench/declarative_packs.py +624 -0
- ldw_core-0.2.1/src/local_devops_workbench/detectors.py +15 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/__init__.py +33 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/compose.py +725 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/fs_safety.py +64 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/generators.py +34 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/identity.py +111 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/kubernetes.py +327 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/native.py +772 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/ports.py +50 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/proposal.py +675 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/questions.py +79 -0
- ldw_core-0.2.1/src/local_devops_workbench/discovery/scanner.py +516 -0
- ldw_core-0.2.1/src/local_devops_workbench/errors.py +74 -0
- ldw_core-0.2.1/src/local_devops_workbench/executor.py +98 -0
- ldw_core-0.2.1/src/local_devops_workbench/export/__init__.py +61 -0
- ldw_core-0.2.1/src/local_devops_workbench/export/common.py +83 -0
- ldw_core-0.2.1/src/local_devops_workbench/export/mise.py +128 -0
- ldw_core-0.2.1/src/local_devops_workbench/export/templates/Tiltfile.j2 +132 -0
- ldw_core-0.2.1/src/local_devops_workbench/export/templates/mise.toml.j2 +42 -0
- ldw_core-0.2.1/src/local_devops_workbench/export/tiltfile.py +169 -0
- ldw_core-0.2.1/src/local_devops_workbench/extensions.py +442 -0
- ldw_core-0.2.1/src/local_devops_workbench/failure_labs.py +49 -0
- ldw_core-0.2.1/src/local_devops_workbench/graph.py +43 -0
- ldw_core-0.2.1/src/local_devops_workbench/image_lock.py +60 -0
- ldw_core-0.2.1/src/local_devops_workbench/install_hint.py +50 -0
- ldw_core-0.2.1/src/local_devops_workbench/integration_models.py +672 -0
- ldw_core-0.2.1/src/local_devops_workbench/integration_service.py +2101 -0
- ldw_core-0.2.1/src/local_devops_workbench/kinds.py +146 -0
- ldw_core-0.2.1/src/local_devops_workbench/kubernetes_context.py +467 -0
- ldw_core-0.2.1/src/local_devops_workbench/lifecycle_probe.py +58 -0
- ldw_core-0.2.1/src/local_devops_workbench/local_tls.py +178 -0
- ldw_core-0.2.1/src/local_devops_workbench/models.py +841 -0
- ldw_core-0.2.1/src/local_devops_workbench/orchestration.py +1415 -0
- ldw_core-0.2.1/src/local_devops_workbench/owned_resources.py +88 -0
- ldw_core-0.2.1/src/local_devops_workbench/paths.py +179 -0
- ldw_core-0.2.1/src/local_devops_workbench/planner.py +83 -0
- ldw_core-0.2.1/src/local_devops_workbench/plugin_api.py +562 -0
- ldw_core-0.2.1/src/local_devops_workbench/plugin_loading.py +76 -0
- ldw_core-0.2.1/src/local_devops_workbench/ports.py +517 -0
- ldw_core-0.2.1/src/local_devops_workbench/prerequisites.py +279 -0
- ldw_core-0.2.1/src/local_devops_workbench/presentation.py +975 -0
- ldw_core-0.2.1/src/local_devops_workbench/probes.py +30 -0
- ldw_core-0.2.1/src/local_devops_workbench/project_integrations.py +54 -0
- ldw_core-0.2.1/src/local_devops_workbench/project_service.py +233 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/__init__.py +4 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/base.py +23 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/common.py +173 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/compose.py +97 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/ddev.py +114 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/kubernetes.py +1153 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/mixed.py +12 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/native.py +136 -0
- ldw_core-0.2.1/src/local_devops_workbench/providers/registry.py +79 -0
- ldw_core-0.2.1/src/local_devops_workbench/py.typed +1 -0
- ldw_core-0.2.1/src/local_devops_workbench/reconciliation.py +1166 -0
- ldw_core-0.2.1/src/local_devops_workbench/redaction.py +92 -0
- ldw_core-0.2.1/src/local_devops_workbench/release.py +94 -0
- ldw_core-0.2.1/src/local_devops_workbench/repository_files.py +599 -0
- ldw_core-0.2.1/src/local_devops_workbench/runner.py +396 -0
- ldw_core-0.2.1/src/local_devops_workbench/runtime.py +1465 -0
- ldw_core-0.2.1/src/local_devops_workbench/schema_migrations.py +341 -0
- ldw_core-0.2.1/src/local_devops_workbench/secrets.py +154 -0
- ldw_core-0.2.1/src/local_devops_workbench/sections.py +305 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/__init__.py +1 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/acceptance.py +468 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/backup.py +475 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/bootstrap.py +148 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cache.py +90 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/__init__.py +45 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/base.py +171 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/builder.py +552 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/inspect.py +297 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/kubeconfig.py +310 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/nodes.py +343 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/registry.py +490 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/service.py +596 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/cluster/tls.py +50 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/context.py +191 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/doctor.py +499 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/host_runtime.py +464 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/plugins.py +315 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/project_locator.py +281 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/readiness.py +268 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/target_status.py +282 -0
- ldw_core-0.2.1/src/local_devops_workbench/services/tilt.py +386 -0
- ldw_core-0.2.1/src/local_devops_workbench/session_control.py +294 -0
- ldw_core-0.2.1/src/local_devops_workbench/state.py +854 -0
- ldw_core-0.2.1/src/local_devops_workbench/teardown.py +306 -0
- ldw_core-0.2.1/src/local_devops_workbench/tilt_brokers.py +321 -0
- ldw_core-0.2.1/src/local_devops_workbench/tilt_command.py +142 -0
- ldw_core-0.2.1/src/local_devops_workbench/tool_versions.py +15 -0
- ldw_core-0.2.1/tests/conftest.py +129 -0
- ldw_core-0.2.1/tests/fixtures/export/compose-app.Tiltfile +98 -0
- ldw_core-0.2.1/tests/fixtures/export/compose-app.toml +254 -0
- ldw_core-0.2.1/tests/fixtures/export/mixed-platform.Tiltfile +98 -0
- ldw_core-0.2.1/tests/fixtures/export/mixed-platform.toml +285 -0
- ldw_core-0.2.1/tests/fixtures/export/native-monorepo.Tiltfile +89 -0
- ldw_core-0.2.1/tests/fixtures/export/native-monorepo.mise.toml +26 -0
- ldw_core-0.2.1/tests/fixtures/export/native-monorepo.toml +97 -0
- ldw_core-0.2.1/tests/fixtures/export/sample-monorepo.Tiltfile +119 -0
- ldw_core-0.2.1/tests/fixtures/export/sample-monorepo.mise.toml +25 -0
- ldw_core-0.2.1/tests/fixtures/export/sample-monorepo.toml +131 -0
- ldw_core-0.2.1/tests/test_acceptance.py +333 -0
- ldw_core-0.2.1/tests/test_bootstrap_service.py +279 -0
- ldw_core-0.2.1/tests/test_build_identity.py +22 -0
- ldw_core-0.2.1/tests/test_cache.py +153 -0
- ldw_core-0.2.1/tests/test_cli.py +177 -0
- ldw_core-0.2.1/tests/test_cli_commands.py +3799 -0
- ldw_core-0.2.1/tests/test_cli_export.py +130 -0
- ldw_core-0.2.1/tests/test_cli_progress.py +164 -0
- ldw_core-0.2.1/tests/test_cluster_service.py +2572 -0
- ldw_core-0.2.1/tests/test_command_plugins.py +673 -0
- ldw_core-0.2.1/tests/test_compose_discovery.py +282 -0
- ldw_core-0.2.1/tests/test_config_edges.py +253 -0
- ldw_core-0.2.1/tests/test_config_secrets_state.py +1133 -0
- ldw_core-0.2.1/tests/test_context_service.py +150 -0
- ldw_core-0.2.1/tests/test_core_edge_cases.py +287 -0
- ldw_core-0.2.1/tests/test_declarative_packs.py +631 -0
- ldw_core-0.2.1/tests/test_discovery_reconciliation.py +1636 -0
- ldw_core-0.2.1/tests/test_doctor_observability_services.py +247 -0
- ldw_core-0.2.1/tests/test_export.py +647 -0
- ldw_core-0.2.1/tests/test_extension_hooks.py +353 -0
- ldw_core-0.2.1/tests/test_generated_modes.py +214 -0
- ldw_core-0.2.1/tests/test_host_runtime_session_readiness.py +1602 -0
- ldw_core-0.2.1/tests/test_install_hint.py +93 -0
- ldw_core-0.2.1/tests/test_integration_service_edges.py +1639 -0
- ldw_core-0.2.1/tests/test_kinds.py +132 -0
- ldw_core-0.2.1/tests/test_kubernetes_context.py +602 -0
- ldw_core-0.2.1/tests/test_lifecycle_probe.py +151 -0
- ldw_core-0.2.1/tests/test_local_tls.py +79 -0
- ldw_core-0.2.1/tests/test_manifest_sections.py +463 -0
- ldw_core-0.2.1/tests/test_mode_generators.py +213 -0
- ldw_core-0.2.1/tests/test_models_graph.py +329 -0
- ldw_core-0.2.1/tests/test_orchestration.py +1497 -0
- ldw_core-0.2.1/tests/test_owned_resources.py +23 -0
- ldw_core-0.2.1/tests/test_plugins.py +390 -0
- ldw_core-0.2.1/tests/test_prerequisites.py +267 -0
- ldw_core-0.2.1/tests/test_project_integrations.py +132 -0
- ldw_core-0.2.1/tests/test_project_locator.py +241 -0
- ldw_core-0.2.1/tests/test_project_service.py +140 -0
- ldw_core-0.2.1/tests/test_providers_planner.py +1771 -0
- ldw_core-0.2.1/tests/test_readiness.py +431 -0
- ldw_core-0.2.1/tests/test_release.py +127 -0
- ldw_core-0.2.1/tests/test_repository_files.py +621 -0
- ldw_core-0.2.1/tests/test_runner_executor_runtime_backup.py +2308 -0
- ldw_core-0.2.1/tests/test_schema_migrations.py +286 -0
- ldw_core-0.2.1/tests/test_target_status.py +447 -0
- ldw_core-0.2.1/tests/test_teardown.py +353 -0
- ldw_core-0.2.1/tests/test_terminal_presentation.py +566 -0
- ldw_core-0.2.1/tests/test_tilt.py +886 -0
- ldw_core-0.2.1/tests/test_tilt_brokers.py +215 -0
- ldw_core-0.2.1/tests/test_tilt_command.py +140 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.env
|
|
3
|
+
.env.*
|
|
4
|
+
!.env.example
|
|
5
|
+
.coverage
|
|
6
|
+
.mypy_cache/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.ruff_cache/
|
|
9
|
+
.venv/
|
|
10
|
+
__pycache__/
|
|
11
|
+
*.py[cod]
|
|
12
|
+
*.pem
|
|
13
|
+
*.key
|
|
14
|
+
*.p12
|
|
15
|
+
*.pfx
|
|
16
|
+
*.sqlite3
|
|
17
|
+
*.sqlite3-shm
|
|
18
|
+
*.sqlite3-wal
|
|
19
|
+
*.rdb
|
|
20
|
+
build/
|
|
21
|
+
dist/
|
|
22
|
+
htmlcov/
|
|
23
|
+
.ldw/
|
|
24
|
+
.planr/
|
|
25
|
+
graphify-out/
|
|
26
|
+
**/.devops-workbench/project.local.toml
|
|
27
|
+
**/.devops-workbench/.state/
|
ldw_core-0.2.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
ldw_core-0.2.1/NOTICE
ADDED
ldw_core-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: ldw-core
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Core of the Local DevOps Workbench: discovery, manifests, and the local runtime lifecycle.
|
|
5
|
+
Project-URL: Homepage, https://github.com/openplanr/ldw
|
|
6
|
+
Project-URL: Documentation, https://github.com/openplanr/ldw/tree/main/docs
|
|
7
|
+
Project-URL: Issues, https://github.com/openplanr/ldw/issues
|
|
8
|
+
Project-URL: Source, https://github.com/openplanr/ldw
|
|
9
|
+
Author: AsemDevs
|
|
10
|
+
Maintainer: OpenPlanr
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
Keywords: ddev,developer-experience,devops,docker-compose,kind,orbstack,tilt
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
19
|
+
Classifier: Operating System :: MacOS
|
|
20
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
26
|
+
Classifier: Topic :: System :: Systems Administration
|
|
27
|
+
Requires-Python: <3.15,>=3.12
|
|
28
|
+
Requires-Dist: click<9,>=8.1
|
|
29
|
+
Requires-Dist: filelock<5,>=3.16
|
|
30
|
+
Requires-Dist: httpx<1,>=0.28
|
|
31
|
+
Requires-Dist: jinja2<4,>=3.1
|
|
32
|
+
Requires-Dist: platformdirs<5,>=4.3
|
|
33
|
+
Requires-Dist: pydantic<3,>=2.10
|
|
34
|
+
Requires-Dist: pyyaml<7,>=6.0.2
|
|
35
|
+
Requires-Dist: rich<16,>=13.9
|
|
36
|
+
Requires-Dist: tomli-w<2,>=1.1
|
|
37
|
+
Requires-Dist: typer<1,>=0.15
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: import-linter<3,>=2.5; extra == 'dev'
|
|
40
|
+
Requires-Dist: mypy<3,>=1.14; extra == 'dev'
|
|
41
|
+
Requires-Dist: pre-commit<5,>=4; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest-cov<8,>=6; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest-xdist<4,>=3.6; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest<10,>=8.3; extra == 'dev'
|
|
45
|
+
Requires-Dist: respx<1,>=0.22; extra == 'dev'
|
|
46
|
+
Requires-Dist: ruff<1,>=0.9; extra == 'dev'
|
|
47
|
+
Description-Content-Type: text/markdown
|
|
48
|
+
|
|
49
|
+
# ldw-core
|
|
50
|
+
|
|
51
|
+
The core of the [Local DevOps Workbench](https://github.com/openplanr/ldw): evidence-based project
|
|
52
|
+
discovery, the project manifest, and the local `ldw up`, `status`, `logs`, and `down` lifecycle.
|
|
53
|
+
|
|
54
|
+
Install `local-devops-workbench` for the full workbench with every first-party plugin. Install
|
|
55
|
+
`ldw-core` alone for the minimal core; plugins add their commands when installed next to it.
|
ldw_core-0.2.1/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# ldw-core
|
|
2
|
+
|
|
3
|
+
The core of the [Local DevOps Workbench](https://github.com/openplanr/ldw): evidence-based project
|
|
4
|
+
discovery, the project manifest, and the local `ldw up`, `status`, `logs`, and `down` lifecycle.
|
|
5
|
+
|
|
6
|
+
Install `local-devops-workbench` for the full workbench with every first-party plugin. Install
|
|
7
|
+
`ldw-core` alone for the minimal core; plugins add their commands when installed next to it.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling==1.32.4"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ldw-core"
|
|
7
|
+
version = "0.2.1"
|
|
8
|
+
description = "Core of the Local DevOps Workbench: discovery, manifests, and the local runtime lifecycle."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12,<3.15"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
13
|
+
authors = [{name = "AsemDevs"}]
|
|
14
|
+
maintainers = [{name = "OpenPlanr"}]
|
|
15
|
+
keywords = ["devops", "developer-experience", "docker-compose", "ddev", "kind", "orbstack", "tilt"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: Apache Software License",
|
|
21
|
+
"Operating System :: MacOS",
|
|
22
|
+
"Operating System :: POSIX :: Linux",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
27
|
+
"Topic :: Software Development :: Build Tools",
|
|
28
|
+
"Topic :: System :: Systems Administration",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"click>=8.1,<9",
|
|
32
|
+
"filelock>=3.16,<5",
|
|
33
|
+
"httpx>=0.28,<1",
|
|
34
|
+
"jinja2>=3.1,<4",
|
|
35
|
+
"platformdirs>=4.3,<5",
|
|
36
|
+
"pydantic>=2.10,<3",
|
|
37
|
+
"pyyaml>=6.0.2,<7",
|
|
38
|
+
"rich>=13.9,<16",
|
|
39
|
+
"tomli-w>=1.1,<2",
|
|
40
|
+
"typer>=0.15,<1",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
dev = [
|
|
45
|
+
"import-linter>=2.5,<3",
|
|
46
|
+
"mypy>=1.14,<3",
|
|
47
|
+
"pre-commit>=4,<5",
|
|
48
|
+
"pytest>=8.3,<10",
|
|
49
|
+
"pytest-cov>=6,<8",
|
|
50
|
+
"pytest-xdist>=3.6,<4",
|
|
51
|
+
"respx>=0.22,<1",
|
|
52
|
+
"ruff>=0.9,<1",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[project.urls]
|
|
56
|
+
Homepage = "https://github.com/openplanr/ldw"
|
|
57
|
+
Documentation = "https://github.com/openplanr/ldw/tree/main/docs"
|
|
58
|
+
Issues = "https://github.com/openplanr/ldw/issues"
|
|
59
|
+
Source = "https://github.com/openplanr/ldw"
|
|
60
|
+
|
|
61
|
+
[project.scripts]
|
|
62
|
+
ldw = "local_devops_workbench.cli:main"
|
|
63
|
+
|
|
64
|
+
[tool.hatch.build.targets.wheel]
|
|
65
|
+
packages = ["src/local_devops_workbench"]
|
|
66
|
+
|
|
67
|
+
[tool.hatch.build.hooks.custom]
|
|
68
|
+
path = "scripts/build_provenance.py"
|
|
69
|
+
|
|
70
|
+
[tool.importlinter]
|
|
71
|
+
root_package = "local_devops_workbench"
|
|
72
|
+
include_external_packages = true
|
|
73
|
+
|
|
74
|
+
[[tool.importlinter.contracts]]
|
|
75
|
+
name = "Core does not import first-party plugins"
|
|
76
|
+
type = "forbidden"
|
|
77
|
+
source_modules = ["local_devops_workbench"]
|
|
78
|
+
forbidden_modules = ["ldw_agent", "ldw_deploy", "ldw_labs", "ldw_observability", "ldw_vm"]
|
|
79
|
+
|
|
80
|
+
[[tool.importlinter.contracts]]
|
|
81
|
+
name = "Only the CLI entry points import the CLI"
|
|
82
|
+
type = "forbidden"
|
|
83
|
+
source_modules = [
|
|
84
|
+
"local_devops_workbench._build_info",
|
|
85
|
+
"local_devops_workbench.assets",
|
|
86
|
+
"local_devops_workbench.config",
|
|
87
|
+
"local_devops_workbench.declarative_packs",
|
|
88
|
+
"local_devops_workbench.detectors",
|
|
89
|
+
"local_devops_workbench.discovery",
|
|
90
|
+
"local_devops_workbench.errors",
|
|
91
|
+
"local_devops_workbench.executor",
|
|
92
|
+
"local_devops_workbench.extensions",
|
|
93
|
+
"local_devops_workbench.graph",
|
|
94
|
+
"local_devops_workbench.image_lock",
|
|
95
|
+
"local_devops_workbench.install_hint",
|
|
96
|
+
"local_devops_workbench.integration_models",
|
|
97
|
+
"local_devops_workbench.integration_service",
|
|
98
|
+
"local_devops_workbench.kinds",
|
|
99
|
+
"local_devops_workbench.kubernetes_context",
|
|
100
|
+
"local_devops_workbench.lifecycle_probe",
|
|
101
|
+
"local_devops_workbench.models",
|
|
102
|
+
"local_devops_workbench.orchestration",
|
|
103
|
+
"local_devops_workbench.owned_resources",
|
|
104
|
+
"local_devops_workbench.paths",
|
|
105
|
+
"local_devops_workbench.planner",
|
|
106
|
+
"local_devops_workbench.plugin_api",
|
|
107
|
+
"local_devops_workbench.plugin_loading",
|
|
108
|
+
"local_devops_workbench.ports",
|
|
109
|
+
"local_devops_workbench.prerequisites",
|
|
110
|
+
"local_devops_workbench.presentation",
|
|
111
|
+
"local_devops_workbench.project_integrations",
|
|
112
|
+
"local_devops_workbench.project_service",
|
|
113
|
+
"local_devops_workbench.providers",
|
|
114
|
+
"local_devops_workbench.reconciliation",
|
|
115
|
+
"local_devops_workbench.redaction",
|
|
116
|
+
"local_devops_workbench.release",
|
|
117
|
+
"local_devops_workbench.runner",
|
|
118
|
+
"local_devops_workbench.runtime",
|
|
119
|
+
"local_devops_workbench.schema_migrations",
|
|
120
|
+
"local_devops_workbench.secrets",
|
|
121
|
+
"local_devops_workbench.sections",
|
|
122
|
+
"local_devops_workbench.services",
|
|
123
|
+
"local_devops_workbench.session_control",
|
|
124
|
+
"local_devops_workbench.state",
|
|
125
|
+
"local_devops_workbench.teardown",
|
|
126
|
+
"local_devops_workbench.tilt_brokers",
|
|
127
|
+
"local_devops_workbench.tilt_command",
|
|
128
|
+
"local_devops_workbench.tool_versions",
|
|
129
|
+
]
|
|
130
|
+
forbidden_modules = ["local_devops_workbench.cli"]
|
|
131
|
+
|
|
132
|
+
[[tool.importlinter.contracts]]
|
|
133
|
+
name = "Providers do not depend on services"
|
|
134
|
+
type = "forbidden"
|
|
135
|
+
source_modules = [
|
|
136
|
+
"local_devops_workbench.providers",
|
|
137
|
+
]
|
|
138
|
+
forbidden_modules = ["local_devops_workbench.services"]
|
|
139
|
+
|
|
140
|
+
[tool.mypy]
|
|
141
|
+
python_version = "3.12"
|
|
142
|
+
strict = true
|
|
143
|
+
packages = ["local_devops_workbench"]
|
|
144
|
+
|
|
145
|
+
[tool.pytest.ini_options]
|
|
146
|
+
addopts = "-q --strict-markers --cov=local_devops_workbench --cov-report=term-missing"
|
|
147
|
+
testpaths = ["tests"]
|
|
148
|
+
markers = [
|
|
149
|
+
"integration: requires local container or Kubernetes tooling",
|
|
150
|
+
"macos: requires OrbStack or DDEV on macOS",
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
[tool.coverage.run]
|
|
154
|
+
branch = true
|
|
155
|
+
omit = [
|
|
156
|
+
"src/local_devops_workbench/__main__.py",
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
[tool.coverage.report]
|
|
160
|
+
fail_under = 90
|
|
161
|
+
show_missing = true
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""Embed immutable source provenance in LDW wheels and source distributions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import ast
|
|
6
|
+
import os
|
|
7
|
+
import re
|
|
8
|
+
import shutil
|
|
9
|
+
import subprocess
|
|
10
|
+
import tempfile
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
|
15
|
+
|
|
16
|
+
COMMIT_PATTERN = re.compile(r"^[0-9a-f]{7,64}$")
|
|
17
|
+
PACKAGE_PATH = Path("src/local_devops_workbench/_build_info.py")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class CustomBuildHook(BuildHookInterface):
|
|
21
|
+
PLUGIN_NAME = "custom"
|
|
22
|
+
|
|
23
|
+
def initialize(self, version: str, build_data: dict[str, Any]) -> None:
|
|
24
|
+
del version
|
|
25
|
+
root = Path(self.root)
|
|
26
|
+
package_version = self.metadata.version
|
|
27
|
+
commit, dirty, source_kind = resolve_source_identity(root)
|
|
28
|
+
build_id = (
|
|
29
|
+
f"{package_version}+g{commit[:12]}"
|
|
30
|
+
if commit != "unknown"
|
|
31
|
+
else f"{package_version}+unknown"
|
|
32
|
+
)
|
|
33
|
+
if dirty is True:
|
|
34
|
+
build_id += ".dirty"
|
|
35
|
+
content = (
|
|
36
|
+
'"""Generated build provenance; do not edit."""\n\n'
|
|
37
|
+
f"SOURCE_COMMIT = {commit!r}\n"
|
|
38
|
+
f"SOURCE_DIRTY = {dirty!r}\n"
|
|
39
|
+
f"SOURCE_KIND = {source_kind!r}\n"
|
|
40
|
+
f"BUILD_ID = {build_id!r}\n"
|
|
41
|
+
)
|
|
42
|
+
descriptor, temporary_name = tempfile.mkstemp(prefix="ldw-build-info-", suffix=".py")
|
|
43
|
+
with os.fdopen(descriptor, "w", encoding="utf-8") as handle:
|
|
44
|
+
handle.write(content)
|
|
45
|
+
temporary = Path(temporary_name)
|
|
46
|
+
self._temporary = temporary
|
|
47
|
+
destination = (
|
|
48
|
+
PACKAGE_PATH.as_posix()
|
|
49
|
+
if self.target_name == "sdist"
|
|
50
|
+
else "local_devops_workbench/_build_info.py"
|
|
51
|
+
)
|
|
52
|
+
build_data["force_include"][str(temporary)] = destination
|
|
53
|
+
|
|
54
|
+
def finalize(self, version: str, build_data: dict[str, Any], artifact_path: str) -> None:
|
|
55
|
+
del version, build_data, artifact_path
|
|
56
|
+
temporary = getattr(self, "_temporary", None)
|
|
57
|
+
if isinstance(temporary, Path):
|
|
58
|
+
temporary.unlink(missing_ok=True)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def resolve_source_identity(root: Path) -> tuple[str, bool | None, str]:
|
|
62
|
+
environment_commit = os.environ.get("LDW_BUILD_COMMIT", "").strip().lower()
|
|
63
|
+
if COMMIT_PATTERN.fullmatch(environment_commit):
|
|
64
|
+
dirty = _environment_dirty()
|
|
65
|
+
return environment_commit, dirty, "environment"
|
|
66
|
+
|
|
67
|
+
executable = shutil.which("git")
|
|
68
|
+
if executable is not None:
|
|
69
|
+
commit = _git_output(executable, root, "rev-parse", "--verify", "HEAD").lower()
|
|
70
|
+
if COMMIT_PATTERN.fullmatch(commit):
|
|
71
|
+
status = _git_output(
|
|
72
|
+
executable,
|
|
73
|
+
root,
|
|
74
|
+
"status",
|
|
75
|
+
"--porcelain",
|
|
76
|
+
"--untracked-files=no",
|
|
77
|
+
)
|
|
78
|
+
return commit, bool(status), "git"
|
|
79
|
+
|
|
80
|
+
embedded = _embedded_identity(root / PACKAGE_PATH)
|
|
81
|
+
if embedded is not None:
|
|
82
|
+
return embedded[0], embedded[1], "embedded"
|
|
83
|
+
return "unknown", None, "unknown"
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _git_output(executable: str, root: Path, *arguments: str) -> str:
|
|
87
|
+
try:
|
|
88
|
+
completed = subprocess.run(
|
|
89
|
+
(executable, "-C", str(root), *arguments),
|
|
90
|
+
check=False,
|
|
91
|
+
capture_output=True,
|
|
92
|
+
text=True,
|
|
93
|
+
timeout=5,
|
|
94
|
+
)
|
|
95
|
+
except (OSError, subprocess.SubprocessError):
|
|
96
|
+
return ""
|
|
97
|
+
return completed.stdout.strip() if completed.returncode == 0 else ""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _environment_dirty() -> bool | None:
|
|
101
|
+
value = os.environ.get("LDW_BUILD_DIRTY")
|
|
102
|
+
if value is None:
|
|
103
|
+
return None
|
|
104
|
+
normalized = value.strip().casefold()
|
|
105
|
+
if normalized in {"1", "true", "yes"}:
|
|
106
|
+
return True
|
|
107
|
+
if normalized in {"0", "false", "no"}:
|
|
108
|
+
return False
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _embedded_identity(path: Path) -> tuple[str, bool | None] | None:
|
|
113
|
+
try:
|
|
114
|
+
tree = ast.parse(path.read_text(encoding="utf-8"))
|
|
115
|
+
except (OSError, SyntaxError):
|
|
116
|
+
return None
|
|
117
|
+
values: dict[str, object] = {}
|
|
118
|
+
for statement in tree.body:
|
|
119
|
+
if not isinstance(statement, ast.Assign) or len(statement.targets) != 1:
|
|
120
|
+
continue
|
|
121
|
+
target = statement.targets[0]
|
|
122
|
+
if not isinstance(target, ast.Name) or target.id not in {"SOURCE_COMMIT", "SOURCE_DIRTY"}:
|
|
123
|
+
continue
|
|
124
|
+
try:
|
|
125
|
+
values[target.id] = ast.literal_eval(statement.value)
|
|
126
|
+
except (TypeError, ValueError):
|
|
127
|
+
continue
|
|
128
|
+
commit = values.get("SOURCE_COMMIT")
|
|
129
|
+
dirty = values.get("SOURCE_DIRTY")
|
|
130
|
+
if not isinstance(commit, str) or not COMMIT_PATTERN.fullmatch(commit):
|
|
131
|
+
return None
|
|
132
|
+
return commit, dirty if isinstance(dirty, bool) else None
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Local DevOps Workbench."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
6
|
+
from typing import NamedTuple
|
|
7
|
+
|
|
8
|
+
from local_devops_workbench._build_info import BUILD_ID as _BUILD_ID
|
|
9
|
+
from local_devops_workbench._build_info import SOURCE_COMMIT as _SOURCE_COMMIT
|
|
10
|
+
from local_devops_workbench._build_info import SOURCE_DIRTY as _SOURCE_DIRTY
|
|
11
|
+
from local_devops_workbench._build_info import SOURCE_KIND as _SOURCE_KIND
|
|
12
|
+
|
|
13
|
+
# ldw-core is installed alone or under the local-devops-workbench meta-distribution.
|
|
14
|
+
try:
|
|
15
|
+
__version__ = version("ldw-core")
|
|
16
|
+
except PackageNotFoundError: # pragma: no cover - source tree without an installed distribution
|
|
17
|
+
__version__ = "0+unknown"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class BuildProvenance(NamedTuple):
|
|
21
|
+
build_id: str
|
|
22
|
+
source_commit: str
|
|
23
|
+
source_kind: str
|
|
24
|
+
source_dirty: bool | None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def build_provenance() -> BuildProvenance:
|
|
28
|
+
return BuildProvenance(_BUILD_ID, _SOURCE_COMMIT, _SOURCE_KIND, _SOURCE_DIRTY)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def version_summary() -> str:
|
|
32
|
+
provenance = build_provenance()
|
|
33
|
+
if provenance.source_dirty is True:
|
|
34
|
+
state = "dirty"
|
|
35
|
+
elif provenance.source_dirty is False:
|
|
36
|
+
state = "clean"
|
|
37
|
+
else:
|
|
38
|
+
state = "unknown"
|
|
39
|
+
return (
|
|
40
|
+
f"ldw {__version__} (build {provenance.build_id}; "
|
|
41
|
+
f"commit {provenance.source_commit}; source {provenance.source_kind}; state {state})"
|
|
42
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{{- define "local-stack.name" -}}
|
|
2
|
+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
3
|
+
{{- end -}}
|
|
4
|
+
|
|
5
|
+
{{- define "local-stack.labels" -}}
|
|
6
|
+
app.kubernetes.io/part-of: {{ include "local-stack.name" . }}
|
|
7
|
+
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
8
|
+
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
9
|
+
local.devops.workbench/owned: "true"
|
|
10
|
+
{{- end -}}
|
|
11
|
+
|
|
12
|
+
{{- define "local-stack.image" -}}
|
|
13
|
+
{{- $root := index . 0 -}}
|
|
14
|
+
{{- $item := index . 1 -}}
|
|
15
|
+
{{- if $item.imageRef -}}
|
|
16
|
+
{{- $item.imageRef -}}
|
|
17
|
+
{{- else -}}
|
|
18
|
+
{{- $image := index $root.Values.images $item.image -}}
|
|
19
|
+
{{- printf "%s:%s" $image.repository $image.tag -}}
|
|
20
|
+
{{- end -}}
|
|
21
|
+
{{- end -}}
|