hammerkit 1.5.0 → 1.6.0-alpha.1
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/.agents/FEEDBACK.md +74 -0
- package/.agents/skills/before-commit/SKILL.md +101 -0
- package/.agents/skills/do-the-work/SKILL.md +64 -0
- package/.agents/skills/fix-ci/SKILL.md +98 -0
- package/.agents/skills/speckit-git-commit/SKILL.md +53 -0
- package/.agents/skills/speckit-git-feature/SKILL.md +72 -0
- package/.agents/skills/speckit-git-initialize/SKILL.md +54 -0
- package/.agents/skills/speckit-git-remote/SKILL.md +50 -0
- package/.agents/skills/speckit-git-validate/SKILL.md +54 -0
- package/.gitbook.yaml +5 -0
- package/.specify/extensions/.registry +37 -0
- package/.specify/extensions/git/README.md +100 -0
- package/.specify/extensions/git/commands/speckit.git.commit.md +48 -0
- package/.specify/extensions/git/commands/speckit.git.feature.md +67 -0
- package/.specify/extensions/git/commands/speckit.git.initialize.md +49 -0
- package/.specify/extensions/git/commands/speckit.git.remote.md +45 -0
- package/.specify/extensions/git/commands/speckit.git.validate.md +49 -0
- package/.specify/extensions/git/config-template.yml +62 -0
- package/.specify/extensions/git/extension.yml +140 -0
- package/.specify/extensions/git/git-config.yml +62 -0
- package/.specify/extensions.yml +149 -0
- package/.specify/feature.json +3 -0
- package/.specify/init-options.json +10 -0
- package/.specify/integration.json +15 -0
- package/.specify/integrations/claude.manifest.json +16 -0
- package/.specify/integrations/speckit.manifest.json +17 -0
- package/.specify/memory/constitution.md +162 -0
- package/.specify/templates/checklist-template.md +40 -0
- package/.specify/templates/constitution-template.md +50 -0
- package/.specify/templates/plan-template.md +113 -0
- package/.specify/templates/spec-template.md +131 -0
- package/.specify/templates/tasks-template.md +252 -0
- package/.specify/workflows/speckit/workflow.yml +77 -0
- package/.specify/workflows/workflow-registry.json +13 -0
- package/AGENTS.md +94 -0
- package/Dockerfile +3 -3
- package/FOLLOWUPS.md +34 -0
- package/README.md +9 -7
- package/SUMMARY.md +30 -5
- package/VALUES.md +53 -0
- package/build.schema.json +542 -408
- package/dist/cache/auto-pull.spec.js +123 -0
- package/dist/cache/backends/local-cache-backend.js +56 -0
- package/dist/cache/backends/local-cache-backend.spec.js +72 -0
- package/dist/cache/backends/s3-cache-backend.js +124 -0
- package/dist/cache/backends/s3-cache-backend.spec.js +118 -0
- package/dist/cache/cache-backend-registry.js +21 -0
- package/dist/cache/cache-backend-registry.spec.js +22 -0
- package/dist/cache/cache-backend.js +3 -0
- package/dist/cache/resolve-cache.js +60 -0
- package/dist/cache/resolve-cache.spec.js +52 -0
- package/dist/cli.js +112 -82
- package/dist/cli.spec.js +20 -2
- package/dist/console/get-logger.spec.js +23 -0
- package/dist/docker/get-default-platform.spec.js +29 -0
- package/dist/docker/longest-common-prefix.spec.js +26 -0
- package/dist/docker/package.js +283 -0
- package/dist/docker/package.spec.js +145 -0
- package/dist/docker/pull.js +4 -4
- package/dist/docker/remove-container.spec.js +32 -0
- package/dist/docker/stream.js +3 -3
- package/dist/docker/using-container.js +29 -11
- package/dist/docker/using-container.spec.js +90 -0
- package/dist/environment/merge-environment-variables.js +21 -0
- package/dist/environment/merge-environment-variables.spec.js +24 -0
- package/dist/environment/replace-env-variables.js +43 -10
- package/dist/environment/replace-env-variables.spec.js +47 -0
- package/dist/executer/abort.spec.js +18 -0
- package/dist/executer/await-completed-dependencies.js +56 -0
- package/dist/executer/cache-metadata.js +11 -0
- package/dist/executer/check-readiness.js +1 -1
- package/dist/{planner/work-node-port.js → executer/container-bind.js} +1 -1
- package/dist/executer/docker-service.js +110 -86
- package/dist/executer/docker-task.js +132 -0
- package/dist/executer/environment-mock.js +3 -4
- package/dist/executer/environment-mock.spec.js +22 -0
- package/dist/executer/event-cache.js +60 -127
- package/dist/executer/execute-command.js +4 -3
- package/dist/executer/execute-docker.js +32 -14
- package/dist/executer/execute-work-service.js +61 -0
- package/dist/executer/execute-work-task.js +107 -0
- package/dist/executer/execute-work-tree.js +27 -0
- package/dist/executer/execute.spec.js +14 -10
- package/dist/executer/execution-steps.js +47 -31
- package/dist/executer/get-container-binds.js +19 -0
- package/dist/executer/get-docker-executor.js +12 -12
- package/dist/executer/get-scheduler-down-result.js +12 -0
- package/dist/executer/get-scheduler-execute-result.js +28 -0
- package/dist/executer/get-scheduler-up-result.js +12 -0
- package/dist/executer/get-service-containers.js +14 -0
- package/dist/executer/get-service-containers.spec.js +59 -0
- package/dist/executer/get-service-env-hints.js +35 -0
- package/dist/executer/get-service-env-hints.spec.js +65 -0
- package/dist/executer/kubernetes-service.js +116 -48
- package/dist/executer/label-values.js +29 -46
- package/dist/executer/label-values.spec.js +61 -0
- package/dist/executer/lazy-resolver.js +16 -0
- package/dist/executer/lazy-resolver.spec.js +20 -0
- package/dist/executer/local-task.js +44 -0
- package/dist/executer/process-manager.js +16 -70
- package/dist/executer/process-manager.spec.js +39 -76
- package/dist/executer/reset-work-tree.js +30 -0
- package/dist/executer/scheduler/check-for-loop.js +17 -7
- package/dist/executer/scheduler/{scheduler-state.js → dependency-state.js} +1 -1
- package/dist/executer/scheduler/enqueue-next.js +83 -19
- package/dist/executer/scheduler/enqueue-next.spec.js +136 -0
- package/dist/executer/scheduler/{node-state.js → need-state.js} +1 -1
- package/dist/{parser/build-file.js → executer/scheduler/task-state.js} +1 -1
- package/dist/executer/set-user-permission.js +1 -1
- package/dist/executer/state-resolver.js +61 -0
- package/dist/executer/state-resolver.spec.js +37 -0
- package/dist/executer/state.js +37 -31
- package/dist/executer/state.spec.js +66 -0
- package/dist/executer/states.spec.js +14 -0
- package/dist/executer/watch-loop.js +68 -0
- package/dist/executer/watch-state-key.js +44 -0
- package/dist/executer/work-scope.js +1 -5
- package/dist/file/get-file-context.js +24 -3
- package/dist/file/get-file-context.spec.js +178 -0
- package/dist/file/move-files.js +2 -2
- package/dist/file/move-files.spec.js +48 -0
- package/dist/index.js +7 -8
- package/dist/json-schema.js +12 -0
- package/dist/kubernetes/apply.js +34 -0
- package/dist/kubernetes/await-running-state.js +71 -0
- package/dist/kubernetes/ensure-http-route.js +53 -0
- package/dist/kubernetes/ensure-http-route.spec.js +70 -0
- package/dist/kubernetes/ensure-ingress.js +54 -0
- package/dist/kubernetes/ensure-kubernetes-deployment-exists.js +105 -0
- package/dist/kubernetes/ensure-kubernetes-persistent-volume-claim-exists.js +40 -0
- package/dist/kubernetes/ensure-kubernetes-service-exists.js +36 -0
- package/dist/kubernetes/ensure-namespace.js +43 -0
- package/dist/kubernetes/ensure-namespace.spec.js +39 -0
- package/dist/kubernetes/ensure-persistent-data.js +158 -0
- package/dist/kubernetes/get-service-ip.js +11 -0
- package/dist/kubernetes/kubernetes-instance.js +48 -0
- package/dist/kubernetes/remove-persistent-data.js +19 -0
- package/dist/kubernetes/resolve-pod-name.js +42 -0
- package/dist/kubernetes/resolve-pod-name.spec.js +81 -0
- package/dist/kubernetes/resources.js +12 -0
- package/dist/kubernetes/restore-kubernetes-data.js +42 -0
- package/dist/kubernetes/store-kubernetes-data.js +39 -0
- package/dist/kubernetes/volumes.js +64 -0
- package/dist/log.js +69 -69
- package/dist/log.spec.js +131 -0
- package/dist/logging/grouped-logger.js +17 -15
- package/dist/logging/grouped-logger.spec.js +84 -0
- package/dist/logging/interactive-logger.js +1 -1
- package/dist/logging/interactive-logger.spec.js +57 -0
- package/dist/logging/live-logger.js +2 -2
- package/dist/logging/live-logger.spec.js +37 -0
- package/dist/logging/loggers.spec.js +154 -0
- package/dist/optimizer/calculate-checksum.spec.js +34 -0
- package/dist/optimizer/get-cache-directory.js +6 -6
- package/dist/optimizer/get-cache-directory.spec.js +59 -0
- package/dist/optimizer/get-work-cache-stats.js +53 -0
- package/dist/optimizer/get-work-cache-stats.spec.js +79 -0
- package/dist/{parser/build-file-task.js → optimizer/work-cache-stats.js} +1 -1
- package/dist/optimizer/work-task-cache-description.js +25 -0
- package/dist/optimizer/work-task-cache-description.spec.js +45 -0
- package/dist/parser/default-build-file.js +14 -7
- package/dist/parser/default-build-file.spec.js +48 -0
- package/dist/parser/parse-label-arguments.spec.js +27 -0
- package/dist/parser/read-build-file.js +2 -13
- package/dist/parser/read-build-file.spec.js +89 -0
- package/dist/parser/read-env-file.js +4 -5
- package/dist/parser/read-env-file.spec.js +42 -0
- package/dist/planner/utils/append-work-dependencies.js +55 -0
- package/dist/planner/utils/append-work-environment.js +22 -0
- package/dist/planner/utils/append-work-needs.js +18 -0
- package/dist/planner/utils/append-work-service.js +107 -0
- package/dist/planner/utils/append-work-service.spec.js +71 -0
- package/dist/planner/utils/append-work-task.js +81 -0
- package/dist/planner/utils/get-container-user.js +14 -0
- package/dist/planner/utils/get-container-user.spec.js +30 -0
- package/dist/planner/utils/get-default-kube-config.js +10 -0
- package/dist/planner/utils/get-default-kube-config.spec.js +11 -0
- package/dist/planner/utils/get-work-runtime.js +44 -0
- package/dist/planner/utils/normalize-path.js +1 -1
- package/dist/planner/utils/normalize-path.spec.js +24 -0
- package/dist/planner/utils/parse-work-command.js +80 -0
- package/dist/planner/utils/parse-work-command.spec.js +21 -0
- package/dist/planner/utils/parse-work-generate.js +38 -0
- package/dist/planner/utils/parse-work-generate.spec.js +45 -0
- package/dist/planner/utils/{parse-work-node-mount.js → parse-work-mount.js} +10 -7
- package/dist/planner/utils/{parse-work-node-mount.spec.js → parse-work-mount.spec.js} +14 -11
- package/dist/planner/utils/parse-work-mounts.js +13 -0
- package/dist/planner/utils/parse-work-mounts.spec.js +19 -0
- package/dist/planner/utils/{parse-work-node-port.js → parse-work-port.js} +11 -8
- package/dist/planner/utils/parse-work-port.spec.js +24 -0
- package/dist/planner/utils/parse-work-ports.js +10 -0
- package/dist/planner/utils/parse-work-ports.spec.js +24 -0
- package/dist/planner/utils/parse-work-source.js +72 -0
- package/dist/planner/utils/parse-work-source.spec.js +58 -0
- package/dist/planner/utils/parse-work-volume.js +45 -0
- package/dist/planner/utils/parse-work-volume.spec.js +18 -0
- package/dist/planner/utils/plan-work-tasks.js +41 -0
- package/dist/planner/utils/plan-work-tasks.spec.js +30 -0
- package/dist/planner/utils/plan-work-volume.js +1 -0
- package/dist/planner/utils/plan-work-volume.spec.js +33 -0
- package/dist/planner/utils/split-name.js +2 -2
- package/dist/planner/utils/split-name.spec.js +16 -0
- package/dist/planner/utils/template-value.js +1 -2
- package/dist/planner/utils/template-value.spec.js +14 -0
- package/dist/planner/validate.js +71 -38
- package/dist/planner/validate.spec.js +251 -0
- package/dist/planner/work-cache-id.js +12 -0
- package/dist/planner/work-cache-id.spec.js +173 -0
- package/dist/planner/work-command.js +3 -0
- package/dist/planner/work-environment.js +3 -0
- package/dist/planner/work-healthcheck.js +3 -0
- package/dist/planner/{work-node-status.js → work-item-status.js} +16 -62
- package/dist/{parser/build-file-service.js → planner/work-item-validation.js} +1 -1
- package/dist/planner/work-item.js +16 -0
- package/dist/{optimizer/work-node-cache-stats.js → planner/work-kubernetes-selector.js} +1 -1
- package/dist/planner/{work-nodes.js → work-port.js} +1 -1
- package/dist/planner/work-runtime-docker.js +224 -0
- package/dist/planner/work-runtime-kubernetes.js +264 -0
- package/dist/planner/work-runtime-local.js +109 -0
- package/dist/planner/work-runtime-local.spec.js +193 -0
- package/dist/planner/work-service-id.js +15 -5
- package/dist/planner/work-source.js +3 -0
- package/dist/planner/work-task.js +8 -0
- package/dist/program-commands.spec.js +84 -0
- package/dist/program.js +219 -73
- package/dist/program.spec.js +34 -11
- package/dist/run-program.js +28 -0
- package/dist/{executer/process.js → runtime/runtime.js} +1 -1
- package/dist/schema/build-file-base-task-schema.js +27 -0
- package/dist/schema/build-file-container-service-schema.js +28 -0
- package/dist/schema/build-file-container-task-schema.js +13 -0
- package/dist/schema/build-file-environment-schema-ingress.js +14 -0
- package/dist/schema/build-file-environment-schema.js +23 -0
- package/dist/schema/build-file-kubernetes-service-schema.js +17 -0
- package/dist/schema/build-file-kubernetes-service-selector-schema.js +9 -0
- package/dist/schema/build-file-local-platform-schema.js +9 -0
- package/dist/schema/build-file-local-task-schema.js +12 -0
- package/dist/schema/build-file-need-schema.js +12 -0
- package/dist/schema/build-file-schema.js +23 -0
- package/dist/schema/build-file-schema.spec.js +61 -0
- package/dist/schema/build-file-service-container-healthcheck.js +8 -0
- package/dist/schema/build-file-service-schema.js +15 -0
- package/dist/schema/build-file-task-command-schema.js +12 -0
- package/dist/schema/build-file-task-schema.js +12 -0
- package/dist/schema/build-file-volume-schema.js +14 -0
- package/dist/schema/cache-schema.js +31 -0
- package/dist/schema/doc-build-files.spec.js +223 -0
- package/dist/schema/envs-schema.js +6 -0
- package/dist/schema/labels-schema.js +6 -0
- package/dist/schema/parse-context.js +3 -0
- package/dist/schema/parse-error.js +12 -0
- package/dist/schema/parse-error.spec.js +18 -0
- package/dist/schema/reference-parser.js +209 -0
- package/dist/schema/reference-parser.spec.js +83 -0
- package/dist/schema/schema-parser.js +66 -0
- package/dist/schema/schema-parser.spec.js +80 -0
- package/dist/schema/type-guards.spec.js +23 -0
- package/dist/schema/work-scope-parser.js +77 -0
- package/dist/schema/work-scope-parser.spec.js +66 -0
- package/dist/service/update-service-status.js +11 -0
- package/dist/service/update-service-status.spec.js +27 -0
- package/dist/testing/ensure-local-registry.js +134 -0
- package/dist/testing/example-test-suite.js +16 -18
- package/dist/testing/expect.js +46 -22
- package/dist/testing/http-get.js +21 -0
- package/dist/testing/integration/cache.spec.js +13 -14
- package/dist/testing/integration/cancellation.spec.js +14 -9
- package/dist/testing/integration/clean.spec.js +14 -11
- package/dist/testing/integration/cmd.spec.js +1 -1
- package/dist/testing/integration/concurrency.spec.js +3 -3
- package/dist/testing/integration/docker-package-registry.spec.js +44 -0
- package/dist/testing/integration/docker-service-crash.spec.js +36 -0
- package/dist/testing/integration/docker.spec.js +4 -3
- package/dist/testing/integration/env.spec.js +9 -8
- package/dist/testing/integration/environment.spec.js +97 -0
- package/dist/testing/integration/error.spec.js +5 -4
- package/dist/testing/integration/export.spec.js +22 -0
- package/dist/testing/integration/extend.spec.js +9 -12
- package/dist/testing/integration/glob.spec.js +12 -20
- package/dist/testing/integration/include.spec.js +3 -3
- package/dist/testing/integration/invalid.spec.js +2 -3
- package/dist/testing/integration/invalid_loop.spec.js +49 -6
- package/dist/testing/integration/k8s-state-cache.spec.js +41 -0
- package/dist/testing/integration/kubernetes-service.spec.js +148 -0
- package/dist/testing/integration/kubernetes.spec.js +93 -9
- package/dist/testing/integration/labels.spec.js +6 -11
- package/dist/testing/integration/local.spec.js +1 -1
- package/dist/testing/integration/monorepo.spec.js +4 -4
- package/dist/testing/integration/multi-line.spec.js +3 -3
- package/dist/testing/integration/reference.spec.js +4 -5
- package/dist/testing/integration/services.spec.js +22 -4
- package/dist/testing/integration/store.spec.js +15 -16
- package/dist/testing/integration/unknown.spec.js +20 -18
- package/dist/testing/integration/validate.spec.js +143 -26
- package/dist/testing/integration/watch-dependency.spec.js +11 -8
- package/dist/testing/integration/watch.spec.js +15 -16
- package/dist/testing/requires-kubernetes.js +18 -0
- package/dist/testing/requires-linux-containers.js +18 -0
- package/dist/testing/requires-windows-containers.js +18 -0
- package/dist/testing/test-case.js +75 -0
- package/dist/testing/test-streams.js +28 -0
- package/dist/testing/testing-timeout.js +32 -0
- package/dist/utils/abort-event.js +10 -4
- package/dist/utils/abort-event.spec.js +46 -0
- package/dist/utils/buffer-context.js +44 -0
- package/dist/utils/buffer-context.spec.js +38 -0
- package/dist/utils/ci.spec.js +53 -0
- package/dist/utils/emitter.spec.js +34 -0
- package/dist/utils/empty-writable.spec.js +18 -0
- package/dist/utils/environment-config.js +4 -1
- package/dist/utils/environment-config.spec.js +26 -0
- package/dist/utils/fail-never.spec.js +9 -0
- package/dist/version.js +9 -0
- package/dist/version.spec.js +12 -0
- package/package.json +41 -23
- package/specs/build-file/caches/spec.md +114 -0
- package/specs/build-file/environment-variables/spec.md +82 -0
- package/specs/build-file/includes/spec.md +60 -0
- package/specs/build-file/references/spec.md +56 -0
- package/specs/build-file/spec.md +62 -0
- package/specs/cli/clean/spec.md +85 -0
- package/specs/cli/down/spec.md +85 -0
- package/specs/cli/execute/spec.md +101 -0
- package/specs/cli/init/spec.md +64 -0
- package/specs/cli/ls/spec.md +66 -0
- package/specs/cli/package/spec.md +110 -0
- package/specs/cli/spec.md +73 -0
- package/specs/cli/store-restore/spec.md +74 -0
- package/specs/cli/up/spec.md +80 -0
- package/specs/cli/validate/spec.md +70 -0
- package/specs/labels/spec.md +91 -0
- package/specs/service/container/spec.md +120 -0
- package/specs/service/kubernetes/spec.md +97 -0
- package/specs/service/spec.md +105 -0
- package/specs/task/caching/spec.md +107 -0
- package/specs/task/container/spec.md +118 -0
- package/specs/task/dependencies/spec.md +70 -0
- package/specs/task/extending/spec.md +74 -0
- package/specs/task/kubernetes/spec.md +125 -0
- package/specs/task/needs/spec.md +59 -0
- package/specs/task/spec.md +87 -0
- package/specs/task/watching/spec.md +69 -0
- package/dist/console/console-context-mock.js +0 -14
- package/dist/environment/get-process-env.js +0 -15
- package/dist/executer/create-scheduler-state.js +0 -32
- package/dist/executer/docker-node.js +0 -123
- package/dist/executer/hierarchy-scheduler.js +0 -94
- package/dist/executer/local-node.js +0 -57
- package/dist/executer/schedule.js +0 -137
- package/dist/executer/start-node.js +0 -67
- package/dist/executer/watch-node.js +0 -56
- package/dist/executer/watch-service.js +0 -54
- package/dist/file/get-file-context-mock.js +0 -187
- package/dist/file/get-file-context-mock.spec.js +0 -56
- package/dist/get-work-context.js +0 -29
- package/dist/optimizer/get-work-node-cache-stats.js +0 -104
- package/dist/optimizer/read-work-node-cache.js +0 -19
- package/dist/optimizer/work-node-cache-description.js +0 -32
- package/dist/optimizer/write-work-node-cache.js +0 -21
- package/dist/parser/build-file-task-command.js +0 -3
- package/dist/parser/build-file-task-platform.js +0 -3
- package/dist/parser/build-file-task-source.js +0 -3
- package/dist/parser/get-build-file.js +0 -9
- package/dist/parser/parse-boolean.js +0 -29
- package/dist/parser/parse-boolean.spec.js +0 -48
- package/dist/parser/parse-build-file-references.js +0 -35
- package/dist/parser/parse-build-file-services.js +0 -58
- package/dist/parser/parse-build-file-task-command.js +0 -36
- package/dist/parser/parse-build-file-task-source.js +0 -63
- package/dist/parser/parse-build-file.js +0 -125
- package/dist/parser/parse-context.js +0 -13
- package/dist/parser/parse-envs.js +0 -29
- package/dist/parser/parse-healthcheck.js +0 -28
- package/dist/parser/parse-service-selector.js +0 -39
- package/dist/parser/parse-string-array.js +0 -20
- package/dist/parser/parse-string-map.js +0 -30
- package/dist/parser/parse-string.js +0 -20
- package/dist/planner/utils/get-container-mounts.js +0 -24
- package/dist/planner/utils/parse-work-service-volume.js +0 -23
- package/dist/planner/utils/plan-work-command.js +0 -21
- package/dist/planner/utils/plan-work-dependency.js +0 -36
- package/dist/planner/utils/plan-work-node.js +0 -293
- package/dist/planner/utils/plan-work-nodes.js +0 -78
- package/dist/planner/utils/plan-work-tree.js +0 -15
- package/dist/planner/work-context.js +0 -23
- package/dist/planner/work-node-command.js +0 -3
- package/dist/planner/work-node-id.js +0 -12
- package/dist/planner/work-node-id.spec.js +0 -106
- package/dist/planner/work-node-path.js +0 -2
- package/dist/planner/work-node-source.js +0 -3
- package/dist/planner/work-node-validation.js +0 -3
- package/dist/planner/work-node.js +0 -8
- package/dist/planner/work-service-volume.js +0 -3
- package/dist/planner/work-services.js +0 -3
- package/dist/start-watch-processes.js +0 -28
- package/dist/testing/cli.js +0 -73
- package/dist/testing/create-build-file.js +0 -9
- package/dist/testing/get-logger.js +0 -23
- package/dist/testing/get-node.js +0 -12
- package/dist/testing/get-test-context.js +0 -19
- package/dist/testing/integration/program.spec.js +0 -25
- package/dist/testing/lazy.js +0 -17
- package/dist/testing/start-watch-processes.js +0 -29
- package/dist/testing/test-suite-options.js +0 -3
- package/dist/utils/abortable-function.js +0 -71
- package/logs/cache-console.log +0 -0
- package/logs/cache-status.log +0 -6
- package/logs/cache-stout.log +0 -0
- package/logs/cancellation-console.log +0 -0
- package/logs/cancellation-status.log +0 -3
- package/logs/cancellation-stout.log +0 -3
- package/logs/clean-console.log +0 -0
- package/logs/clean-status.log +0 -37
- package/logs/clean-stout.log +0 -95
- package/logs/cmd-console.log +0 -0
- package/logs/cmd-status.log +0 -8
- package/logs/cmd-stout.log +0 -9
- package/logs/concurrency-console.log +0 -0
- package/logs/concurrency-status.log +0 -14
- package/logs/concurrency-stout.log +0 -88
- package/logs/docker-console.log +0 -0
- package/logs/docker-status.log +0 -14
- package/logs/docker-stout.log +0 -39
- package/logs/env-console.log +0 -1
- package/logs/env-status.log +0 -1
- package/logs/env-stout.log +0 -0
- package/logs/error-console.log +0 -0
- package/logs/error-status.log +0 -10
- package/logs/error-stout.log +0 -36
- package/logs/extend-console.log +0 -0
- package/logs/extend-status.log +0 -1
- package/logs/extend-stout.log +0 -0
- package/logs/glob-console.log +0 -28
- package/logs/glob-status.log +0 -23
- package/logs/glob-stout.log +0 -52
- package/logs/hello-world-node-console.log +0 -0
- package/logs/hello-world-node-status.log +0 -37
- package/logs/hello-world-node-stout.log +0 -41
- package/logs/include-console.log +0 -0
- package/logs/include-status.log +0 -3
- package/logs/include-stout.log +0 -0
- package/logs/invalid-console.log +0 -0
- package/logs/invalid-status.log +0 -1
- package/logs/invalid-stout.log +0 -0
- package/logs/invalid_loop-console.log +0 -0
- package/logs/invalid_loop-status.log +0 -1
- package/logs/invalid_loop-stout.log +0 -11
- package/logs/labels-console.log +0 -0
- package/logs/labels-status.log +0 -1
- package/logs/labels-stout.log +0 -0
- package/logs/local-console.log +0 -0
- package/logs/local-status.log +0 -7
- package/logs/local-stout.log +0 -8
- package/logs/monorepo-console.log +0 -0
- package/logs/monorepo-status.log +0 -152
- package/logs/monorepo-stout.log +0 -2354
- package/logs/multi-line-console.log +0 -0
- package/logs/multi-line-status.log +0 -1
- package/logs/multi-line-stout.log +0 -0
- package/logs/reference-console.log +0 -0
- package/logs/reference-status.log +0 -5
- package/logs/reference-stout.log +0 -0
- package/logs/services-console.log +0 -0
- package/logs/services-status.log +0 -129
- package/logs/services-stout.log +0 -639
- package/logs/store-restore-console.log +0 -0
- package/logs/store-restore-status.log +0 -40
- package/logs/store-restore-stout.log +0 -97
- package/logs/unknown-console.log +0 -3
- package/logs/unknown-status.log +0 -1
- package/logs/unknown-stout.log +0 -0
- package/logs/validate-console.log +0 -0
- package/logs/validate-status.log +0 -2
- package/logs/validate-stout.log +0 -0
- package/logs/watch-console.log +0 -0
- package/logs/watch-dependency-console.log +0 -0
- package/logs/watch-dependency-status.log +0 -176
- package/logs/watch-dependency-stout.log +0 -779
- package/logs/watch-status.log +0 -100
- package/logs/watch-stout.log +0 -349
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.watchService = void 0;
|
|
4
|
-
const get_work_node_cache_stats_1 = require("../optimizer/get-work-node-cache-stats");
|
|
5
|
-
const debouncer_1 = require("../utils/debouncer");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const abort_event_1 = require("../utils/abort-event");
|
|
8
|
-
function watchService(service, state, processManager, environment) {
|
|
9
|
-
return async (abort) => {
|
|
10
|
-
let currentState = await (0, get_work_node_cache_stats_1.getServiceNodeCacheStats)(service, environment);
|
|
11
|
-
const status = environment.status.service(service);
|
|
12
|
-
const debouncer = new debouncer_1.Debouncer(async () => {
|
|
13
|
-
if (environment.abortCtrl.signal.aborted) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const newStats = await (0, get_work_node_cache_stats_1.getServiceNodeCacheStats)(service, environment);
|
|
17
|
-
const currentFileState = (0, get_work_node_cache_stats_1.getCacheState)(status, { name: service.name, caching: state.current.cacheMethod }, currentState, newStats);
|
|
18
|
-
currentState = newStats;
|
|
19
|
-
const currentServiceState = state.current.service[service.id];
|
|
20
|
-
if (currentServiceState.stateKey === currentFileState.stateKey) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
status.write('debug', `source changed for service ${service.name}, restart process`);
|
|
24
|
-
state.patchService({
|
|
25
|
-
type: 'pending',
|
|
26
|
-
service,
|
|
27
|
-
stateKey: currentFileState.stateKey,
|
|
28
|
-
});
|
|
29
|
-
}, 100);
|
|
30
|
-
const fileWatchers = [];
|
|
31
|
-
const mounts = [];
|
|
32
|
-
for (const mount of service.mounts) {
|
|
33
|
-
status.write('debug', `watch ${mount.localPath} mount`);
|
|
34
|
-
const watcher = environment.file.watch(mount.localPath, async (fileName) => {
|
|
35
|
-
const absoluteFileName = (0, path_1.join)(mount.localPath, fileName);
|
|
36
|
-
status.write('debug', `source ${absoluteFileName} change for watched service ${service.name}`);
|
|
37
|
-
debouncer.bounce();
|
|
38
|
-
});
|
|
39
|
-
mounts.push(mount.localPath);
|
|
40
|
-
fileWatchers.push(watcher);
|
|
41
|
-
}
|
|
42
|
-
await (0, abort_event_1.waitOnAbort)(abort.signal);
|
|
43
|
-
debouncer.clear();
|
|
44
|
-
for (const watcher of fileWatchers) {
|
|
45
|
-
watcher.close();
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
type: 'service-watch-canceled',
|
|
49
|
-
service,
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
exports.watchService = watchService;
|
|
54
|
-
//# sourceMappingURL=watch-service.js.map
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFileContextMock = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
function getFileContextMock() {
|
|
6
|
-
const rootNode = {
|
|
7
|
-
nodes: {},
|
|
8
|
-
type: 'directory',
|
|
9
|
-
listeners: [],
|
|
10
|
-
};
|
|
11
|
-
function getDirectoryNode(path) {
|
|
12
|
-
let currentNode = rootNode;
|
|
13
|
-
for (let i = 0; i < path.length; i++) {
|
|
14
|
-
const nextNode = currentNode.nodes[path[i]];
|
|
15
|
-
if (!nextNode || nextNode.type === 'file') {
|
|
16
|
-
throw new Error(`unable to find directory ${path.slice(0, i).join(path_1.sep)}`);
|
|
17
|
-
}
|
|
18
|
-
currentNode = nextNode;
|
|
19
|
-
}
|
|
20
|
-
return currentNode;
|
|
21
|
-
}
|
|
22
|
-
function getFileNode(path) {
|
|
23
|
-
const lastPart = path[path.length - 1];
|
|
24
|
-
const parentNode = getDirectoryNode(path.slice(0, path.length - 1));
|
|
25
|
-
const node = parentNode.nodes[lastPart];
|
|
26
|
-
if (!node || node.type === 'directory') {
|
|
27
|
-
throw new Error(`unable to find file ${path}`);
|
|
28
|
-
}
|
|
29
|
-
return node;
|
|
30
|
-
}
|
|
31
|
-
function getNode(path) {
|
|
32
|
-
const lastPart = path[path.length - 1];
|
|
33
|
-
const parentNode = getDirectoryNode(path.slice(0, path.length - 1));
|
|
34
|
-
const node = parentNode.nodes[lastPart];
|
|
35
|
-
if (!node) {
|
|
36
|
-
throw new Error(`unable to find path ${path}`);
|
|
37
|
-
}
|
|
38
|
-
return node;
|
|
39
|
-
}
|
|
40
|
-
function cloneNode(node) {
|
|
41
|
-
if (node.type === 'directory') {
|
|
42
|
-
return {
|
|
43
|
-
nodes: Object.keys(node.nodes).reduce((map, nodeKey) => {
|
|
44
|
-
map[nodeKey] = cloneNode(node.nodes[nodeKey]);
|
|
45
|
-
return map;
|
|
46
|
-
}, {}),
|
|
47
|
-
listeners: [],
|
|
48
|
-
type: 'directory',
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return {
|
|
53
|
-
type: 'file',
|
|
54
|
-
content: node.content,
|
|
55
|
-
fileName: node.fileName,
|
|
56
|
-
listeners: [],
|
|
57
|
-
lastAccess: new Date(),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function notifyChange(path, fileName) {
|
|
62
|
-
let currentNode = rootNode;
|
|
63
|
-
for (let i = 0; i < path.length; i++) {
|
|
64
|
-
for (const listener of currentNode.listeners) {
|
|
65
|
-
listener.callback(fileName);
|
|
66
|
-
}
|
|
67
|
-
const nextNode = currentNode.nodes[path[i]];
|
|
68
|
-
if (nextNode.type === 'directory') {
|
|
69
|
-
currentNode = nextNode;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
for (const listener of nextNode.listeners) {
|
|
73
|
-
listener.callback(fileName);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
async appendFile(path, content) {
|
|
80
|
-
const parts = path.split(path_1.sep);
|
|
81
|
-
const fileNode = getFileNode(parts);
|
|
82
|
-
fileNode.content += content;
|
|
83
|
-
fileNode.lastAccess = new Date();
|
|
84
|
-
notifyChange(parts, path);
|
|
85
|
-
},
|
|
86
|
-
async createDirectory(path) {
|
|
87
|
-
const parts = path.split(path_1.sep);
|
|
88
|
-
let currentNode = rootNode;
|
|
89
|
-
for (let i = 0; i < parts.length; i++) {
|
|
90
|
-
const nextNode = currentNode.nodes[parts[i]];
|
|
91
|
-
if (!nextNode) {
|
|
92
|
-
currentNode = currentNode.nodes[parts[i]] = {
|
|
93
|
-
type: 'directory',
|
|
94
|
-
nodes: {},
|
|
95
|
-
listeners: [],
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
else if (nextNode.type === 'file') {
|
|
99
|
-
throw new Error(`unable to create directory ${parts.slice(0, i).join(path_1.sep)} because file already exists`);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
currentNode = nextNode;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
notifyChange(parts, path);
|
|
106
|
-
return path;
|
|
107
|
-
},
|
|
108
|
-
async copy(source, destination) {
|
|
109
|
-
const destinationPath = destination.split(path_1.sep);
|
|
110
|
-
const sourcePath = source.split(path_1.sep);
|
|
111
|
-
const lastPart = destinationPath[destinationPath.length - 1];
|
|
112
|
-
const sourceNode = getNode(sourcePath);
|
|
113
|
-
const parentNode = getDirectoryNode(destinationPath.slice(0, destinationPath.length - 1));
|
|
114
|
-
parentNode.nodes[lastPart] = cloneNode(sourceNode);
|
|
115
|
-
notifyChange(destinationPath, destination);
|
|
116
|
-
},
|
|
117
|
-
async writeFile(path, content) {
|
|
118
|
-
const parts = path.split(path_1.sep);
|
|
119
|
-
const fileName = parts[parts.length - 1];
|
|
120
|
-
const directoryNode = getDirectoryNode(parts.slice(0, parts.length - 1));
|
|
121
|
-
directoryNode.nodes[fileName] = { type: 'file', content, lastAccess: new Date(), fileName: path, listeners: [] };
|
|
122
|
-
notifyChange(parts, path);
|
|
123
|
-
},
|
|
124
|
-
async remove(path) {
|
|
125
|
-
const parts = path.split(path_1.sep);
|
|
126
|
-
let currentNode = rootNode;
|
|
127
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
128
|
-
const nextNode = currentNode.nodes[parts[i]];
|
|
129
|
-
if (!nextNode || nextNode.type === 'file') {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
currentNode = nextNode;
|
|
133
|
-
}
|
|
134
|
-
const lastPart = parts[parts.length - 1];
|
|
135
|
-
delete currentNode.nodes[lastPart];
|
|
136
|
-
notifyChange(parts, path);
|
|
137
|
-
},
|
|
138
|
-
watch(path, callback) {
|
|
139
|
-
const node = getNode(path.split(path_1.sep));
|
|
140
|
-
const listener = { callback };
|
|
141
|
-
node.listeners.push(listener);
|
|
142
|
-
return {
|
|
143
|
-
close() {
|
|
144
|
-
const index = node.listeners.indexOf(listener);
|
|
145
|
-
if (index >= 0) {
|
|
146
|
-
node.listeners.splice(index);
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
},
|
|
151
|
-
async exists(path) {
|
|
152
|
-
const parts = path.split(path_1.sep);
|
|
153
|
-
let currentNode = rootNode;
|
|
154
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
155
|
-
const nextNode = currentNode.nodes[parts[i]];
|
|
156
|
-
if (!nextNode || nextNode.type === 'file') {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
currentNode = nextNode;
|
|
160
|
-
}
|
|
161
|
-
return !!currentNode.nodes[parts[parts.length - 1]];
|
|
162
|
-
},
|
|
163
|
-
async listFiles(path) {
|
|
164
|
-
const directoryNode = getDirectoryNode(path.split(path_1.sep));
|
|
165
|
-
return Object.keys(directoryNode.nodes);
|
|
166
|
-
},
|
|
167
|
-
async stats(path) {
|
|
168
|
-
const node = getNode(path.split(path_1.sep));
|
|
169
|
-
if (node.type === 'file') {
|
|
170
|
-
return { lastModified: node.lastAccess.getTime(), type: 'file' };
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
return { type: 'directory' };
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
async read(path) {
|
|
177
|
-
const fileNode = getFileNode(path.split(path_1.sep));
|
|
178
|
-
return fileNode.content;
|
|
179
|
-
},
|
|
180
|
-
async clear() {
|
|
181
|
-
rootNode.listeners = [];
|
|
182
|
-
rootNode.nodes = {};
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
exports.getFileContextMock = getFileContextMock;
|
|
187
|
-
//# sourceMappingURL=get-file-context-mock.js.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const get_file_context_mock_1 = require("./get-file-context-mock");
|
|
4
|
-
describe('file/get-file-context-mock', () => {
|
|
5
|
-
it('should create directory', async () => {
|
|
6
|
-
const ctx = (0, get_file_context_mock_1.getFileContextMock)();
|
|
7
|
-
await ctx.createDirectory('/home/user/repo');
|
|
8
|
-
expect(await ctx.listFiles('/home/user')).toEqual(['repo']);
|
|
9
|
-
});
|
|
10
|
-
it('should list files', async () => {
|
|
11
|
-
const ctx = (0, get_file_context_mock_1.getFileContextMock)();
|
|
12
|
-
await ctx.createDirectory('/home/user/repo');
|
|
13
|
-
await ctx.writeFile('/home/user/test', 'abc');
|
|
14
|
-
expect(await ctx.listFiles('/home/user')).toEqual(['repo', 'test']);
|
|
15
|
-
});
|
|
16
|
-
it('should emit listener if file below gets changed', async () => {
|
|
17
|
-
const ctx = (0, get_file_context_mock_1.getFileContextMock)();
|
|
18
|
-
await ctx.createDirectory('/home/user/repo');
|
|
19
|
-
await ctx.writeFile('/home/user/test', 'abc');
|
|
20
|
-
await new Promise((resolve) => {
|
|
21
|
-
const watch = ctx.watch('/home/user', (fileName) => {
|
|
22
|
-
expect(fileName).toEqual('/home/user/test');
|
|
23
|
-
watch.close();
|
|
24
|
-
resolve();
|
|
25
|
-
});
|
|
26
|
-
ctx.appendFile('/home/user/test', 'def');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
it('should emit listener if directory below gets created', async () => {
|
|
30
|
-
const ctx = (0, get_file_context_mock_1.getFileContextMock)();
|
|
31
|
-
await ctx.createDirectory('/home/user/repo');
|
|
32
|
-
await new Promise((resolve) => {
|
|
33
|
-
const watch = ctx.watch('/home/user', (fileName) => {
|
|
34
|
-
expect(fileName).toEqual('/home/user/repo/test');
|
|
35
|
-
watch.close();
|
|
36
|
-
resolve();
|
|
37
|
-
});
|
|
38
|
-
ctx.createDirectory('/home/user/repo/test');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it('should not emit listener if directory above gets created', async () => {
|
|
42
|
-
const ctx = (0, get_file_context_mock_1.getFileContextMock)();
|
|
43
|
-
await ctx.createDirectory('/home/user/repo');
|
|
44
|
-
await new Promise((resolve, reject) => {
|
|
45
|
-
const watch = ctx.watch('/home/user', () => {
|
|
46
|
-
watch.close();
|
|
47
|
-
reject();
|
|
48
|
-
});
|
|
49
|
-
ctx.createDirectory('/home/test').then(() => {
|
|
50
|
-
watch.close();
|
|
51
|
-
resolve();
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=get-file-context-mock.spec.js.map
|
package/dist/get-work-context.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkScope = void 0;
|
|
4
|
-
const plan_work_tree_1 = require("./planner/utils/plan-work-tree");
|
|
5
|
-
const plan_work_nodes_1 = require("./planner/utils/plan-work-nodes");
|
|
6
|
-
const work_scope_1 = require("./executer/work-scope");
|
|
7
|
-
const replace_env_variables_1 = require("./environment/replace-env-variables");
|
|
8
|
-
const work_service_1 = require("./planner/work-service");
|
|
9
|
-
const work_node_1 = require("./planner/work-node");
|
|
10
|
-
const get_process_env_1 = require("./environment/get-process-env");
|
|
11
|
-
function getWorkScope(buildFile, contextFilter, environment) {
|
|
12
|
-
const tree = (0, work_scope_1.isContextTaskFilter)(contextFilter)
|
|
13
|
-
? (0, plan_work_tree_1.planWorkTree)(buildFile, { taskName: contextFilter.taskName })
|
|
14
|
-
: (0, plan_work_nodes_1.planWorkNodes)(buildFile, contextFilter);
|
|
15
|
-
for (const node of (0, plan_work_nodes_1.iterateWorkNodes)(tree.nodes)) {
|
|
16
|
-
node.envs = (0, replace_env_variables_1.replaceEnvVariables)(node.envs, environment.processEnvs);
|
|
17
|
-
if (!(0, work_node_1.isContainerWorkNode)(node)) {
|
|
18
|
-
node.envs = (0, get_process_env_1.extendHostVariables)(node.envs, environment);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
for (const service of (0, plan_work_nodes_1.iterateWorkServices)(tree.services)) {
|
|
22
|
-
if ((0, work_service_1.isContainerWorkService)(service)) {
|
|
23
|
-
service.envs = (0, replace_env_variables_1.replaceEnvVariables)(service.envs, environment.processEnvs);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return tree;
|
|
27
|
-
}
|
|
28
|
-
exports.getWorkScope = getWorkScope;
|
|
29
|
-
//# sourceMappingURL=get-work-context.js.map
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStateKey = exports.getCacheState = exports.getWorkNodeCacheStats = exports.getServiceNodeCacheStats = void 0;
|
|
4
|
-
const calculate_checksum_1 = require("./calculate-checksum");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const work_service_1 = require("../planner/work-service");
|
|
7
|
-
const crypto_1 = require("crypto");
|
|
8
|
-
async function addWorkNodeCacheStats(result, cwd, path, matcher, context) {
|
|
9
|
-
const exists = await context.file.exists(path);
|
|
10
|
-
if (!exists) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const stats = await context.file.stats(path);
|
|
14
|
-
if (stats.type === 'file') {
|
|
15
|
-
if (matcher(path)) {
|
|
16
|
-
const checksum = await (0, calculate_checksum_1.calculateChecksum)(context, path);
|
|
17
|
-
result.files[(0, path_1.relative)(cwd, path)] = { lastModified: stats.lastModified, checksum };
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else if (stats.type === 'directory') {
|
|
21
|
-
const files = await context.file.listFiles(path);
|
|
22
|
-
for (const file of files) {
|
|
23
|
-
const subPath = (0, path_1.join)(path, file);
|
|
24
|
-
if (matcher(subPath)) {
|
|
25
|
-
await addWorkNodeCacheStats(result, cwd, (0, path_1.join)(path, file), matcher, context);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
async function addWorkServiceCacheStats(result, path, context) {
|
|
31
|
-
const exists = await context.file.exists(path);
|
|
32
|
-
if (!exists) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const stats = await context.file.stats(path);
|
|
36
|
-
if (stats.type === 'file') {
|
|
37
|
-
const checksum = await (0, calculate_checksum_1.calculateChecksum)(context, path);
|
|
38
|
-
result.files[path] = { lastModified: stats.lastModified, checksum };
|
|
39
|
-
}
|
|
40
|
-
else if (stats.type === 'directory') {
|
|
41
|
-
const files = await context.file.listFiles(path);
|
|
42
|
-
for (const file of files) {
|
|
43
|
-
await addWorkServiceCacheStats(result, (0, path_1.join)(path, file), context);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async function getServiceNodeCacheStats(cache, environment) {
|
|
48
|
-
const result = {
|
|
49
|
-
files: {},
|
|
50
|
-
};
|
|
51
|
-
if ((0, work_service_1.isContainerWorkService)(cache)) {
|
|
52
|
-
for (const mount of cache.mounts) {
|
|
53
|
-
await addWorkServiceCacheStats(result, mount.localPath, environment);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
await addWorkServiceCacheStats(result, cache.kubeconfig, environment);
|
|
58
|
-
}
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
exports.getServiceNodeCacheStats = getServiceNodeCacheStats;
|
|
62
|
-
async function getWorkNodeCacheStats(cache, environment) {
|
|
63
|
-
const result = {
|
|
64
|
-
created: new Date(),
|
|
65
|
-
files: {},
|
|
66
|
-
};
|
|
67
|
-
for (const src of cache.src) {
|
|
68
|
-
await addWorkNodeCacheStats(result, cache.cwd, src.absolutePath, (file) => src.matcher(file, cache.cwd), environment);
|
|
69
|
-
}
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
exports.getWorkNodeCacheStats = getWorkNodeCacheStats;
|
|
73
|
-
function getCacheState(status, node, cache, current) {
|
|
74
|
-
if (cache) {
|
|
75
|
-
for (const key of Object.keys(cache.files)) {
|
|
76
|
-
if ((node.caching === 'checksum' && current.files[key]?.checksum !== cache.files[key].checksum) ||
|
|
77
|
-
(node.caching === 'modify-date' && current.files[key]?.lastModified !== cache.files[key].lastModified)) {
|
|
78
|
-
status.write('debug', node.caching === 'checksum'
|
|
79
|
-
? `${key} changed from checksum ${cache.files[key].checksum} to ${current.files[key]?.checksum}`
|
|
80
|
-
: `${key} changed from last modified ${cache.files[key].lastModified} to ${current.files[key]?.lastModified}`);
|
|
81
|
-
status.write('debug', `${node.name} can't be skipped because ${key} has been modified`);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
stateKey: getStateKey(current, node.caching),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
exports.getCacheState = getCacheState;
|
|
91
|
-
function getStateKey(stats, cacheMethod) {
|
|
92
|
-
const contents = [];
|
|
93
|
-
for (const key of Object.keys(stats.files)) {
|
|
94
|
-
if (cacheMethod === 'checksum') {
|
|
95
|
-
contents.push(`${key}:${stats.files[key].checksum}`);
|
|
96
|
-
}
|
|
97
|
-
else if (cacheMethod === 'modify-date') {
|
|
98
|
-
contents.push(`${key}:${stats.files[key].lastModified}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return (0, crypto_1.createHash)('md5').update(contents.join(',')).digest('hex');
|
|
102
|
-
}
|
|
103
|
-
exports.getStateKey = getStateKey;
|
|
104
|
-
//# sourceMappingURL=get-work-node-cache-stats.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readCache = void 0;
|
|
4
|
-
const get_cache_directory_1 = require("./get-cache-directory");
|
|
5
|
-
async function readCache(node, context) {
|
|
6
|
-
const cacheFile = (0, get_cache_directory_1.getCacheStatsFile)(node.id);
|
|
7
|
-
if (!(await context.file.exists(cacheFile))) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
return JSON.parse(await context.file.read(cacheFile));
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
context.status.task(node).write('error', `unable to read cache ${cacheFile}`);
|
|
15
|
-
}
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
exports.readCache = readCache;
|
|
19
|
-
//# sourceMappingURL=read-work-node-cache.js.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkNodeCacheDescription = void 0;
|
|
4
|
-
const os_1 = require("os");
|
|
5
|
-
function getWorkNodeCacheDescription(task) {
|
|
6
|
-
return {
|
|
7
|
-
shell: task.shell ?? undefined,
|
|
8
|
-
image: task.image ?? undefined,
|
|
9
|
-
platform: task.image ? 'container' : (0, os_1.platform)(),
|
|
10
|
-
generates: task.generates.map((g) => g.path).sort() ?? undefined,
|
|
11
|
-
src: task.src.map((s) => s.relativePath).sort() ?? undefined,
|
|
12
|
-
deps: task.deps.map((d) => d.name).sort() ?? undefined,
|
|
13
|
-
envs: Object.keys(task.envs)
|
|
14
|
-
.sort()
|
|
15
|
-
.reduce((map, key) => {
|
|
16
|
-
map[key] = task.envs[key];
|
|
17
|
-
return map;
|
|
18
|
-
}, {}) ?? undefined,
|
|
19
|
-
cmds: task.cmds.map((c) => {
|
|
20
|
-
if (typeof c === 'string') {
|
|
21
|
-
return { cmd: c, path: '' };
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
return { cmd: c.cmd, path: c.path ?? '' };
|
|
25
|
-
}
|
|
26
|
-
}),
|
|
27
|
-
mounts: task.mounts.sort() ?? undefined,
|
|
28
|
-
cwd: task.cwd,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.getWorkNodeCacheDescription = getWorkNodeCacheDescription;
|
|
32
|
-
//# sourceMappingURL=work-node-cache-description.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeWorkNodeCache = void 0;
|
|
4
|
-
const get_work_node_cache_stats_1 = require("./get-work-node-cache-stats");
|
|
5
|
-
const get_cache_directory_1 = require("./get-cache-directory");
|
|
6
|
-
const work_node_cache_description_1 = require("./work-node-cache-description");
|
|
7
|
-
async function writeWorkNodeCache(node, context) {
|
|
8
|
-
const status = context.status.task(node);
|
|
9
|
-
const cachePath = (0, get_cache_directory_1.getCacheDirectory)(node.id);
|
|
10
|
-
const cacheFile = (0, get_cache_directory_1.getCacheStatsFile)(node.id);
|
|
11
|
-
const cacheDescriptionFile = (0, get_cache_directory_1.getCacheDescriptionFile)(node.id);
|
|
12
|
-
const cache = await (0, get_work_node_cache_stats_1.getWorkNodeCacheStats)(node, context);
|
|
13
|
-
const taskDescription = (0, work_node_cache_description_1.getWorkNodeCacheDescription)(node.plannedTask);
|
|
14
|
-
await context.file.createDirectory(cachePath);
|
|
15
|
-
status.write('debug', `write cache description for ${node.name} to ${cacheDescriptionFile}`);
|
|
16
|
-
await context.file.writeFile(cacheDescriptionFile, JSON.stringify(taskDescription, null, 2));
|
|
17
|
-
status.write('debug', `write file cache for ${node.name} to ${cacheFile}`);
|
|
18
|
-
await context.file.writeFile(cacheFile, JSON.stringify(cache, null, 2));
|
|
19
|
-
}
|
|
20
|
-
exports.writeWorkNodeCache = writeWorkNodeCache;
|
|
21
|
-
//# sourceMappingURL=write-work-node-cache.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBuildFile = void 0;
|
|
4
|
-
const read_build_file_1 = require("./read-build-file");
|
|
5
|
-
function getBuildFile(fileName, context) {
|
|
6
|
-
return (0, read_build_file_1.readBuildFile)(fileName, {}, context);
|
|
7
|
-
}
|
|
8
|
-
exports.getBuildFile = getBuildFile;
|
|
9
|
-
//# sourceMappingURL=get-build-file.js.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseBoolean = void 0;
|
|
4
|
-
const parse_context_1 = require("./parse-context");
|
|
5
|
-
function parseBoolean(ctx, name, value, optional) {
|
|
6
|
-
if (value == null || value === undefined) {
|
|
7
|
-
if (optional) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
throw new Error(`${(0, parse_context_1.parseContextDescription)(ctx)} -> ${name} is missing boolean`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
if (typeof value === 'boolean') {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
else if (typeof value === 'string') {
|
|
18
|
-
const lowerCaseValue = value.toLowerCase();
|
|
19
|
-
if (lowerCaseValue === 'true') {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
else if (lowerCaseValue === 'false') {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
throw new Error(`${(0, parse_context_1.parseContextDescription)(ctx)} -> ${name} invalid boolean "${value}"`);
|
|
27
|
-
}
|
|
28
|
-
exports.parseBoolean = parseBoolean;
|
|
29
|
-
//# sourceMappingURL=parse-boolean.js.map
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const parse_boolean_1 = require("./parse-boolean");
|
|
4
|
-
describe('parse-boolean', () => {
|
|
5
|
-
const context = { type: 'task', name: 'example', fileName: '' };
|
|
6
|
-
it('should parse true', () => {
|
|
7
|
-
const value = (0, parse_boolean_1.parseBoolean)(context, 'watch', true, false);
|
|
8
|
-
expect(value).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
it('should parse "true"', () => {
|
|
11
|
-
const value = (0, parse_boolean_1.parseBoolean)(context, 'watch', 'true', false);
|
|
12
|
-
expect(value).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
it('should parse "TRUE"', () => {
|
|
15
|
-
const value = (0, parse_boolean_1.parseBoolean)(context, 'watch', 'TRUE', false);
|
|
16
|
-
expect(value).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
it('should parse false', () => {
|
|
19
|
-
const value = (0, parse_boolean_1.parseBoolean)(context, 'watch', false, false);
|
|
20
|
-
expect(value).toBeFalsy();
|
|
21
|
-
});
|
|
22
|
-
it('should parse "false"', () => {
|
|
23
|
-
const value = (0, parse_boolean_1.parseBoolean)(context, 'watch', 'false', false);
|
|
24
|
-
expect(value).toBeFalsy();
|
|
25
|
-
});
|
|
26
|
-
it('should parse "FALSE"', () => {
|
|
27
|
-
const value = (0, parse_boolean_1.parseBoolean)(context, 'watch', 'FALSE', false);
|
|
28
|
-
expect(value).toBeFalsy();
|
|
29
|
-
});
|
|
30
|
-
it('should not allow 2', () => {
|
|
31
|
-
expect(() => (0, parse_boolean_1.parseBoolean)(context, 'watch', 2, false)).toThrow();
|
|
32
|
-
});
|
|
33
|
-
it('should not allow "test"', () => {
|
|
34
|
-
expect(() => (0, parse_boolean_1.parseBoolean)(context, 'watch', 'test', false)).toThrow();
|
|
35
|
-
});
|
|
36
|
-
it('should parse null if optional', () => {
|
|
37
|
-
const value = (0, parse_boolean_1.parseBoolean)(context, 'watch', null, true);
|
|
38
|
-
expect(value).toBeNull();
|
|
39
|
-
});
|
|
40
|
-
it('should parse undefined if optional', () => {
|
|
41
|
-
const value = (0, parse_boolean_1.parseBoolean)(context, 'watch', undefined, true);
|
|
42
|
-
expect(value).toBeNull();
|
|
43
|
-
});
|
|
44
|
-
it('should not allow null if optional', () => {
|
|
45
|
-
expect(() => (0, parse_boolean_1.parseBoolean)(context, 'watch', null, false)).toThrow();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=parse-boolean.spec.js.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseBuildFileReferences = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const read_build_file_1 = require("./read-build-file");
|
|
6
|
-
const default_build_file_1 = require("./default-build-file");
|
|
7
|
-
async function parseBuildFileReferences(type, fileName, files, refs, context) {
|
|
8
|
-
if (!refs) {
|
|
9
|
-
return {};
|
|
10
|
-
}
|
|
11
|
-
if (typeof refs !== 'object') {
|
|
12
|
-
throw new Error(`${fileName} references need to be an object`);
|
|
13
|
-
}
|
|
14
|
-
const result = {};
|
|
15
|
-
for (const [key, value] of Object.entries(refs || {})) {
|
|
16
|
-
const referenceFileName = (0, path_1.join)((0, path_1.dirname)(fileName), value);
|
|
17
|
-
if (!(await context.file.exists(referenceFileName))) {
|
|
18
|
-
throw new Error(`${fileName} ${type} ${key} ${referenceFileName} not found`);
|
|
19
|
-
}
|
|
20
|
-
const stats = await context.file.stats(referenceFileName);
|
|
21
|
-
if (stats.type === 'directory') {
|
|
22
|
-
const defaultReferenceFileName = (0, path_1.join)(referenceFileName, await (0, default_build_file_1.getDefaultBuildFilename)(referenceFileName, context));
|
|
23
|
-
if (!(await context.file.exists(defaultReferenceFileName))) {
|
|
24
|
-
throw new Error(`${fileName} ${type} ${key} ${defaultReferenceFileName} not found in ${referenceFileName}`);
|
|
25
|
-
}
|
|
26
|
-
result[key] = await (0, read_build_file_1.readBuildFile)(defaultReferenceFileName, files, context);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
result[key] = await (0, read_build_file_1.readBuildFile)(referenceFileName, files, context);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
exports.parseBuildFileReferences = parseBuildFileReferences;
|
|
35
|
-
//# sourceMappingURL=parse-build-file-references.js.map
|