@vaharoni/devops 1.0.47
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/README.md +51 -0
- package/dist/app-support/crypto/index.d.ts +15 -0
- package/dist/app-support/crypto/index.d.ts.map +1 -0
- package/dist/app-support/crypto/index.js +30 -0
- package/dist/app-support/crypto/internal-token.d.ts +20 -0
- package/dist/app-support/crypto/internal-token.d.ts.map +1 -0
- package/dist/app-support/crypto/internal-token.js +42 -0
- package/dist/app-support/crypto/internal-token.spec.d.ts +2 -0
- package/dist/app-support/crypto/internal-token.spec.d.ts.map +1 -0
- package/dist/app-support/crypto/internal-token.spec.js +45 -0
- package/dist/app-support/crypto/secret.d.ts +3 -0
- package/dist/app-support/crypto/secret.d.ts.map +1 -0
- package/dist/app-support/crypto/secret.js +12 -0
- package/dist/app-support/crypto/secret.spec.d.ts +2 -0
- package/dist/app-support/crypto/secret.spec.d.ts.map +1 -0
- package/dist/app-support/crypto/secret.spec.js +15 -0
- package/dist/app-support/discovery/dev-discovery-loader.d.ts +2 -0
- package/dist/app-support/discovery/dev-discovery-loader.d.ts.map +1 -0
- package/dist/app-support/discovery/dev-discovery-loader.js +30 -0
- package/dist/app-support/discovery/service-endpoint.d.ts +2 -0
- package/dist/app-support/discovery/service-endpoint.d.ts.map +1 -0
- package/dist/app-support/discovery/service-endpoint.js +10 -0
- package/dist/cli/affected.d.ts +11 -0
- package/dist/cli/affected.d.ts.map +1 -0
- package/dist/cli/affected.js +103 -0
- package/dist/cli/common.d.ts +89 -0
- package/dist/cli/common.d.ts.map +1 -0
- package/dist/cli/common.js +236 -0
- package/dist/cli/common.spec.d.ts +2 -0
- package/dist/cli/common.spec.d.ts.map +1 -0
- package/dist/cli/common.spec.js +64 -0
- package/dist/cli/console.d.ts +11 -0
- package/dist/cli/console.d.ts.map +1 -0
- package/dist/cli/console.js +35 -0
- package/dist/cli/constant.d.ts +11 -0
- package/dist/cli/constant.d.ts.map +1 -0
- package/dist/cli/constant.js +22 -0
- package/dist/cli/db.d.ts +11 -0
- package/dist/cli/db.d.ts.map +1 -0
- package/dist/cli/db.js +119 -0
- package/dist/cli/dml.d.ts +11 -0
- package/dist/cli/dml.d.ts.map +1 -0
- package/dist/cli/dml.js +116 -0
- package/dist/cli/env.d.ts +11 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +67 -0
- package/dist/cli/exec.d.ts +11 -0
- package/dist/cli/exec.d.ts.map +1 -0
- package/dist/cli/exec.js +50 -0
- package/dist/cli/image.d.ts +11 -0
- package/dist/cli/image.d.ts.map +1 -0
- package/dist/cli/image.js +140 -0
- package/dist/cli/init.d.ts +11 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +66 -0
- package/dist/cli/internal-curl.d.ts +11 -0
- package/dist/cli/internal-curl.d.ts.map +1 -0
- package/dist/cli/internal-curl.js +43 -0
- package/dist/cli/job.d.ts +11 -0
- package/dist/cli/job.d.ts.map +1 -0
- package/dist/cli/job.js +67 -0
- package/dist/cli/jwt.d.ts +11 -0
- package/dist/cli/jwt.d.ts.map +1 -0
- package/dist/cli/jwt.js +27 -0
- package/dist/cli/namespace.d.ts +11 -0
- package/dist/cli/namespace.d.ts.map +1 -0
- package/dist/cli/namespace.js +70 -0
- package/dist/cli/prep-build.d.ts +11 -0
- package/dist/cli/prep-build.d.ts.map +1 -0
- package/dist/cli/prep-build.js +82 -0
- package/dist/cli/prisma.d.ts +11 -0
- package/dist/cli/prisma.d.ts.map +1 -0
- package/dist/cli/prisma.js +25 -0
- package/dist/cli/redis.d.ts +11 -0
- package/dist/cli/redis.d.ts.map +1 -0
- package/dist/cli/redis.js +76 -0
- package/dist/cli/registry.d.ts +11 -0
- package/dist/cli/registry.d.ts.map +1 -0
- package/dist/cli/registry.js +58 -0
- package/dist/cli/run-many.d.ts +11 -0
- package/dist/cli/run-many.d.ts.map +1 -0
- package/dist/cli/run-many.js +50 -0
- package/dist/cli/run.d.ts +11 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +37 -0
- package/dist/cli/template.d.ts +11 -0
- package/dist/cli/template.d.ts.map +1 -0
- package/dist/cli/template.js +123 -0
- package/dist/cli/test.d.ts +11 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +28 -0
- package/dist/devops.d.ts +3 -0
- package/dist/devops.d.ts.map +1 -0
- package/dist/devops.js +103 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/libs/affected-entities.d.ts +15 -0
- package/dist/libs/affected-entities.d.ts.map +1 -0
- package/dist/libs/affected-entities.js +52 -0
- package/dist/libs/config.d.ts +6 -0
- package/dist/libs/config.d.ts.map +1 -0
- package/dist/libs/config.js +98 -0
- package/dist/libs/dependencies.d.ts +19 -0
- package/dist/libs/dependencies.d.ts.map +1 -0
- package/dist/libs/dependencies.js +62 -0
- package/dist/libs/dependencies.spec.d.ts +2 -0
- package/dist/libs/dependencies.spec.d.ts.map +1 -0
- package/dist/libs/dependencies.spec.js +21 -0
- package/dist/libs/digital-ocean/container-reg.d.ts +6 -0
- package/dist/libs/digital-ocean/container-reg.d.ts.map +1 -0
- package/dist/libs/digital-ocean/container-reg.js +69 -0
- package/dist/libs/discovery/dependencies.d.ts +19 -0
- package/dist/libs/discovery/dependencies.d.ts.map +1 -0
- package/dist/libs/discovery/dependencies.js +62 -0
- package/dist/libs/discovery/dependencies.spec.d.ts +2 -0
- package/dist/libs/discovery/dependencies.spec.d.ts.map +1 -0
- package/dist/libs/discovery/dependencies.spec.js +21 -0
- package/dist/libs/discovery/images.d.ts +5 -0
- package/dist/libs/discovery/images.d.ts.map +1 -0
- package/dist/libs/discovery/images.js +45 -0
- package/dist/libs/discovery/index.d.ts +5 -0
- package/dist/libs/discovery/index.d.ts.map +1 -0
- package/dist/libs/discovery/index.js +55 -0
- package/dist/libs/discovery/package-json-processor.d.ts +3 -0
- package/dist/libs/discovery/package-json-processor.d.ts.map +1 -0
- package/dist/libs/discovery/package-json-processor.js +34 -0
- package/dist/libs/discovery/process-common.d.ts +25 -0
- package/dist/libs/discovery/process-common.d.ts.map +1 -0
- package/dist/libs/discovery/process-common.js +40 -0
- package/dist/libs/discovery/process-package-json.d.ts +3 -0
- package/dist/libs/discovery/process-package-json.d.ts.map +1 -0
- package/dist/libs/discovery/process-package-json.js +34 -0
- package/dist/libs/discovery/process-pyproject-toml.d.ts +3 -0
- package/dist/libs/discovery/process-pyproject-toml.d.ts.map +1 -0
- package/dist/libs/discovery/process-pyproject-toml.js +36 -0
- package/dist/libs/discovery/pyproject-toml-processor.d.ts +3 -0
- package/dist/libs/discovery/pyproject-toml-processor.d.ts.map +1 -0
- package/dist/libs/discovery/pyproject-toml-processor.js +39 -0
- package/dist/libs/git-helpers.d.ts +8 -0
- package/dist/libs/git-helpers.d.ts.map +1 -0
- package/dist/libs/git-helpers.js +20 -0
- package/dist/libs/hetzner/reg-secret.d.ts +3 -0
- package/dist/libs/hetzner/reg-secret.d.ts.map +1 -0
- package/dist/libs/hetzner/reg-secret.js +39 -0
- package/dist/libs/k8s-constants.d.ts +12 -0
- package/dist/libs/k8s-constants.d.ts.map +1 -0
- package/dist/libs/k8s-constants.js +66 -0
- package/dist/libs/k8s-db.d.ts +18 -0
- package/dist/libs/k8s-db.d.ts.map +1 -0
- package/dist/libs/k8s-db.js +73 -0
- package/dist/libs/k8s-generate.d.ts +17 -0
- package/dist/libs/k8s-generate.d.ts.map +1 -0
- package/dist/libs/k8s-generate.js +179 -0
- package/dist/libs/k8s-helpers.d.ts +11 -0
- package/dist/libs/k8s-helpers.d.ts.map +1 -0
- package/dist/libs/k8s-helpers.js +42 -0
- package/dist/libs/k8s-image-config.d.ts +8 -0
- package/dist/libs/k8s-image-config.d.ts.map +1 -0
- package/dist/libs/k8s-image-config.js +113 -0
- package/dist/libs/k8s-job-waiter.d.ts +8 -0
- package/dist/libs/k8s-job-waiter.d.ts.map +1 -0
- package/dist/libs/k8s-job-waiter.js +84 -0
- package/dist/libs/k8s-namespace.d.ts +7 -0
- package/dist/libs/k8s-namespace.d.ts.map +1 -0
- package/dist/libs/k8s-namespace.js +27 -0
- package/dist/libs/k8s-redis.d.ts +6 -0
- package/dist/libs/k8s-redis.d.ts.map +1 -0
- package/dist/libs/k8s-redis.js +31 -0
- package/dist/libs/k8s-secrets-manager.d.ts +5 -0
- package/dist/libs/k8s-secrets-manager.d.ts.map +1 -0
- package/dist/libs/k8s-secrets-manager.js +61 -0
- package/dist/libs/validate-env.d.ts +56 -0
- package/dist/libs/validate-env.d.ts.map +1 -0
- package/dist/libs/validate-env.js +214 -0
- package/dist/libs/validate-env.spec.d.ts +2 -0
- package/dist/libs/validate-env.spec.d.ts.map +1 -0
- package/dist/libs/validate-env.spec.js +168 -0
- package/dist/libs/workspace-discovery.d.ts +2 -0
- package/dist/libs/workspace-discovery.d.ts.map +1 -0
- package/dist/libs/workspace-discovery.js +75 -0
- package/dist/test.d.ts +2 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +1 -0
- package/dist/types/index.d.ts +925 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +79 -0
- package/package.json +55 -0
- package/src/app-support/crypto/index.ts +31 -0
- package/src/app-support/crypto/internal-token.spec.ts +53 -0
- package/src/app-support/crypto/internal-token.ts +82 -0
- package/src/app-support/crypto/secret.spec.ts +18 -0
- package/src/app-support/crypto/secret.ts +13 -0
- package/src/app-support/discovery/dev-discovery-loader.ts +35 -0
- package/src/app-support/discovery/service-endpoint.ts +12 -0
- package/src/cli/affected.ts +116 -0
- package/src/cli/common.spec.ts +78 -0
- package/src/cli/common.ts +323 -0
- package/src/cli/console.ts +46 -0
- package/src/cli/constant.ts +25 -0
- package/src/cli/db.ts +133 -0
- package/src/cli/dml.ts +126 -0
- package/src/cli/env.ts +87 -0
- package/src/cli/exec.sh +21 -0
- package/src/cli/exec.ts +57 -0
- package/src/cli/image.ts +197 -0
- package/src/cli/init.ts +75 -0
- package/src/cli/internal-curl.ts +48 -0
- package/src/cli/job.ts +80 -0
- package/src/cli/jwt.ts +32 -0
- package/src/cli/namespace.ts +78 -0
- package/src/cli/prep-build.ts +96 -0
- package/src/cli/prisma.ts +33 -0
- package/src/cli/redis.ts +83 -0
- package/src/cli/registry.ts +76 -0
- package/src/cli/run-many.ts +61 -0
- package/src/cli/run.ts +46 -0
- package/src/cli/template.ts +169 -0
- package/src/cli/test.ts +30 -0
- package/src/devops.ts +119 -0
- package/src/index.ts +3 -0
- package/src/libs/affected-entities.ts +71 -0
- package/src/libs/config.ts +117 -0
- package/src/libs/digital-ocean/container-reg.ts +81 -0
- package/src/libs/discovery/dependencies.spec.ts +25 -0
- package/src/libs/discovery/dependencies.ts +73 -0
- package/src/libs/discovery/images.ts +57 -0
- package/src/libs/discovery/index.ts +60 -0
- package/src/libs/discovery/process-common.ts +55 -0
- package/src/libs/discovery/process-package-json.ts +47 -0
- package/src/libs/discovery/process-pyproject-toml.ts +43 -0
- package/src/libs/git-helpers.ts +32 -0
- package/src/libs/hetzner/reg-secret.ts +54 -0
- package/src/libs/k8s-constants.ts +83 -0
- package/src/libs/k8s-db.ts +83 -0
- package/src/libs/k8s-generate.ts +211 -0
- package/src/libs/k8s-helpers.ts +59 -0
- package/src/libs/k8s-image-config.ts +165 -0
- package/src/libs/k8s-job-waiter.ts +124 -0
- package/src/libs/k8s-namespace.ts +41 -0
- package/src/libs/k8s-redis.ts +31 -0
- package/src/libs/k8s-secrets-manager.ts +79 -0
- package/src/libs/validate-env.spec.ts +223 -0
- package/src/libs/validate-env.ts +266 -0
- package/src/target-templates/.devops/config/constants.yaml +17 -0
- package/src/target-templates/.devops/config/images.yaml +88 -0
- package/src/target-templates/.devops/docker-images/common/docker-common.sh +23 -0
- package/src/target-templates/.devops/docker-images/node-services/node-exec.sh +8 -0
- package/src/target-templates/.devops/docker-images/node-services/node-run.sh +8 -0
- package/src/target-templates/.devops/docker-images/node-services.Dockerfile +34 -0
- package/src/target-templates/.devops/docker-images/python-services/python-exec.sh +8 -0
- package/src/target-templates/.devops/docker-images/python-services/python-run.sh +8 -0
- package/src/target-templates/.devops/docker-images/python-services.Dockerfile +29 -0
- package/src/target-templates/.devops/env.example.yaml +23 -0
- package/src/target-templates/.devops/infra/hetzner/abandoned/harbor-values.yaml +30 -0
- package/src/target-templates/.devops/infra/hetzner/abandoned/hcloud-config.yaml +134 -0
- package/src/target-templates/.devops/infra/hetzner/cert-manager.yaml +25 -0
- package/src/target-templates/.devops/infra/hetzner/harbor-cert.yaml +13 -0
- package/src/target-templates/.devops/infra/hetzner/harbor-values.yaml +76 -0
- package/src/target-templates/.devops/infra/hetzner/hcloud-config.yaml +113 -0
- package/src/target-templates/.devops/infra/hetzner/ingress-nginx-annotations.yaml +49 -0
- package/src/target-templates/.devops/infra/hetzner/ingress-nginx-configmap.yaml +8 -0
- package/src/target-templates/.devops/infra/hetzner/retain-storage-class.yaml +8 -0
- package/src/target-templates/.devops/infra/monitoring-ingress.yaml +62 -0
- package/src/target-templates/.devops/infra/stackgres-ui-ingress.yaml +35 -0
- package/src/target-templates/.devops/infra/test.yaml +60 -0
- package/src/target-templates/.devops/manifests/_index.yaml +21 -0
- package/src/target-templates/.devops/manifests/cron-jobs.yaml.hb +55 -0
- package/src/target-templates/.devops/manifests/db-migrate-job.yaml.hb +42 -0
- package/src/target-templates/.devops/manifests/deployment-debug.yaml.hb +44 -0
- package/src/target-templates/.devops/manifests/deployment-process.yaml.hb +47 -0
- package/src/target-templates/.devops/manifests/deployment-web.yaml.hb +53 -0
- package/src/target-templates/.devops/manifests/ingress.yaml.hb +21 -0
- package/src/target-templates/.devops/manifests/prefect.yaml.hb +62 -0
- package/src/target-templates/.devops/manifests/service.yaml.hb +15 -0
- package/src/target-templates/.devops/milvus/production/milvus-values.yaml +2 -0
- package/src/target-templates/.devops/milvus/staging/milvus-values.yaml +2 -0
- package/src/target-templates/.devops/postgres/DailyOperatorRestart.yaml +54 -0
- package/src/target-templates/.devops/postgres/production/cluster/PodDisruptionBudget.yaml +27 -0
- package/src/target-templates/.devops/postgres/production/cluster/SGCluster.yaml +47 -0
- package/src/target-templates/.devops/postgres/production/cluster/StackGres-alerts.yaml +191 -0
- package/src/target-templates/.devops/postgres/production/configurations/06-SGDistributedLogs.yaml +11 -0
- package/src/target-templates/.devops/postgres/production/configurations/07-SGObjectStorage.yaml +18 -0
- package/src/target-templates/.devops/postgres/production/configurations/08-SGScript.yaml +12 -0
- package/src/target-templates/.devops/postgres/staging/cluster/SGCluster.yaml +42 -0
- package/src/target-templates/.devops/postgres/staging/configurations/07-SGObjectStorage.yaml +18 -0
- package/src/target-templates/.devops/postgres/staging/configurations/08-SGScript.yaml +12 -0
- package/src/target-templates/.devops/prefect/production/prefect-values.yaml +14 -0
- package/src/target-templates/.devops/prefect/staging/prefect-values.yaml +14 -0
- package/src/target-templates/.devops/redis/production/redis-values.yaml +20 -0
- package/src/target-templates/.devops/redis/staging/redis-values.yaml +8 -0
- package/src/target-templates/.envrc +5 -0
- package/src/target-templates/.github/actions/build-image@v1/action.yaml +86 -0
- package/src/target-templates/.github/actions/connect-to-digital-ocean@v1/action.yaml +29 -0
- package/src/target-templates/.github/actions/connect-to-hetzner@v1/action.yaml +31 -0
- package/src/target-templates/.github/actions/connect-to-infra@v1/action.yaml +46 -0
- package/src/target-templates/.github/actions/db-migrate@v1/action.yaml +23 -0
- package/src/target-templates/.github/actions/deploy-image@v1/action.yaml +33 -0
- package/src/target-templates/.github/actions/setup-prereq@v1/action.yaml +29 -0
- package/src/target-templates/.github/workflows/k8s-build.yaml +84 -0
- package/src/target-templates/applications/example-data-pipeline/pyproject.toml +14 -0
- package/src/target-templates/applications/example-data-pipeline/src/example_data_pipeline/main.py +38 -0
- package/src/target-templates/applications/example-node/index.ts +30 -0
- package/src/target-templates/applications/example-node/package.json +26 -0
- package/src/target-templates/applications/example-node/tsconfig.json +3 -0
- package/src/target-templates/applications/example-python/pyproject.toml +20 -0
- package/src/target-templates/applications/example-python/src/example_python/__init__.py +0 -0
- package/src/target-templates/applications/example-python/src/example_python/main.py +13 -0
- package/src/target-templates/applications/example-python/src/example_python/scripts.py +17 -0
- package/src/target-templates/applications/example-python/tests/__init__.py +0 -0
- package/src/target-templates/applications/jobs/README.md +68 -0
- package/src/target-templates/applications/jobs/index.ts +1 -0
- package/src/target-templates/applications/jobs/package.json +30 -0
- package/src/target-templates/applications/jobs/tsconfig.json +3 -0
- package/src/target-templates/config/.env.development +1 -0
- package/src/target-templates/config/.env.global +4 -0
- package/src/target-templates/config/.env.test +1 -0
- package/src/target-templates/db/db/__init__.py +0 -0
- package/src/target-templates/db/db/db_client_test.py +46 -0
- package/src/target-templates/db/db-client-test.ts +140 -0
- package/src/target-templates/db/db-client.ts +19 -0
- package/src/target-templates/db/env.yaml +4 -0
- package/src/target-templates/db/package.json +17 -0
- package/src/target-templates/db/prisma/schema.prisma +24 -0
- package/src/target-templates/db/prisma-setup-vitest.ts +27 -0
- package/src/target-templates/db/pyproject.toml +14 -0
- package/src/target-templates/db/tsconfig.json +3 -0
- package/src/target-templates/devops +3 -0
- package/src/target-templates/devopspy +3 -0
- package/src/target-templates/dml/package.json +7 -0
- package/src/target-templates/dml/tsconfig.json +3 -0
- package/src/target-templates/libs/example-node-lib/bun.lock +27 -0
- package/src/target-templates/libs/example-node-lib/index.ts +3 -0
- package/src/target-templates/libs/example-node-lib/package.json +12 -0
- package/src/target-templates/libs/example-node-lib/tsconfig.json +3 -0
- package/src/target-templates/libs/example-python-lib/pyproject.toml +11 -0
- package/src/target-templates/libs/example-python-lib/src/example_python_lib/__init__.py +2 -0
- package/src/target-templates/pyproject.toml +19 -0
- package/src/target-templates/tmp/.gitkeep +0 -0
- package/src/target-templates/tsconfig.json +27 -0
- package/src/test.ts +0 -0
- package/src/types/index.ts +173 -0
package/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# devops for Monorepos
|
2
|
+
|
3
|
+
Monorepos support multiple apps, allowing them to reuse functionality through shared libraries. `devops` is a tool that helps deploy and manage such setup on a kubernetes cluster using github actions.
|
4
|
+
|
5
|
+
`devops` is...
|
6
|
+
- **a generator** - it generates boilerplate code when starting a new monorepo, such as github actions and docker images
|
7
|
+
- **a CLI** - making it easy to manage your local and remote env variables, connect to your remote databases, or launch remote console
|
8
|
+
- **a builder** - identifies which folders need to reside in which docker image through dependency discovery
|
9
|
+
- **a gitops deployer** - sets up github actions to watch pushes to `staging` and `production` branches, identifies which images are affected by those commits, and determines whether to run db migrations
|
10
|
+
- **an SDK** - helps with inter-application communication, by addressing the minor differences between local and remote environments in the DNS of endpoints, and by issuing tokens so that apps can validate traffic originated from within the cluster
|
11
|
+
- **a scheduler** - leverages kubernetes to execute curl commands to your endpoints at a certain cron schedule to trigger some background processes
|
12
|
+
- **a set of instructions** - for how to install kubernetes clusters from scratch with support for multi environments, postgres, and redis
|
13
|
+
|
14
|
+
`devops` currently supports node and python. The repo that contains the python CLI can be found [here](https://github.com/vaharoni/devops-python).
|
15
|
+
|
16
|
+
# Documentation
|
17
|
+
|
18
|
+
- [Repo setup](./docs/RepoSetup.md)
|
19
|
+
- [Working with Python](./docs/WorkingWithPython.md)
|
20
|
+
- [Day to day work](./docs/DayToDay.md)
|
21
|
+
- [The devops architecture](./docs/Architecture.md)
|
22
|
+
|
23
|
+
# Limitations
|
24
|
+
|
25
|
+
Currently, the repo works with `bun` as the package manager for node and `uv` for python.
|
26
|
+
|
27
|
+
# Contributing
|
28
|
+
|
29
|
+
Run this in your local copy of the devops folder:
|
30
|
+
```shell
|
31
|
+
bun link
|
32
|
+
```
|
33
|
+
|
34
|
+
Run this in a local package using the project for testing:
|
35
|
+
```shell
|
36
|
+
bun link @vaharoni/devops
|
37
|
+
bun run build
|
38
|
+
```
|
39
|
+
|
40
|
+
When done:
|
41
|
+
```shell
|
42
|
+
# In the local copy of this repo
|
43
|
+
bun unlink
|
44
|
+
```
|
45
|
+
|
46
|
+
To release:
|
47
|
+
```shell
|
48
|
+
npm version patch
|
49
|
+
git push --tags
|
50
|
+
gh release create vX.Y.Z
|
51
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* A simple token generation/verification class that relies on the subject field of an internal JWT-like token. It can:
|
3
|
+
* - generate a short-lived (60s) token with the given subject
|
4
|
+
* - verify that a token has not expired and bears the given subject
|
5
|
+
*
|
6
|
+
* Relies on the MONOREPO_BASE_SECRET environment variable for signing and verifying the token.
|
7
|
+
*/
|
8
|
+
export declare class InternalToken {
|
9
|
+
subject: string;
|
10
|
+
constructor(subject: string);
|
11
|
+
generate(): string;
|
12
|
+
verifyOrThrow(token: string): void;
|
13
|
+
verifyFromHeaderOrThrow(authorizationHeader?: string | null): void;
|
14
|
+
}
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-support/crypto/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,qBAAa,aAAa;IACL,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;IAElC,QAAQ;IAIR,aAAa,CAAC,KAAK,EAAE,MAAM;IAO3B,uBAAuB,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI;CAO5D"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { generateInternalAuthToken, parseInternalAuthTokenOrThrow } from "./internal-token";
|
2
|
+
/**
|
3
|
+
* A simple token generation/verification class that relies on the subject field of an internal JWT-like token. It can:
|
4
|
+
* - generate a short-lived (60s) token with the given subject
|
5
|
+
* - verify that a token has not expired and bears the given subject
|
6
|
+
*
|
7
|
+
* Relies on the MONOREPO_BASE_SECRET environment variable for signing and verifying the token.
|
8
|
+
*/
|
9
|
+
export class InternalToken {
|
10
|
+
subject;
|
11
|
+
constructor(subject) {
|
12
|
+
this.subject = subject;
|
13
|
+
}
|
14
|
+
generate() {
|
15
|
+
return generateInternalAuthToken({ sub: this.subject });
|
16
|
+
}
|
17
|
+
verifyOrThrow(token) {
|
18
|
+
const parsedToken = parseInternalAuthTokenOrThrow(token);
|
19
|
+
if (parsedToken.sub !== this.subject) {
|
20
|
+
throw new Error('Invalid token');
|
21
|
+
}
|
22
|
+
}
|
23
|
+
verifyFromHeaderOrThrow(authorizationHeader) {
|
24
|
+
if (!authorizationHeader) {
|
25
|
+
throw new Error('Authorization header not found');
|
26
|
+
}
|
27
|
+
const token = authorizationHeader.replace('Bearer ', '');
|
28
|
+
this.verifyOrThrow(token);
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
export type InternalTokenClaims<CustomClaims extends object = object> = CustomClaims & {
|
2
|
+
/** The token issuer */
|
3
|
+
iss: string;
|
4
|
+
/** Issued at */
|
5
|
+
iat: number;
|
6
|
+
/** Expires at */
|
7
|
+
exp: number;
|
8
|
+
/** The subject of the token. Should contain a string of the "service account" who bears the token. */
|
9
|
+
sub?: string;
|
10
|
+
/** The audience of the token. Should contain a string of who the token is intended for. */
|
11
|
+
aud?: string;
|
12
|
+
};
|
13
|
+
export declare function generateInternalAuthToken({ customClaims, expiresInSeconds, sub, aud, }?: {
|
14
|
+
customClaims?: Record<string, string>;
|
15
|
+
expiresInSeconds?: number;
|
16
|
+
sub?: string;
|
17
|
+
aud?: string;
|
18
|
+
}): string;
|
19
|
+
export declare function parseInternalAuthTokenOrThrow<CustomClaims extends object = object>(token: string): InternalTokenClaims<CustomClaims>;
|
20
|
+
//# sourceMappingURL=internal-token.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"internal-token.d.ts","sourceRoot":"","sources":["../../../src/app-support/crypto/internal-token.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,CAAC,YAAY,SAAS,MAAM,GAAG,MAAM,IAClE,YAAY,GAAG;IACb,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,sGAAsG;IACtG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2FAA2F;IAC3F,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AA4BJ,wBAAgB,yBAAyB,CAAC,EACxC,YAAiB,EACjB,gBAAqB,EACrB,GAAG,EACH,GAAG,GACJ,GAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACT,UAUL;AAED,wBAAgB,6BAA6B,CAAC,YAAY,SAAS,MAAM,GAAG,MAAM,EAChF,KAAK,EAAE,MAAM,GACZ,mBAAmB,CAAC,YAAY,CAAC,CAcnC"}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { getConst } from '../../libs/config';
|
2
|
+
import { sign, verify } from './secret';
|
3
|
+
class InternalTokenError extends Error {
|
4
|
+
constructor(message) {
|
5
|
+
super(message);
|
6
|
+
this.name = 'InternalTokenError';
|
7
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
function defaultClaims({ expiresInSeconds, sub, aud, }) {
|
11
|
+
return {
|
12
|
+
iss: `${getConst('project-name')}-internal`,
|
13
|
+
iat: Math.floor(Date.now() / 1000),
|
14
|
+
exp: Math.floor(Date.now() / 1000) + expiresInSeconds,
|
15
|
+
sub,
|
16
|
+
aud,
|
17
|
+
};
|
18
|
+
}
|
19
|
+
export function generateInternalAuthToken({ customClaims = {}, expiresInSeconds = 60, sub, aud, } = {}) {
|
20
|
+
const data = {
|
21
|
+
...customClaims,
|
22
|
+
// This should be after the customClaims so that custom claims cannot override the default claims
|
23
|
+
...defaultClaims({ expiresInSeconds, sub, aud }),
|
24
|
+
};
|
25
|
+
const str = JSON.stringify(data);
|
26
|
+
const encodedData = Buffer.from(str).toString('base64');
|
27
|
+
const signature = sign(encodedData);
|
28
|
+
return `${encodedData}.${signature}`;
|
29
|
+
}
|
30
|
+
export function parseInternalAuthTokenOrThrow(token) {
|
31
|
+
const [encodedData, signature] = token.split('.');
|
32
|
+
const isSignatureOk = verify(encodedData, signature);
|
33
|
+
if (!isSignatureOk) {
|
34
|
+
throw new InternalTokenError('Invalid token');
|
35
|
+
}
|
36
|
+
const dataStr = Buffer.from(encodedData, 'base64').toString('utf-8');
|
37
|
+
const data = JSON.parse(dataStr);
|
38
|
+
if (data.exp < Math.floor(Date.now() / 1000)) {
|
39
|
+
throw new InternalTokenError('Token expired');
|
40
|
+
}
|
41
|
+
return data;
|
42
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"internal-token.spec.d.ts","sourceRoot":"","sources":["../../../src/app-support/crypto/internal-token.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
2
|
+
import { generateInternalAuthToken, parseInternalAuthTokenOrThrow } from './internal-token';
|
3
|
+
vi.mock('../../libs/config', () => ({
|
4
|
+
getConst: () => 'test',
|
5
|
+
}));
|
6
|
+
describe('generate and verify internal token', () => {
|
7
|
+
beforeEach(() => {
|
8
|
+
process.env.MONOREPO_BASE_SECRET = '1234567890abcdef';
|
9
|
+
});
|
10
|
+
it('works for default tokens', () => {
|
11
|
+
const token = generateInternalAuthToken();
|
12
|
+
const parsedPayload = parseInternalAuthTokenOrThrow(token);
|
13
|
+
expect(parsedPayload.iss).toEqual('test-internal');
|
14
|
+
expect(parsedPayload.exp - parsedPayload.iat).toEqual(60);
|
15
|
+
});
|
16
|
+
it('works for custom tokens', () => {
|
17
|
+
const payload = { hello: 'world' };
|
18
|
+
const token = generateInternalAuthToken({
|
19
|
+
customClaims: payload,
|
20
|
+
expiresInSeconds: 30,
|
21
|
+
aud: 'aud',
|
22
|
+
sub: 'sub',
|
23
|
+
});
|
24
|
+
const parsedPayload = parseInternalAuthTokenOrThrow(token);
|
25
|
+
expect(parsedPayload.iss).toEqual('test-internal');
|
26
|
+
expect(parsedPayload.exp - parsedPayload.iat).toEqual(30);
|
27
|
+
expect(parsedPayload.hello).toEqual('world');
|
28
|
+
expect(parsedPayload.aud).toEqual('aud');
|
29
|
+
expect(parsedPayload.sub).toEqual('sub');
|
30
|
+
});
|
31
|
+
it('throws for expired tokens', () => {
|
32
|
+
const invalidToken = generateInternalAuthToken({
|
33
|
+
expiresInSeconds: -1,
|
34
|
+
});
|
35
|
+
expect(() => parseInternalAuthTokenOrThrow(invalidToken)).toThrowError('Token expired');
|
36
|
+
});
|
37
|
+
it('throws for invalid signature', () => {
|
38
|
+
const payload = { hello: 'world' };
|
39
|
+
const token = generateInternalAuthToken({
|
40
|
+
customClaims: payload,
|
41
|
+
});
|
42
|
+
const invalidToken = token.replace(/.$/, 'x');
|
43
|
+
expect(() => parseInternalAuthTokenOrThrow(invalidToken)).toThrowError('Invalid token');
|
44
|
+
});
|
45
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../../src/app-support/crypto/secret.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,UAKhC;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,WAGrD"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { createHmac } from 'crypto';
|
2
|
+
export function sign(data) {
|
3
|
+
const keyStr = process.env.MONOREPO_BASE_SECRET;
|
4
|
+
if (!keyStr)
|
5
|
+
throw new Error('Secret not set');
|
6
|
+
const key = Buffer.from(keyStr, 'hex');
|
7
|
+
return createHmac('sha256', key).update(data).digest('hex');
|
8
|
+
}
|
9
|
+
export function verify(data, signature) {
|
10
|
+
const generatedSignature = sign(data);
|
11
|
+
return generatedSignature === signature;
|
12
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"secret.spec.d.ts","sourceRoot":"","sources":["../../../src/app-support/crypto/secret.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { beforeEach, describe, expect, it } from 'vitest';
|
2
|
+
import { sign, verify } from './secret';
|
3
|
+
describe('sign and verify', () => {
|
4
|
+
beforeEach(() => {
|
5
|
+
process.env.MONOREPO_BASE_SECRET = '1234567890abcdef';
|
6
|
+
});
|
7
|
+
it('verify should return true for correct signature', async () => {
|
8
|
+
const sig = sign('data');
|
9
|
+
expect(verify('data', sig)).toEqual(true);
|
10
|
+
});
|
11
|
+
it('verify should return false for correct signature', async () => {
|
12
|
+
const sig = sign('data');
|
13
|
+
expect(verify('data2', sig)).toEqual(false);
|
14
|
+
});
|
15
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dev-discovery-loader.d.ts","sourceRoot":"","sources":["../../../src/app-support/discovery/dev-discovery-loader.ts"],"names":[],"mappings":"AAgCA,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,UAExD"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { workspaces } from "../../libs/discovery";
|
2
|
+
let _portLookupByServiceName = null;
|
3
|
+
function getPortLookup() {
|
4
|
+
if (_portLookupByServiceName)
|
5
|
+
return _portLookupByServiceName;
|
6
|
+
if (process.env["IS_KUBERNETES"] === "true") {
|
7
|
+
throw new Error("getPortLookup() should only be used in local development. In production, the service name is sufficient.");
|
8
|
+
}
|
9
|
+
_portLookupByServiceName = {};
|
10
|
+
Object.values(workspaces()).forEach((workspace) => {
|
11
|
+
workspace.packageDataEntries.forEach((pkg) => {
|
12
|
+
const serviceName = pkg.deployment?.service_name;
|
13
|
+
const port = pkg.deployment?.port;
|
14
|
+
if (!serviceName || !port)
|
15
|
+
return;
|
16
|
+
const existing = _portLookupByServiceName[serviceName];
|
17
|
+
if (!existing) {
|
18
|
+
_portLookupByServiceName[serviceName] = port;
|
19
|
+
}
|
20
|
+
else if (existing !== port) {
|
21
|
+
console.error(`Service name ${serviceName} has conflicting ports: ${existing} and ${port}`);
|
22
|
+
process.exit(1);
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});
|
26
|
+
return _portLookupByServiceName;
|
27
|
+
}
|
28
|
+
export function getPortForServiceName(serviceName) {
|
29
|
+
return getPortLookup()[serviceName];
|
30
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"service-endpoint.d.ts","sourceRoot":"","sources":["../../../src/app-support/discovery/service-endpoint.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAS9D"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { getPortForServiceName } from "./dev-discovery-loader";
|
2
|
+
export function getServiceEndpoint(serviceName) {
|
3
|
+
if (process.env["IS_KUBERNETES"] === "true") {
|
4
|
+
return `http://${serviceName}`;
|
5
|
+
}
|
6
|
+
const servicePort = getPortForServiceName(serviceName);
|
7
|
+
if (!servicePort)
|
8
|
+
throw new Error(`Port not found for service ${serviceName}`);
|
9
|
+
return `http://127.0.0.1:${servicePort}`;
|
10
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { CLICommandParser } from "./common";
|
2
|
+
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
3
|
+
declare const _default: {
|
4
|
+
affected: {
|
5
|
+
oneLiner: string;
|
6
|
+
keyExamples: string;
|
7
|
+
run: typeof run;
|
8
|
+
};
|
9
|
+
};
|
10
|
+
export default _default;
|
11
|
+
//# sourceMappingURL=affected.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"affected.d.ts","sourceRoot":"","sources":["../../src/cli/affected.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,UAAU,CAAC;AAoD7E,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAoD1C;;;;;;;;AAED,wBAEE"}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import { findImagesAffected, findImagesWithAffectedWorkspace, isImageAffected, isWorkspaceAffected, } from "../libs/affected-entities";
|
2
|
+
import { getImageData } from "../libs/config";
|
3
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "./common";
|
4
|
+
const oneLiner = "Command to check whether an image or a workspace is affected by certain commit(s)";
|
5
|
+
const keyExamples = `
|
6
|
+
$ devops affected list-images
|
7
|
+
$ devops affected workspace db --base <sha1> --head <sha2>
|
8
|
+
$ devops affected image main-node --from-live-version
|
9
|
+
$ devops affected find-migrator --from-live-version
|
10
|
+
`;
|
11
|
+
const usage = `
|
12
|
+
${oneLiner}
|
13
|
+
|
14
|
+
GENERAL USAGE
|
15
|
+
List
|
16
|
+
devops affected list-images --base [SHA1] --head [SHA2]
|
17
|
+
devops affected list-images --from-live-version
|
18
|
+
|
19
|
+
These return a list of all images affected by the given commits.
|
20
|
+
|
21
|
+
Checkers
|
22
|
+
devops affected workspace <workspace> --base [SHA1] --head [SHA2]
|
23
|
+
|
24
|
+
devops affected image <image> --base [SHA1] --head [SHA2]
|
25
|
+
devops affected image <image> --from-live-version
|
26
|
+
|
27
|
+
These return "true" or "false".
|
28
|
+
|
29
|
+
Finders
|
30
|
+
devops affected find-migrator --base [SHA1] --head [SHA2]
|
31
|
+
devops affected find-migrator --from-live-version
|
32
|
+
|
33
|
+
When --base and --head are used, it checks whether the db project is affected. If it is, it returns the name of one random
|
34
|
+
affected image.
|
35
|
+
When --from-live-version is used, it iterates on the live version of each image that depends on db, and returns the first image that is
|
36
|
+
affected by a db project change since that commit.
|
37
|
+
|
38
|
+
If the db project is unaffected, returns an empty string.
|
39
|
+
|
40
|
+
Options
|
41
|
+
Which commits are regarded for the affected calculation can be changed using:
|
42
|
+
--base Base of the current branch (HEAD^ by default)
|
43
|
+
--head Latest commit of the current branch (HEAD by default)
|
44
|
+
--from-live-version Use the live version of the image/workspace as the base (see devops image version get)
|
45
|
+
|
46
|
+
If --from-live-version is present, --base and --head are ignored.
|
47
|
+
|
48
|
+
EXAMPLES
|
49
|
+
${keyExamples.trim()}
|
50
|
+
`;
|
51
|
+
async function run(cmdObj) {
|
52
|
+
const options = cmdObj.parseOptions({
|
53
|
+
params: ["--base", "--head"],
|
54
|
+
booleans: ["--from-live-version"],
|
55
|
+
});
|
56
|
+
if (cmdObj.help || options.args.length < 1)
|
57
|
+
printUsageAndExit(usage);
|
58
|
+
const baseSha = options.options["--base"]?.toString();
|
59
|
+
const headSha = options.options["--head"]?.toString();
|
60
|
+
const fromLiveVersion = Boolean(options.options["--from-live-version"]);
|
61
|
+
const commonOpts = {
|
62
|
+
baseSha,
|
63
|
+
headSha,
|
64
|
+
fromLiveVersion,
|
65
|
+
monorepoEnv: cmdObj.env,
|
66
|
+
};
|
67
|
+
const [cmd, imageOrWorkspace] = options.args;
|
68
|
+
const params = new StrongParams(usage, { imageOrWorkspace });
|
69
|
+
switch (cmd) {
|
70
|
+
case "list-images": {
|
71
|
+
console.log(findImagesAffected(commonOpts).join("\n"));
|
72
|
+
break;
|
73
|
+
}
|
74
|
+
case "workspace": {
|
75
|
+
// prettier-ignore
|
76
|
+
const affected = isWorkspaceAffected(params.required("imageOrWorkspace"), commonOpts);
|
77
|
+
console.log(affected ? "true" : "false");
|
78
|
+
break;
|
79
|
+
}
|
80
|
+
case "image": {
|
81
|
+
const affected = isImageAffected(params.required("imageOrWorkspace"), commonOpts);
|
82
|
+
console.log(affected ? "true" : "false");
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
case "find-migrator": {
|
86
|
+
const migrator = findImagesWithAffectedWorkspace("db", commonOpts);
|
87
|
+
if (!migrator.length)
|
88
|
+
break;
|
89
|
+
const firstMigrator = migrator.find(imageName => getImageData(imageName)["can-db-migrate"]);
|
90
|
+
if (!firstMigrator) {
|
91
|
+
console.error(`The db project was changed and affects the following images: ${migrator.join(", ")}. However, no image in the list has can-db-migrate=true in .devops/config/images.yaml.`);
|
92
|
+
process.exit(1);
|
93
|
+
}
|
94
|
+
console.log(firstMigrator);
|
95
|
+
break;
|
96
|
+
}
|
97
|
+
default:
|
98
|
+
printUsageAndExit(usage);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
export default {
|
102
|
+
affected: { oneLiner, keyExamples, run },
|
103
|
+
};
|
@@ -0,0 +1,89 @@
|
|
1
|
+
type ParsedArgs = {
|
2
|
+
args: string[];
|
3
|
+
argsStr: string;
|
4
|
+
options: {
|
5
|
+
[key: string]: string | boolean;
|
6
|
+
};
|
7
|
+
passthrough?: string[];
|
8
|
+
};
|
9
|
+
export declare class CLICommandParser {
|
10
|
+
command: string;
|
11
|
+
args: string[];
|
12
|
+
env: string;
|
13
|
+
envForced: boolean;
|
14
|
+
help: boolean;
|
15
|
+
skipEnvCheck: boolean;
|
16
|
+
constructor(cmdArray: string[]);
|
17
|
+
executorFromEnv(commandStr: string, options?: Omit<CommandExecutorOptions, "env">): CommandExecutor;
|
18
|
+
parseOptions({ params, booleans, passthroughArgs, }?: {
|
19
|
+
/** Param is used like so: --param value */
|
20
|
+
params?: string[];
|
21
|
+
/** Boolean flag is used like so: --flag */
|
22
|
+
booleans?: string[];
|
23
|
+
/** Pass through args are used like so: -- arg1 arg2 */
|
24
|
+
passthroughArgs?: boolean;
|
25
|
+
}): ParsedArgs;
|
26
|
+
_validateEnv(env: string): boolean;
|
27
|
+
_separateOptions(args: string[], { params, booleans, passthroughArgs, }?: {
|
28
|
+
params?: string[];
|
29
|
+
booleans?: string[];
|
30
|
+
passthroughArgs?: boolean;
|
31
|
+
}): ParsedArgs;
|
32
|
+
}
|
33
|
+
type CommandExecutorOptions = {
|
34
|
+
env?: string;
|
35
|
+
quiet?: boolean;
|
36
|
+
checkEnvYaml?: boolean;
|
37
|
+
redactedCommand?: string;
|
38
|
+
};
|
39
|
+
export declare class CommandExecutor {
|
40
|
+
commandStr: string;
|
41
|
+
env?: string;
|
42
|
+
quiet: boolean;
|
43
|
+
redactedCommand?: string;
|
44
|
+
checkEnvYaml: boolean;
|
45
|
+
constructor(commandStr: string, { env, quiet, redactedCommand, checkEnvYaml, }?: CommandExecutorOptions);
|
46
|
+
/** Non-interactive use only. stdout is returned. */
|
47
|
+
exec(options?: {
|
48
|
+
onlyStatusCode?: false;
|
49
|
+
asObject?: false;
|
50
|
+
env?: object;
|
51
|
+
}): string;
|
52
|
+
exec(options: {
|
53
|
+
onlyStatusCode?: false;
|
54
|
+
asObject: true;
|
55
|
+
env?: object;
|
56
|
+
}): {
|
57
|
+
statusCode: number;
|
58
|
+
stdout: string;
|
59
|
+
stderr: string;
|
60
|
+
};
|
61
|
+
exec(options: {
|
62
|
+
onlyStatusCode: true;
|
63
|
+
asObject?: boolean;
|
64
|
+
env?: object;
|
65
|
+
}): number;
|
66
|
+
/** Should be used for CLI commands intended to be used locally. Provides interactivity. Unlike exec(), stdout is not returned. */
|
67
|
+
spawn({ env }?: {
|
68
|
+
env?: {} | undefined;
|
69
|
+
}): Promise<unknown>;
|
70
|
+
_prepareFullCommand(): string;
|
71
|
+
_getProcessEnv(envOverride?: {}): {
|
72
|
+
MONOREPO_ENV: string | undefined;
|
73
|
+
TZ?: string;
|
74
|
+
NODE_ENV?: string;
|
75
|
+
};
|
76
|
+
_envInjectorPrefix(): string;
|
77
|
+
_checkEnvYamlFiles(): void;
|
78
|
+
}
|
79
|
+
export declare function dotEnvFilesForEnv(env?: string): string[];
|
80
|
+
export declare function printUsageAndExit(text: string): never;
|
81
|
+
export declare class StrongParams {
|
82
|
+
private usage;
|
83
|
+
private args;
|
84
|
+
constructor(usage: string, args: Record<string, string | undefined>);
|
85
|
+
required(key: string): string;
|
86
|
+
optional(key: string): string | undefined;
|
87
|
+
}
|
88
|
+
export {};
|
89
|
+
//# sourceMappingURL=common.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/cli/common.ts"],"names":[],"mappings":"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"}
|