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,15 +1,99 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const requires_kubernetes_1 = require("../requires-kubernetes");
|
|
4
|
+
const test_case_1 = require("../test-case");
|
|
5
5
|
describe('kubernetes', () => {
|
|
6
|
-
const suite = (0,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const suite = (0, test_case_1.createTestCase)('kubernetes', {
|
|
7
|
+
'.hammerkit.yaml': {
|
|
8
|
+
services: {
|
|
9
|
+
postgres: {
|
|
10
|
+
image: 'postgres:12-alpine',
|
|
11
|
+
envs: {
|
|
12
|
+
POSTGRES_USER: 'postgres',
|
|
13
|
+
POSTGRES_DB: 'demo',
|
|
14
|
+
POSTGRES_PASSWORD: '123456',
|
|
15
|
+
},
|
|
16
|
+
volumes: ['data:/var/lib/postgresql/data'],
|
|
17
|
+
ports: [':5432'],
|
|
18
|
+
},
|
|
19
|
+
api: {
|
|
20
|
+
image: 'node:16.6.0-alpine',
|
|
21
|
+
deps: ['install'],
|
|
22
|
+
needs: ['postgres'],
|
|
23
|
+
ports: [':3000'],
|
|
24
|
+
labels: {
|
|
25
|
+
app: 'example',
|
|
26
|
+
},
|
|
27
|
+
src: ['index.js'],
|
|
28
|
+
cmd: 'node index.js',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
tasks: {
|
|
32
|
+
install: {
|
|
33
|
+
image: 'node:16.6.0-alpine',
|
|
34
|
+
src: ['package.json'],
|
|
35
|
+
generates: ['node_modules'],
|
|
36
|
+
cmds: ['npm install'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
environments: {
|
|
40
|
+
default: {
|
|
41
|
+
kubernetes: {
|
|
42
|
+
namespace: `hammerkit-k8s-${(process.env.HAMMERKIT_TEST_RUN_ID ?? 'local').slice(0, 40)}`,
|
|
43
|
+
context: process.env.CLUSTER_NAME || 'docker-desktop',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
'index.js': `const { Pool } = require('pg')
|
|
49
|
+
const { createServer } = require('http')
|
|
50
|
+
|
|
51
|
+
const pool = new Pool({
|
|
52
|
+
connectionString: 'postgres://api:123456@postgres:5432/api',
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
pool.on('error', () => {
|
|
56
|
+
console.error('pool has connection error')
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const server = createServer(async function (req, res) {
|
|
60
|
+
let client
|
|
61
|
+
try {
|
|
62
|
+
client = await pool.connect()
|
|
63
|
+
const queryResult = await client.query('SELECT $1::text as message', ['Hello world from PG!'])
|
|
64
|
+
|
|
65
|
+
res.writeHead(200)
|
|
66
|
+
res.end(queryResult.rows[0].message)
|
|
67
|
+
} catch (e) {
|
|
68
|
+
res.writeHead(500)
|
|
69
|
+
res.end(e.message)
|
|
70
|
+
} finally {
|
|
71
|
+
client?.release()
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
process.on('SIGINT', async function () {
|
|
76
|
+
server.close()
|
|
77
|
+
await pool.end()
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
server.listen(3000, () => {
|
|
81
|
+
console.log(\`Server is running on http://0.0.0.0:3000\`)
|
|
82
|
+
})
|
|
83
|
+
`,
|
|
84
|
+
'package.json': `{
|
|
85
|
+
"name": "example-with-service",
|
|
86
|
+
"version": "1.0.0",
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"pg": "^8.7.1"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`,
|
|
13
92
|
});
|
|
93
|
+
it('should create deployment', (0, requires_kubernetes_1.requiresKubernetes)(async () => {
|
|
94
|
+
await suite.cli({}, async (cli) => {
|
|
95
|
+
await cli.runUp({ daemon: true });
|
|
96
|
+
});
|
|
97
|
+
}));
|
|
14
98
|
});
|
|
15
99
|
//# sourceMappingURL=kubernetes.spec.js.map
|
|
@@ -7,41 +7,36 @@ describe('local', () => {
|
|
|
7
7
|
it('should run only run labeled task with app=bar and dependencies', async () => {
|
|
8
8
|
const { cli } = await suite.setup({
|
|
9
9
|
filterLabels: { app: ['bar'] },
|
|
10
|
-
excludeLabels: {},
|
|
11
10
|
});
|
|
12
11
|
expectNodes(cli.ls(), ['bar', 'base']);
|
|
13
12
|
});
|
|
14
13
|
it('should not run labeled task with app=foo and dependencies', async () => {
|
|
15
14
|
const { cli } = await suite.setup({
|
|
16
15
|
filterLabels: { app: ['foo'] },
|
|
17
|
-
excludeLabels: {},
|
|
18
16
|
});
|
|
19
17
|
expectNodes(cli.ls(), ['foo', 'base']);
|
|
20
18
|
});
|
|
21
|
-
it('should exclude foo labeled
|
|
19
|
+
it('should exclude foo labeled tasks', async () => {
|
|
22
20
|
const { cli } = await suite.setup({
|
|
23
|
-
filterLabels: {},
|
|
24
21
|
excludeLabels: { app: ['foo'] },
|
|
25
22
|
});
|
|
26
23
|
expectNodes(cli.ls(), ['bar', 'base']);
|
|
27
24
|
});
|
|
28
|
-
it('should exclude base labeled
|
|
25
|
+
it('should exclude base labeled tasks', async () => {
|
|
29
26
|
const { cli } = await suite.setup({
|
|
30
|
-
filterLabels: {},
|
|
31
27
|
excludeLabels: { app: ['base'] },
|
|
32
28
|
});
|
|
33
29
|
expectNodes(cli.ls(), []);
|
|
34
30
|
});
|
|
35
|
-
it('should run
|
|
31
|
+
it('should run tasks with label app=bar or app=foo', async () => {
|
|
36
32
|
const { cli } = await suite.setup({
|
|
37
33
|
filterLabels: { app: ['foo', 'bar'] },
|
|
38
|
-
excludeLabels: {},
|
|
39
34
|
});
|
|
40
35
|
expectNodes(cli.ls(), ['foo', 'bar', 'base']);
|
|
41
36
|
});
|
|
42
37
|
});
|
|
43
|
-
function expectNodes(
|
|
44
|
-
const
|
|
45
|
-
expect(
|
|
38
|
+
function expectNodes(items, expectedNames) {
|
|
39
|
+
const itemNames = items.map((n) => n.item.name);
|
|
40
|
+
expect([...itemNames].sort()).toEqual([...expectedNames].sort());
|
|
46
41
|
}
|
|
47
42
|
//# sourceMappingURL=labels.spec.js.map
|
|
@@ -7,7 +7,7 @@ describe('local', () => {
|
|
|
7
7
|
afterAll(() => suite.close());
|
|
8
8
|
it('should run local task', async () => {
|
|
9
9
|
const { cli, environment } = await suite.setup({ taskName: 'example' });
|
|
10
|
-
const result = await cli.
|
|
10
|
+
const result = await cli.runExec();
|
|
11
11
|
await (0, expect_1.expectSuccessfulResult)(result, environment);
|
|
12
12
|
});
|
|
13
13
|
});
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const expect_1 = require("../expect");
|
|
4
4
|
const get_test_suite_1 = require("../get-test-suite");
|
|
5
|
+
const requires_linux_containers_1 = require("../requires-linux-containers");
|
|
5
6
|
describe('monorepo', () => {
|
|
6
7
|
const suite = (0, get_test_suite_1.getTestSuite)('monorepo', ['.hammerkit.yaml', 'projects', 'build.npm.yaml', 'build.tsc.yaml']);
|
|
7
8
|
afterAll(() => suite.close());
|
|
8
|
-
it('should build and clean monorepo', async () => {
|
|
9
|
+
it('should build and clean monorepo', (0, requires_linux_containers_1.requiresLinuxContainers)(async () => {
|
|
9
10
|
const { cli, environment } = await suite.setup({ taskName: 'build' });
|
|
10
|
-
|
|
11
|
-
await (0, expect_1.expectSuccessfulResult)(result, environment);
|
|
11
|
+
await (0, expect_1.expectSuccessfulExecution)(cli.exec(), environment);
|
|
12
12
|
await cli.clean();
|
|
13
|
-
},
|
|
13
|
+
}), 900000);
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=monorepo.spec.js.map
|
|
@@ -6,12 +6,12 @@ describe('multi-line', () => {
|
|
|
6
6
|
afterAll(() => suite.close());
|
|
7
7
|
it('should get multi lines', async () => {
|
|
8
8
|
const { cli } = await suite.setup({ taskName: 'example' });
|
|
9
|
-
const task = cli.
|
|
10
|
-
expect((task.cmds || []).map((c) => c.cmd)).toEqual([
|
|
9
|
+
const task = cli.task('example');
|
|
10
|
+
expect((task.data.cmds || []).map((c) => c.cmd)).toEqual([
|
|
11
11
|
'some very long cmd continues on line 2',
|
|
12
12
|
'some other very long cmd continues on line 2',
|
|
13
13
|
]);
|
|
14
|
-
expect(task.description).toEqual('Test multiline description');
|
|
14
|
+
expect(task.data.description).toEqual('Test multiline description');
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
//# sourceMappingURL=multi-line.spec.js.map
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const expect_1 = require("../expect");
|
|
4
4
|
const get_test_suite_1 = require("../get-test-suite");
|
|
5
|
-
const work_scope_1 = require("../../executer/work-scope");
|
|
6
5
|
describe('reference', () => {
|
|
7
6
|
const suite = (0, get_test_suite_1.getTestSuite)('reference', ['.hammerkit.yaml', 'foo']);
|
|
8
7
|
afterAll(() => suite.close());
|
|
9
8
|
it('should run included task', async () => {
|
|
10
9
|
const { cli, environment } = await suite.setup({ taskName: 'example' });
|
|
11
|
-
const result = await cli.
|
|
10
|
+
const result = await cli.runExec();
|
|
12
11
|
await (0, expect_1.expectSuccessfulResult)(result, environment);
|
|
13
12
|
await (0, expect_1.expectLog)(result, environment, `foo:bar`, 'foobar');
|
|
14
13
|
await (0, expect_1.expectLog)(result, environment, `example`, 'hammertime');
|
|
15
14
|
});
|
|
16
15
|
it('should list task with references tasks nested', async () => {
|
|
17
|
-
const { cli } = await suite.setup(
|
|
18
|
-
const
|
|
19
|
-
expect(
|
|
16
|
+
const { cli } = await suite.setup({});
|
|
17
|
+
const workItems = cli.ls();
|
|
18
|
+
expect(workItems.map((t) => t.item.name)).toEqual(['foo:bardb', 'example', 'foo:bar', 'foo:sub:sub']);
|
|
20
19
|
});
|
|
21
20
|
});
|
|
22
21
|
//# sourceMappingURL=reference.spec.js.map
|
|
@@ -2,19 +2,37 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const get_test_suite_1 = require("../get-test-suite");
|
|
4
4
|
const expect_1 = require("../expect");
|
|
5
|
+
const testing_timeout_1 = require("../testing-timeout");
|
|
6
|
+
const requires_linux_containers_1 = require("../requires-linux-containers");
|
|
5
7
|
describe('services', () => {
|
|
6
8
|
const suite = (0, get_test_suite_1.getTestSuite)('services', [
|
|
7
9
|
'index.js',
|
|
10
|
+
'server.js',
|
|
8
11
|
'config.json',
|
|
9
12
|
'package.json',
|
|
10
13
|
'package-lock.json',
|
|
11
14
|
'.hammerkit.yaml',
|
|
12
15
|
]);
|
|
13
16
|
afterAll(() => suite.close());
|
|
14
|
-
it('should run service', async () => {
|
|
15
|
-
const { cli, environment } = await suite.setup({
|
|
16
|
-
const result = await cli.
|
|
17
|
+
it('should run with needed service', (0, requires_linux_containers_1.requiresLinuxContainers)(async () => {
|
|
18
|
+
const { cli, environment } = await suite.setup({});
|
|
19
|
+
const result = await (0, testing_timeout_1.testingTimeout)(cli.up({ daemon: true }), 120000);
|
|
17
20
|
await (0, expect_1.expectSuccessfulResult)(result, environment);
|
|
18
|
-
},
|
|
21
|
+
}), 900000);
|
|
22
|
+
it('should start needs of service', (0, requires_linux_containers_1.requiresLinuxContainers)(async () => {
|
|
23
|
+
const { cli, environment } = await suite.setup({ taskName: 'test' });
|
|
24
|
+
const result = await (0, testing_timeout_1.testingTimeout)(cli.exec(), 120000);
|
|
25
|
+
await (0, expect_1.expectSuccessfulResult)(result, environment);
|
|
26
|
+
}), 900000);
|
|
27
|
+
it('should start services up', (0, requires_linux_containers_1.requiresLinuxContainers)(async () => {
|
|
28
|
+
const { cli } = await suite.setup({
|
|
29
|
+
filterLabels: { task: ['dev'] },
|
|
30
|
+
excludeLabels: {},
|
|
31
|
+
});
|
|
32
|
+
const upResult = await (0, testing_timeout_1.testingTimeout)(cli.up({ daemon: true }));
|
|
33
|
+
expect(upResult.success).toBe(true);
|
|
34
|
+
const downResult = await cli.runDown();
|
|
35
|
+
expect(downResult.success).toBe(true);
|
|
36
|
+
}), 900000);
|
|
19
37
|
});
|
|
20
38
|
//# sourceMappingURL=services.spec.js.map
|
|
@@ -4,6 +4,7 @@ const path_1 = require("path");
|
|
|
4
4
|
const get_test_suite_1 = require("../get-test-suite");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const expect_1 = require("../expect");
|
|
7
|
+
const requires_linux_containers_1 = require("../requires-linux-containers");
|
|
7
8
|
describe('store/restore', () => {
|
|
8
9
|
const suite = (0, get_test_suite_1.getTestSuite)('store-restore', ['.hammerkit.yaml', 'package.json']);
|
|
9
10
|
afterAll(() => suite.close());
|
|
@@ -13,7 +14,7 @@ describe('store/restore', () => {
|
|
|
13
14
|
const cacheStoragePath = (0, path_1.join)(environment.cwd, 'storage');
|
|
14
15
|
expect((0, fs_1.existsSync)(generatedPath)).toBeFalsy();
|
|
15
16
|
expect((0, fs_1.existsSync)(cacheStoragePath)).toBeFalsy();
|
|
16
|
-
const result = await cli.
|
|
17
|
+
const result = await cli.runExec({});
|
|
17
18
|
await (0, expect_1.expectSuccessfulResult)(result, environment);
|
|
18
19
|
expect((0, fs_1.existsSync)(generatedPath)).toBeTruthy();
|
|
19
20
|
expect((0, fs_1.existsSync)(cacheStoragePath)).toBeFalsy();
|
|
@@ -23,31 +24,29 @@ describe('store/restore', () => {
|
|
|
23
24
|
expect((0, fs_1.existsSync)(generatedPath)).toBeFalsy();
|
|
24
25
|
await cli.restore(cacheStoragePath);
|
|
25
26
|
expect((0, fs_1.existsSync)(generatedPath)).toBeTruthy();
|
|
26
|
-
const execAfterRestore = await cli.
|
|
27
|
+
const execAfterRestore = await cli.runExec();
|
|
27
28
|
await (0, expect_1.expectSuccessfulResult)(execAfterRestore, environment);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
expect(nodeState.cached).toBeTruthy();
|
|
29
|
+
const taskState = execAfterRestore.state.tasks['example'];
|
|
30
|
+
expect(taskState.state.current.type).toBe('completed');
|
|
31
|
+
if (taskState.state.current.type === 'completed') {
|
|
32
|
+
expect(taskState.state.current.cached).toBeTruthy();
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
it('should clean and restore created outputs in container', async () => {
|
|
35
|
+
it('should clean and restore created outputs in container', (0, requires_linux_containers_1.requiresLinuxContainers)(async () => {
|
|
36
36
|
const { cli, environment } = await suite.setup({ taskName: 'example:docker' });
|
|
37
37
|
const cacheStoragePath = (0, path_1.join)(environment.cwd, 'storage');
|
|
38
|
-
const firstExecResult = await cli.
|
|
38
|
+
const firstExecResult = await cli.runExec();
|
|
39
39
|
await (0, expect_1.expectSuccessfulResult)(firstExecResult, environment);
|
|
40
40
|
await cli.store(cacheStoragePath);
|
|
41
41
|
await cli.clean();
|
|
42
42
|
await cli.restore(cacheStoragePath);
|
|
43
|
-
const execAfterRestore = await cli.
|
|
43
|
+
const execAfterRestore = await cli.runExec();
|
|
44
44
|
await (0, expect_1.expectSuccessfulResult)(execAfterRestore, environment);
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
expect(nodeState.cached).toBeTruthy();
|
|
45
|
+
const taskState = execAfterRestore.state.tasks['example:docker'];
|
|
46
|
+
expect(taskState.state.current.type).toBe('completed');
|
|
47
|
+
if (taskState.state.current.type === 'completed') {
|
|
48
|
+
expect(taskState.state.current.cached).toBeTruthy();
|
|
50
49
|
}
|
|
51
|
-
},
|
|
50
|
+
}), 900000);
|
|
52
51
|
});
|
|
53
52
|
//# sourceMappingURL=store.spec.js.map
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("
|
|
4
|
-
const
|
|
3
|
+
const test_case_1 = require("../test-case");
|
|
4
|
+
const parse_error_1 = require("../../schema/parse-error");
|
|
5
5
|
describe('unknown', () => {
|
|
6
|
-
const suite = (0, get_test_suite_1.getTestSuite)('unknown', ['.hammerkit.yaml']);
|
|
7
|
-
afterAll(() => suite.close());
|
|
8
|
-
async function validateTask(name, expectedErrors) {
|
|
9
|
-
const { cli } = await suite.setup({ taskName: name });
|
|
10
|
-
let i = 0;
|
|
11
|
-
for await (const message of cli.validate()) {
|
|
12
|
-
expect(expectedErrors[i++]).toEqual(message.message);
|
|
13
|
-
}
|
|
14
|
-
expect(i).toEqual(expectedErrors.length);
|
|
15
|
-
}
|
|
16
6
|
it('should validate unknown props', async () => {
|
|
17
|
-
|
|
7
|
+
const testCase = (0, test_case_1.createTestCase)('wrong-cmd', {
|
|
8
|
+
'.hammerkit.yaml': {
|
|
9
|
+
example: {
|
|
10
|
+
cmd: ['echo wrong cmd'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
await expect(testCase.cli({ taskName: 'example' })).rejects.toThrow(parse_error_1.ParseError);
|
|
18
15
|
});
|
|
19
|
-
it('should validate unknown props for local tasks
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
it('should validate unknown container props for local tasks', async () => {
|
|
17
|
+
const testCase = (0, test_case_1.createTestCase)('wrong-cmd', {
|
|
18
|
+
'.hammerkit.yaml': {
|
|
19
|
+
example: {
|
|
20
|
+
cmds: ['echo hello'],
|
|
21
|
+
mounts: ['/.npm:/.npm'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
await expect(testCase.cli({ taskName: 'example' })).rejects.toThrow(parse_error_1.ParseError);
|
|
24
26
|
});
|
|
25
27
|
});
|
|
26
28
|
//# sourceMappingURL=unknown.spec.js.map
|
|
@@ -1,43 +1,160 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("
|
|
4
|
-
const get_test_suite_1 = require("../get-test-suite");
|
|
3
|
+
const test_case_1 = require("../test-case");
|
|
5
4
|
describe('validate', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
async function validateTask(testCase, name, expectedErrors) {
|
|
6
|
+
await testCase.cli({ taskName: name }, async (cli) => {
|
|
7
|
+
let i = 0;
|
|
8
|
+
for await (const message of cli.validate()) {
|
|
9
|
+
expect(message.message).toEqual(expectedErrors[i++]);
|
|
10
|
+
}
|
|
11
|
+
expect(i).toEqual(expectedErrors.length);
|
|
12
|
+
});
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
it('should validate local task', async () => {
|
|
15
|
+
const testCase = (0, test_case_1.createTestCase)('valid_local_task', {
|
|
16
|
+
'.hammerkit.yaml': {
|
|
17
|
+
tasks: {
|
|
18
|
+
valid_local_task: {
|
|
19
|
+
description: 'build code',
|
|
20
|
+
cmds: ['make'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
await validateTask(testCase, 'valid_local_task', []);
|
|
18
26
|
});
|
|
19
|
-
it('should validate
|
|
20
|
-
|
|
27
|
+
it('should validate container task', async () => {
|
|
28
|
+
const testCase = (0, test_case_1.createTestCase)('valid_container_task', {
|
|
29
|
+
'.hammerkit.yaml': {
|
|
30
|
+
tasks: {
|
|
31
|
+
valid_container_task: {
|
|
32
|
+
image: 'alpine',
|
|
33
|
+
description: 'build code',
|
|
34
|
+
cmds: ['make'],
|
|
35
|
+
mounts: ['/.kube:/.kube'],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
await validateTask(testCase, 'valid_container_task', []);
|
|
21
41
|
});
|
|
22
|
-
it('should
|
|
23
|
-
|
|
42
|
+
it('should warn about tasks without description', async () => {
|
|
43
|
+
const testCase = (0, test_case_1.createTestCase)('missing_doc', {
|
|
44
|
+
'.hammerkit.yaml': {
|
|
45
|
+
tasks: {
|
|
46
|
+
missing_doc: {
|
|
47
|
+
image: 'alpine',
|
|
48
|
+
cmds: ['make'],
|
|
49
|
+
mounts: ['/.kube:/.kube'],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
await validateTask(testCase, 'missing_doc', ['missing description']);
|
|
24
55
|
});
|
|
25
|
-
it('should detect empty tasks', async () => {
|
|
26
|
-
|
|
56
|
+
it('should detect empty tasks without cmds', async () => {
|
|
57
|
+
const testCase = (0, test_case_1.createTestCase)('missing_cmd', {
|
|
58
|
+
'.hammerkit.yaml': {
|
|
59
|
+
tasks: {
|
|
60
|
+
missing_cmd: {
|
|
61
|
+
image: 'alpine',
|
|
62
|
+
description: 'build code',
|
|
63
|
+
mounts: ['/.kube:/.kube'],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
await validateTask(testCase, 'missing_cmd', ['task is empty']);
|
|
27
69
|
});
|
|
28
|
-
it('should allow only deps', async () => {
|
|
29
|
-
|
|
70
|
+
it('should allow only deps without cmds', async () => {
|
|
71
|
+
const testCase = (0, test_case_1.createTestCase)('dep_only', {
|
|
72
|
+
'.hammerkit.yaml': {
|
|
73
|
+
tasks: {
|
|
74
|
+
build: {
|
|
75
|
+
cmds: ['make'],
|
|
76
|
+
description: 'build code',
|
|
77
|
+
},
|
|
78
|
+
dep_only: {
|
|
79
|
+
image: 'alpine',
|
|
80
|
+
description: 'deps',
|
|
81
|
+
deps: ['build'],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
await validateTask(testCase, 'dep_only', []);
|
|
30
87
|
});
|
|
31
88
|
it('should detect loop in dep', async () => {
|
|
32
|
-
|
|
89
|
+
const testCase = (0, test_case_1.createTestCase)('loop_with_dep', {
|
|
90
|
+
'.hammerkit.yaml': {
|
|
91
|
+
tasks: {
|
|
92
|
+
loop_with_dep: {
|
|
93
|
+
image: 'alpine',
|
|
94
|
+
description: 'build code',
|
|
95
|
+
cmds: ['make'],
|
|
96
|
+
deps: ['loop_with_dep'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
await validateTask(testCase, 'loop_with_dep', ['task cycle detected loop_with_dep -> loop_with_dep']);
|
|
33
102
|
});
|
|
34
103
|
it('should detect loop in refs', async () => {
|
|
35
|
-
|
|
104
|
+
const testCase = (0, test_case_1.createTestCase)('loop_with_refs', {
|
|
105
|
+
'.hammerkit.yaml': {
|
|
106
|
+
tasks: {
|
|
107
|
+
loop_with_refs: {
|
|
108
|
+
image: 'alpine',
|
|
109
|
+
description: 'build code',
|
|
110
|
+
cmds: ['make'],
|
|
111
|
+
deps: ['ref:loop_with_refs'],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
references: { ref: '.hammerkit2.yaml' },
|
|
115
|
+
},
|
|
116
|
+
'.hammerkit2.yaml': {
|
|
117
|
+
tasks: {
|
|
118
|
+
loop_with_refs: {
|
|
119
|
+
deps: ['ref:loop_with_refs'],
|
|
120
|
+
image: 'alpine',
|
|
121
|
+
description: 'build code',
|
|
122
|
+
cmds: ['make 2'],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
references: { ref: '.hammerkit.yaml' },
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
await validateTask(testCase, 'loop_with_refs', [
|
|
129
|
+
'task cycle detected loop_with_refs -> ref:loop_with_refs -> loop_with_refs',
|
|
130
|
+
]);
|
|
36
131
|
});
|
|
37
132
|
it('should detect loop over multiple tasks', async () => {
|
|
38
|
-
|
|
39
|
-
'
|
|
40
|
-
|
|
133
|
+
const testCase = (0, test_case_1.createTestCase)('loop_with_multiple_tasks', {
|
|
134
|
+
'.hammerkit.yaml': {
|
|
135
|
+
tasks: {
|
|
136
|
+
first: {
|
|
137
|
+
image: 'alpine',
|
|
138
|
+
description: 'build code',
|
|
139
|
+
cmds: ['make 1'],
|
|
140
|
+
deps: ['second'],
|
|
141
|
+
},
|
|
142
|
+
second: {
|
|
143
|
+
image: 'alpine',
|
|
144
|
+
description: 'build code',
|
|
145
|
+
cmds: ['make 2'],
|
|
146
|
+
deps: ['third'],
|
|
147
|
+
},
|
|
148
|
+
third: {
|
|
149
|
+
image: 'alpine',
|
|
150
|
+
description: 'build code',
|
|
151
|
+
cmds: ['make 3'],
|
|
152
|
+
deps: ['first'],
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
await validateTask(testCase, 'first', ['task cycle detected first -> second -> third -> first']);
|
|
41
158
|
});
|
|
42
159
|
});
|
|
43
160
|
//# sourceMappingURL=validate.spec.js.map
|
|
@@ -6,19 +6,22 @@ describe('watch-dependency', () => {
|
|
|
6
6
|
afterAll(() => suite.close());
|
|
7
7
|
it('should run watch task', async () => {
|
|
8
8
|
const { cli, environment } = await suite.setup({ taskName: 'third' });
|
|
9
|
-
const thirdNode = cli.
|
|
10
|
-
const exec = cli.
|
|
9
|
+
const thirdNode = cli.task('third');
|
|
10
|
+
const exec = await cli.exec({ watch: true });
|
|
11
11
|
let content = '';
|
|
12
|
-
let
|
|
13
|
-
exec.
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let changedStateKey = '';
|
|
13
|
+
exec.state.on('test-status', async (evt) => {
|
|
14
|
+
const currentState = evt.tasks[thirdNode.name].state.current;
|
|
15
|
+
if (currentState.type === 'completed') {
|
|
16
|
+
if (changedStateKey != '' &&
|
|
17
|
+
currentState.stateKey !== changedStateKey &&
|
|
18
|
+
!environment.abortCtrl.signal.aborted) {
|
|
16
19
|
content = await environment.file.read('third.txt');
|
|
17
20
|
environment.abortCtrl.abort();
|
|
18
21
|
}
|
|
19
|
-
else {
|
|
22
|
+
else if (changedStateKey === '') {
|
|
20
23
|
await environment.file.appendFile('source.txt', 'world\n');
|
|
21
|
-
|
|
24
|
+
changedStateKey = currentState.stateKey;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
});
|