@vaharoni/devops 1.2.13 → 1.2.14
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/dist/chunk-N7EX3HJH.js +139 -0
- package/dist/chunk-RZ46YYZZ.js +420 -0
- package/dist/chunk-WKP7EQNU.js +421 -0
- package/dist/devops.d.ts +0 -2
- package/dist/devops.js +3235 -91
- package/dist/index.d.ts +972 -4
- package/dist/index.js +67 -3
- package/dist/plugins.d.ts +95 -4
- package/dist/plugins.js +20 -6
- package/dist/src/target-templates/README.md +1 -0
- package/dist/src/target-templates/cluster-resource-options/README.md +2 -0
- package/dist/src/target-templates/cluster-resource-options/dns-test/dns-test.yaml +60 -0
- package/dist/src/target-templates/cluster-resource-options/milvus/production/milvus-values.yaml +2 -0
- package/dist/src/target-templates/cluster-resource-options/milvus/staging/milvus-values.yaml +2 -0
- package/dist/src/target-templates/cluster-resource-options/monitoring-ingress/monitoring-ingress.yaml +62 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/daily-operator-restart.yaml +54 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/cluster/PodDisruptionBudget.yaml +27 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/cluster/SGCluster.yaml +47 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/cluster/StackGres-alerts.yaml +191 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/configurations/06-SGDistributedLogs.yaml +11 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/configurations/07-SGObjectStorage.yaml +18 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/configurations/08-SGScript.yaml +12 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/stackgres-ui-ingress.yaml +35 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/staging/cluster/SGCluster.yaml +42 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/staging/configurations/07-SGObjectStorage.yaml +18 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/staging/configurations/08-SGScript.yaml +12 -0
- package/dist/src/target-templates/cluster-resource-options/prefect/production/prefect-values.yaml +14 -0
- package/dist/src/target-templates/cluster-resource-options/prefect/staging/prefect-values.yaml +14 -0
- package/dist/src/target-templates/cluster-resource-options/redis/production/redis-values.yaml +20 -0
- package/dist/src/target-templates/cluster-resource-options/redis/staging/redis-values.yaml +8 -0
- package/dist/src/target-templates/infra-variants/README.md +2 -0
- package/dist/src/target-templates/infra-variants/digitalocean/.devops/config/constants.yaml +18 -0
- package/dist/src/target-templates/infra-variants/digitalocean/.github/workflows/k8s-build.yaml +91 -0
- package/dist/src/target-templates/infra-variants/gcloud/.devops/config/constants.yaml +15 -0
- package/dist/src/target-templates/infra-variants/gcloud/.devops/manifests/ingress.yaml.hb +22 -0
- package/dist/src/target-templates/infra-variants/gcloud/.github/workflows/k8s-build.yaml +95 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/config/constants.yaml +18 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/abandoned/harbor-values.yaml +30 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/abandoned/hcloud-config.yaml +134 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/cert-manager.yaml +25 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/harbor-cert.yaml +13 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/harbor-values.yaml +76 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/hcloud-config.yaml +113 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/ingress-nginx-annotations.yaml +49 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/ingress-nginx-configmap.yaml +8 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/retain-storage-class.yaml +8 -0
- package/dist/src/target-templates/infra-variants/hetzner/.github/workflows/k8s-build.yaml +93 -0
- package/dist/src/target-templates/lang-variants-common/README.md +4 -0
- package/dist/src/target-templates/lang-variants-common/python/.cursor/rules/monorepo-python.mdc +56 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/config/images.yaml +89 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/docker-images/python-services/python-exec.sh +8 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/docker-images/python-services/python-run.sh +8 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/docker-images/python-services.Dockerfile +29 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/manifests/_index.yaml +21 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/manifests/prefect.yaml.hb +63 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-data-pipeline/pyproject.toml +14 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-data-pipeline/src/example_data_pipeline/main.py +38 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/pyproject.toml +20 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/src/example_python/__init__.py +0 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/src/example_python/main.py +13 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/src/example_python/scripts.py +17 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/tests/__init__.py +0 -0
- package/dist/src/target-templates/lang-variants-common/python/devopspy +3 -0
- package/dist/src/target-templates/lang-variants-common/python/libs/example-python-lib/pyproject.toml +11 -0
- package/dist/src/target-templates/lang-variants-common/python/libs/example-python-lib/src/example_python_lib/__init__.py +2 -0
- package/dist/src/target-templates/lang-variants-common/python/pyproject.toml +16 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.cursor/rules/monorepo-typescript.mdc +51 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/config/images.yaml +69 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/cloudrun.Dockerfile +31 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/common/docker-common.sh +23 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/node-services/node-exec.sh +8 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/node-services/node-run.sh +8 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/node-services.Dockerfile +31 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/env.example.yaml +23 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/_index.yaml +19 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/cron-jobs.yaml.hb +56 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/db-migrate-job.yaml.hb +43 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/deployment-debug.yaml.hb +42 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/deployment-process.yaml.hb +48 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/deployment-web.yaml.hb +54 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/ingress.yaml.hb +21 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/service.yaml.hb +15 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.envrc +5 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/build-image@v1/action.yaml +81 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/connect-to-digital-ocean@v1/action.yaml +29 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/connect-to-gke@v1/action.yaml +43 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/connect-to-hetzner@v1/action.yaml +31 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/db-migrate@v1/action.yaml +23 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/deploy-image-cloudrun@v1/action.yaml +71 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/deploy-image-k8s@v1/action.yaml +37 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/setup-prereq@v1/action.yaml +24 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/example-node/index.ts +30 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/example-node/package.json +26 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/example-node/tsconfig.json +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/README.md +68 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/index.ts +1 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/package.json +30 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/tsconfig.json +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/config/.env.development +1 -0
- package/dist/src/target-templates/lang-variants-common/typescript/config/.env.global +4 -0
- package/dist/src/target-templates/lang-variants-common/typescript/config/.env.test +1 -0
- package/dist/src/target-templates/lang-variants-common/typescript/devops +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/libs/example-node-lib/index.ts +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/libs/example-node-lib/package.json +12 -0
- package/dist/src/target-templates/lang-variants-common/typescript/libs/example-node-lib/tsconfig.json +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/tmp/.gitkeep +0 -0
- package/dist/src/target-templates/lang-variants-common/typescript/tsconfig.json +27 -0
- package/dist/src/target-templates/lang-variants-prisma/README.md +3 -0
- package/dist/src/target-templates/lang-variants-prisma/python/.cursor/rules/prisma-python.mdc +55 -0
- package/dist/src/target-templates/lang-variants-prisma/python/.cursor/rules/testing-python.mdc +89 -0
- package/dist/src/target-templates/lang-variants-prisma/python/db/db/__init__.py +0 -0
- package/dist/src/target-templates/lang-variants-prisma/python/db/db/db_client_test.py +46 -0
- package/dist/src/target-templates/lang-variants-prisma/python/db/pyproject.toml +14 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/.cursor/rules/prisma-typescript.mdc +54 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/.cursor/rules/testing-typescript.mdc +103 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/db-client-test.ts +142 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/db-client.ts +19 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/env.yaml +4 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/package.json +17 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/prisma/schema.prisma +24 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/prisma-setup-vitest.ts +27 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/tsconfig.json +3 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/dml/package.json +7 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/dml/tsconfig.json +3 -0
- package/package.json +3 -2
- package/src/cli/core/exec.ts +2 -4
- package/src/cli/core/run.ts +2 -4
- package/src/cli/extensions/prisma.ts +2 -4
- package/src/libs/init-generator.ts +2 -4
- package/src/pkg-root.ts +14 -0
- package/src/plugins.ts +2 -4
- package/dist/app-support/crypto/aes.d.ts +0 -15
- package/dist/app-support/crypto/aes.d.ts.map +0 -1
- package/dist/app-support/crypto/aes.js +0 -56
- package/dist/app-support/crypto/aes.spec.d.ts +0 -2
- package/dist/app-support/crypto/aes.spec.d.ts.map +0 -1
- package/dist/app-support/crypto/aes.spec.js +0 -58
- package/dist/app-support/crypto/index.d.ts +0 -16
- package/dist/app-support/crypto/index.d.ts.map +0 -1
- package/dist/app-support/crypto/index.js +0 -31
- package/dist/app-support/crypto/internal-token.d.ts +0 -20
- package/dist/app-support/crypto/internal-token.d.ts.map +0 -1
- package/dist/app-support/crypto/internal-token.js +0 -42
- package/dist/app-support/crypto/internal-token.spec.d.ts +0 -2
- package/dist/app-support/crypto/internal-token.spec.d.ts.map +0 -1
- package/dist/app-support/crypto/internal-token.spec.js +0 -45
- package/dist/app-support/crypto/secret.d.ts +0 -3
- package/dist/app-support/crypto/secret.d.ts.map +0 -1
- package/dist/app-support/crypto/secret.js +0 -12
- package/dist/app-support/crypto/secret.spec.d.ts +0 -2
- package/dist/app-support/crypto/secret.spec.d.ts.map +0 -1
- package/dist/app-support/crypto/secret.spec.js +0 -15
- package/dist/app-support/discovery/dev-discovery-loader.d.ts +0 -2
- package/dist/app-support/discovery/dev-discovery-loader.d.ts.map +0 -1
- package/dist/app-support/discovery/dev-discovery-loader.js +0 -30
- package/dist/app-support/discovery/service-endpoint.d.ts +0 -2
- package/dist/app-support/discovery/service-endpoint.d.ts.map +0 -1
- package/dist/app-support/discovery/service-endpoint.js +0 -10
- package/dist/cli/common.d.ts +0 -89
- package/dist/cli/common.d.ts.map +0 -1
- package/dist/cli/common.js +0 -246
- package/dist/cli/common.spec.d.ts +0 -2
- package/dist/cli/common.spec.d.ts.map +0 -1
- package/dist/cli/common.spec.js +0 -64
- package/dist/cli/core/affected.d.ts +0 -9
- package/dist/cli/core/affected.d.ts.map +0 -1
- package/dist/cli/core/affected.js +0 -101
- package/dist/cli/core/cloudrun.d.ts +0 -9
- package/dist/cli/core/cloudrun.d.ts.map +0 -1
- package/dist/cli/core/cloudrun.js +0 -119
- package/dist/cli/core/console.d.ts +0 -10
- package/dist/cli/core/console.d.ts.map +0 -1
- package/dist/cli/core/console.js +0 -50
- package/dist/cli/core/constant.d.ts +0 -9
- package/dist/cli/core/constant.d.ts.map +0 -1
- package/dist/cli/core/constant.js +0 -20
- package/dist/cli/core/env.d.ts +0 -9
- package/dist/cli/core/env.d.ts.map +0 -1
- package/dist/cli/core/env.js +0 -65
- package/dist/cli/core/exec.d.ts +0 -9
- package/dist/cli/core/exec.d.ts.map +0 -1
- package/dist/cli/core/exec.js +0 -48
- package/dist/cli/core/image.d.ts +0 -9
- package/dist/cli/core/image.d.ts.map +0 -1
- package/dist/cli/core/image.js +0 -153
- package/dist/cli/core/index.d.ts +0 -16
- package/dist/cli/core/index.d.ts.map +0 -1
- package/dist/cli/core/index.js +0 -15
- package/dist/cli/core/init.d.ts +0 -9
- package/dist/cli/core/init.d.ts.map +0 -1
- package/dist/cli/core/init.js +0 -219
- package/dist/cli/core/job.d.ts +0 -9
- package/dist/cli/core/job.d.ts.map +0 -1
- package/dist/cli/core/job.js +0 -65
- package/dist/cli/core/namespace.d.ts +0 -9
- package/dist/cli/core/namespace.d.ts.map +0 -1
- package/dist/cli/core/namespace.js +0 -67
- package/dist/cli/core/prep-build.d.ts +0 -10
- package/dist/cli/core/prep-build.d.ts.map +0 -1
- package/dist/cli/core/prep-build.js +0 -109
- package/dist/cli/core/registry.d.ts +0 -9
- package/dist/cli/core/registry.d.ts.map +0 -1
- package/dist/cli/core/registry.js +0 -66
- package/dist/cli/core/run-many.d.ts +0 -10
- package/dist/cli/core/run-many.d.ts.map +0 -1
- package/dist/cli/core/run-many.js +0 -48
- package/dist/cli/core/run.d.ts +0 -9
- package/dist/cli/core/run.d.ts.map +0 -1
- package/dist/cli/core/run.js +0 -35
- package/dist/cli/core/test.d.ts +0 -9
- package/dist/cli/core/test.d.ts.map +0 -1
- package/dist/cli/core/test.js +0 -26
- package/dist/cli/extensions/dml.d.ts +0 -9
- package/dist/cli/extensions/dml.d.ts.map +0 -1
- package/dist/cli/extensions/dml.js +0 -114
- package/dist/cli/extensions/index.d.ts +0 -9
- package/dist/cli/extensions/index.d.ts.map +0 -1
- package/dist/cli/extensions/index.js +0 -8
- package/dist/cli/extensions/internal-curl.d.ts +0 -10
- package/dist/cli/extensions/internal-curl.d.ts.map +0 -1
- package/dist/cli/extensions/internal-curl.js +0 -41
- package/dist/cli/extensions/jwt.d.ts +0 -9
- package/dist/cli/extensions/jwt.d.ts.map +0 -1
- package/dist/cli/extensions/jwt.js +0 -25
- package/dist/cli/extensions/prisma.d.ts +0 -9
- package/dist/cli/extensions/prisma.d.ts.map +0 -1
- package/dist/cli/extensions/prisma.js +0 -23
- package/dist/cli/extensions/redis-bitnami.d.ts +0 -11
- package/dist/cli/extensions/redis-bitnami.d.ts.map +0 -1
- package/dist/cli/extensions/redis-bitnami.js +0 -74
- package/dist/cli/extensions/redis-ha.d.ts +0 -11
- package/dist/cli/extensions/redis-ha.d.ts.map +0 -1
- package/dist/cli/extensions/redis-ha.js +0 -51
- package/dist/cli/extensions/stackgres.d.ts +0 -10
- package/dist/cli/extensions/stackgres.d.ts.map +0 -1
- package/dist/cli/extensions/stackgres.js +0 -117
- package/dist/cli/extensions/template.d.ts +0 -9
- package/dist/cli/extensions/template.d.ts.map +0 -1
- package/dist/cli/extensions/template.js +0 -121
- package/dist/devops.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/libs/affected-entities.d.ts +0 -15
- package/dist/libs/affected-entities.d.ts.map +0 -1
- package/dist/libs/affected-entities.js +0 -52
- package/dist/libs/cloudrun-helpers.d.ts +0 -16
- package/dist/libs/cloudrun-helpers.d.ts.map +0 -1
- package/dist/libs/cloudrun-helpers.js +0 -81
- package/dist/libs/config.d.ts +0 -7
- package/dist/libs/config.d.ts.map +0 -1
- package/dist/libs/config.js +0 -102
- package/dist/libs/digital-ocean/container-reg.d.ts +0 -6
- package/dist/libs/digital-ocean/container-reg.d.ts.map +0 -1
- package/dist/libs/digital-ocean/container-reg.js +0 -74
- package/dist/libs/discovery/dependencies.d.ts +0 -19
- package/dist/libs/discovery/dependencies.d.ts.map +0 -1
- package/dist/libs/discovery/dependencies.js +0 -62
- package/dist/libs/discovery/dependencies.spec.d.ts +0 -2
- package/dist/libs/discovery/dependencies.spec.d.ts.map +0 -1
- package/dist/libs/discovery/dependencies.spec.js +0 -21
- package/dist/libs/discovery/images.d.ts +0 -5
- package/dist/libs/discovery/images.d.ts.map +0 -1
- package/dist/libs/discovery/images.js +0 -45
- package/dist/libs/discovery/index.d.ts +0 -6
- package/dist/libs/discovery/index.d.ts.map +0 -1
- package/dist/libs/discovery/index.js +0 -67
- package/dist/libs/discovery/process-common.d.ts +0 -25
- package/dist/libs/discovery/process-common.d.ts.map +0 -1
- package/dist/libs/discovery/process-common.js +0 -40
- package/dist/libs/discovery/process-package-json.d.ts +0 -3
- package/dist/libs/discovery/process-package-json.d.ts.map +0 -1
- package/dist/libs/discovery/process-package-json.js +0 -40
- package/dist/libs/discovery/process-pyproject-toml.d.ts +0 -3
- package/dist/libs/discovery/process-pyproject-toml.d.ts.map +0 -1
- package/dist/libs/discovery/process-pyproject-toml.js +0 -49
- package/dist/libs/git-helpers.d.ts +0 -8
- package/dist/libs/git-helpers.d.ts.map +0 -1
- package/dist/libs/git-helpers.js +0 -20
- package/dist/libs/hetzner/reg-secret.d.ts +0 -3
- package/dist/libs/hetzner/reg-secret.d.ts.map +0 -1
- package/dist/libs/hetzner/reg-secret.js +0 -39
- package/dist/libs/init-generator.d.ts +0 -41
- package/dist/libs/init-generator.d.ts.map +0 -1
- package/dist/libs/init-generator.js +0 -123
- package/dist/libs/k8s-constants.d.ts +0 -13
- package/dist/libs/k8s-constants.d.ts.map +0 -1
- package/dist/libs/k8s-constants.js +0 -91
- package/dist/libs/k8s-db.d.ts +0 -18
- package/dist/libs/k8s-db.d.ts.map +0 -1
- package/dist/libs/k8s-db.js +0 -73
- package/dist/libs/k8s-generate.d.ts +0 -17
- package/dist/libs/k8s-generate.d.ts.map +0 -1
- package/dist/libs/k8s-generate.js +0 -193
- package/dist/libs/k8s-helpers.d.ts +0 -11
- package/dist/libs/k8s-helpers.d.ts.map +0 -1
- package/dist/libs/k8s-helpers.js +0 -42
- package/dist/libs/k8s-image-config.d.ts +0 -8
- package/dist/libs/k8s-image-config.d.ts.map +0 -1
- package/dist/libs/k8s-image-config.js +0 -113
- package/dist/libs/k8s-job-waiter.d.ts +0 -8
- package/dist/libs/k8s-job-waiter.d.ts.map +0 -1
- package/dist/libs/k8s-job-waiter.js +0 -84
- package/dist/libs/k8s-namespace.d.ts +0 -7
- package/dist/libs/k8s-namespace.d.ts.map +0 -1
- package/dist/libs/k8s-namespace.js +0 -27
- package/dist/libs/k8s-redis-bitnami.d.ts +0 -6
- package/dist/libs/k8s-redis-bitnami.d.ts.map +0 -1
- package/dist/libs/k8s-redis-bitnami.js +0 -31
- package/dist/libs/k8s-redis-ha.d.ts +0 -3
- package/dist/libs/k8s-redis-ha.d.ts.map +0 -1
- package/dist/libs/k8s-redis-ha.js +0 -15
- package/dist/libs/k8s-secrets-manager.d.ts +0 -6
- package/dist/libs/k8s-secrets-manager.d.ts.map +0 -1
- package/dist/libs/k8s-secrets-manager.js +0 -64
- package/dist/libs/validate-env.d.ts +0 -56
- package/dist/libs/validate-env.d.ts.map +0 -1
- package/dist/libs/validate-env.js +0 -214
- package/dist/libs/validate-env.spec.d.ts +0 -2
- package/dist/libs/validate-env.spec.d.ts.map +0 -1
- package/dist/libs/validate-env.spec.js +0 -168
- package/dist/plugins.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -939
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -82
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "../../../src/cli/common";
|
|
2
|
-
import { copySecretHarborToNamespace, patchServiceAccountImagePullSecret, } from "../../../src/libs/hetzner/reg-secret";
|
|
3
|
-
import { checkEnvSetup, createEmptyEnvSecret, createNamespace, deleteNamespace, patchBaseSecret } from "../../libs/k8s-namespace";
|
|
4
|
-
const oneLiner = "Creates the basic prerequisites for a monorepo";
|
|
5
|
-
const keyExamples = `
|
|
6
|
-
$ devops namespace create --env staging
|
|
7
|
-
$ devops namespace delete --env staging
|
|
8
|
-
$ devops namespace check --env staging
|
|
9
|
-
`.trim();
|
|
10
|
-
const usage = `
|
|
11
|
-
${oneLiner}
|
|
12
|
-
|
|
13
|
-
GENERAL USAGE
|
|
14
|
-
devops namespcae create|delete|check --env <env>
|
|
15
|
-
|
|
16
|
-
'create' does the following:
|
|
17
|
-
1. Creates the namepace
|
|
18
|
-
2. Creates a secret to hold environment variables (used by devops env) and the base cryptographic secret
|
|
19
|
-
3. On Hetzner, copies the Harbor secret to the namespace and patches the default service account to use it
|
|
20
|
-
|
|
21
|
-
'delete' removes the namespace in kubernetes, which deletes all entities within it.
|
|
22
|
-
|
|
23
|
-
'check' returns exit code 0 if the namespace exists in kubernetes, 1 otherwise.
|
|
24
|
-
|
|
25
|
-
EXAMPLES
|
|
26
|
-
${keyExamples}
|
|
27
|
-
`;
|
|
28
|
-
const handlers = {
|
|
29
|
-
create(opts) {
|
|
30
|
-
const env = opts.required("env");
|
|
31
|
-
createNamespace(env);
|
|
32
|
-
createEmptyEnvSecret(env);
|
|
33
|
-
patchBaseSecret(env);
|
|
34
|
-
copySecretHarborToNamespace(env);
|
|
35
|
-
patchServiceAccountImagePullSecret(env);
|
|
36
|
-
},
|
|
37
|
-
delete(opts) {
|
|
38
|
-
deleteNamespace(opts.required("env"));
|
|
39
|
-
},
|
|
40
|
-
check(opts) {
|
|
41
|
-
const exists = checkEnvSetup(opts.required("env"));
|
|
42
|
-
if (exists)
|
|
43
|
-
return;
|
|
44
|
-
console.error(`
|
|
45
|
-
The environment does not exist in the cluster.
|
|
46
|
-
In order to create resources for it in the cluster, it must be first set up. This is done to protect from unintentional resource creation.
|
|
47
|
-
To set up the environment, run the following from your dev machine:
|
|
48
|
-
$ devops namespace create --env <env>
|
|
49
|
-
`);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
function run(cmdObj) {
|
|
54
|
-
if (cmdObj.help || cmdObj.args.length < 1)
|
|
55
|
-
printUsageAndExit(usage);
|
|
56
|
-
const [command] = cmdObj.args;
|
|
57
|
-
const handler = handlers[command];
|
|
58
|
-
if (!handler) {
|
|
59
|
-
console.error(`Unknown command: ${command}`);
|
|
60
|
-
printUsageAndExit(usage);
|
|
61
|
-
}
|
|
62
|
-
const params = new StrongParams(usage, {
|
|
63
|
-
env: cmdObj.env,
|
|
64
|
-
});
|
|
65
|
-
handler(params);
|
|
66
|
-
}
|
|
67
|
-
export const namespace = { oneLiner, keyExamples, run };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser } from "../common";
|
|
2
|
-
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
-
export declare const prepBuild: {
|
|
4
|
-
command: string;
|
|
5
|
-
oneLiner: string;
|
|
6
|
-
keyExamples: string;
|
|
7
|
-
run: typeof run;
|
|
8
|
-
};
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=prep-build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prep-build.d.ts","sourceRoot":"","sources":["../../../src/cli/core/prep-build.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AA0BhE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBA0F1C;AAED,eAAO,MAAM,SAAS;;;;;CAAwD,CAAC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import fs from "fs-extra";
|
|
2
|
-
import os from "os";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
5
|
-
import { getImageData, getTemplateData } from "../../libs/config";
|
|
6
|
-
import { getMonorepoSecretStr } from "../../libs/k8s-secrets-manager";
|
|
7
|
-
import { getImageDescendentData } from "../../libs/discovery/images";
|
|
8
|
-
import { isLocalOrRemoteEnv } from "../../libs/k8s-constants";
|
|
9
|
-
import chalk from "chalk";
|
|
10
|
-
const oneLiner = "Copies all dependencies of an image to a temporary folder in preparation for a Docker build";
|
|
11
|
-
const keyExamples = `
|
|
12
|
-
$ devops prep-build main-node
|
|
13
|
-
`.trim();
|
|
14
|
-
const usage = `
|
|
15
|
-
${oneLiner}
|
|
16
|
-
|
|
17
|
-
USAGE
|
|
18
|
-
devops prep-build <image> --env <env>
|
|
19
|
-
|
|
20
|
-
If <env> is a remote environment (e.g. staging, production), the environment variables are
|
|
21
|
-
fetched from the cluster and injected in case they are needed during the build process.
|
|
22
|
-
|
|
23
|
-
EXAMPLES
|
|
24
|
-
${keyExamples}
|
|
25
|
-
`;
|
|
26
|
-
async function run(cmdObj) {
|
|
27
|
-
if (cmdObj.help || cmdObj.args.length === 0)
|
|
28
|
-
printUsageAndExit(usage);
|
|
29
|
-
const [image] = cmdObj.args;
|
|
30
|
-
const imageData = getImageData(image);
|
|
31
|
-
const imageTemplate = imageData["image-template"];
|
|
32
|
-
const dockerFile = `${imageTemplate}.Dockerfile`;
|
|
33
|
-
const dockerFilePath = path.join(".devops/docker-images", dockerFile);
|
|
34
|
-
const dockerImagePayloadPath = path.join(".devops/docker-images", imageTemplate);
|
|
35
|
-
const dockerCommonPayloadPath = path.join(".devops/docker-images", "common");
|
|
36
|
-
const imageTemplateData = getTemplateData(imageTemplate);
|
|
37
|
-
const copyCommon = imageTemplateData["copy-common"] ?? false;
|
|
38
|
-
const imageExtraContent = imageTemplateData["extra-content"] ?? [];
|
|
39
|
-
if (!fs.existsSync(dockerFilePath)) {
|
|
40
|
-
console.error(`The dockerfile ${dockerFilePath} does not exist`);
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
imageExtraContent.forEach((file) => {
|
|
44
|
-
if (!fs.existsSync(file)) {
|
|
45
|
-
console.error(`The file ${file} is specified in the extra-content section of ${image} but does not exist`);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const destFolder = `${os.tmpdir()}/image-${image}-${Date.now()}`;
|
|
50
|
-
// Avoid clutter stdout, as the caller will want to capture the final output to cd into it
|
|
51
|
-
console.warn(`Creating build in ${destFolder}`);
|
|
52
|
-
fs.mkdirSync(destFolder);
|
|
53
|
-
// Copy Dockerfile
|
|
54
|
-
console.warn(`COPYING Dockerfile`);
|
|
55
|
-
fs.copySync(dockerFilePath, path.join(destFolder, "Dockerfile"));
|
|
56
|
-
if (copyCommon) {
|
|
57
|
-
console.warn(`COPYING Docker common`);
|
|
58
|
-
fs.copySync(dockerCommonPayloadPath, destFolder);
|
|
59
|
-
}
|
|
60
|
-
if (fs.existsSync(dockerImagePayloadPath)) {
|
|
61
|
-
console.warn(`COPYING Docker image payload`);
|
|
62
|
-
fs.copySync(dockerImagePayloadPath, destFolder);
|
|
63
|
-
}
|
|
64
|
-
console.warn(`COPYING .devops/config`);
|
|
65
|
-
fs.mkdirSync(path.join(destFolder, ".devops"));
|
|
66
|
-
fs.copySync(".devops/config", path.join(destFolder, ".devops/config"));
|
|
67
|
-
// Create config directory. It should be deleted by the docker image so that it can be mounted as a volume when the pod is run
|
|
68
|
-
console.warn(`CREATING config for the build process`);
|
|
69
|
-
fs.mkdirSync(path.join(destFolder, "config"));
|
|
70
|
-
const destGlobalEnvPath = path.join(destFolder, "config/.env.global");
|
|
71
|
-
if (isLocalOrRemoteEnv(cmdObj.env) === "remote") {
|
|
72
|
-
const envFileData = getMonorepoSecretStr(cmdObj.env);
|
|
73
|
-
fs.writeFileSync(destGlobalEnvPath, envFileData);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
let anyCopied = false;
|
|
77
|
-
const localGlobalEnvPath = "config/.env.global";
|
|
78
|
-
const localEnvPath = `config/.env.${cmdObj.env}`;
|
|
79
|
-
const destEnvPath = path.join(destFolder, `config/.env.${cmdObj.env}`);
|
|
80
|
-
if (fs.existsSync(localGlobalEnvPath)) {
|
|
81
|
-
console.warn(`COPYING ${localGlobalEnvPath} to ${destGlobalEnvPath}`);
|
|
82
|
-
fs.copyFileSync(localGlobalEnvPath, destGlobalEnvPath);
|
|
83
|
-
anyCopied = true;
|
|
84
|
-
}
|
|
85
|
-
if (fs.existsSync(localEnvPath)) {
|
|
86
|
-
console.warn(`COPYING ${localEnvPath} to ${destEnvPath}`);
|
|
87
|
-
fs.copyFileSync(localEnvPath, destEnvPath);
|
|
88
|
-
anyCopied = true;
|
|
89
|
-
}
|
|
90
|
-
if (!anyCopied) {
|
|
91
|
-
console.warn(chalk.red(`\nWarning: local environment ${cmdObj.env} has no .env files. Environment variables will not be injected.\n`));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Copy all dependencies
|
|
95
|
-
getImageDescendentData(image).forEach((project) => {
|
|
96
|
-
console.warn(`COPYING ${project.rootPath}`);
|
|
97
|
-
if (project.rootPath === ".devops")
|
|
98
|
-
return;
|
|
99
|
-
fs.copySync(project.rootPath, path.join(destFolder, project.rootPath));
|
|
100
|
-
});
|
|
101
|
-
// Copy image-extra content
|
|
102
|
-
console.warn(`COPYING files from image-extra-content`);
|
|
103
|
-
imageExtraContent.forEach((file) => {
|
|
104
|
-
fs.copySync(file, path.join(destFolder, file));
|
|
105
|
-
console.warn(` ${file}`);
|
|
106
|
-
});
|
|
107
|
-
console.log(destFolder);
|
|
108
|
-
}
|
|
109
|
-
export const prepBuild = { command: 'prep-build', oneLiner, keyExamples, run };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/cli/core/registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AA8D9E,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QAYpC;AAED,eAAO,MAAM,QAAQ;;;;CAAiC,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { getConst } from "../../libs/config";
|
|
2
|
-
import { prune } from "../../libs/digital-ocean/container-reg";
|
|
3
|
-
import { containerRegistryPath, containerRegistryImageName, containerRegistryRepoPath, } from "../../libs/k8s-constants";
|
|
4
|
-
import { CLICommandParser, StrongParams, printUsageAndExit } from "../common";
|
|
5
|
-
const oneLiner = "Manage container repositories";
|
|
6
|
-
const keyExamples = `
|
|
7
|
-
$ devops registry server-url
|
|
8
|
-
$ devops registry reg-url
|
|
9
|
-
$ devops registry repo-url my-image sha
|
|
10
|
-
$ devops registry image-name my-image
|
|
11
|
-
$ devops registry prune my-image
|
|
12
|
-
`.trim();
|
|
13
|
-
const usage = `
|
|
14
|
-
${oneLiner}
|
|
15
|
-
|
|
16
|
-
USAGE
|
|
17
|
-
Get base URLs for the container registry of the cluster:
|
|
18
|
-
devops registry server-url
|
|
19
|
-
devops registry reg-url
|
|
20
|
-
|
|
21
|
-
Note: for cloudrun images these URLs are not relevant.
|
|
22
|
-
|
|
23
|
-
Gets the URL of an image in the container registry:
|
|
24
|
-
devops registry repo-url <image> <sha> --env <env>
|
|
25
|
-
|
|
26
|
-
Gets the image name in the container registry:
|
|
27
|
-
devops registry image-name <image> --env <env>
|
|
28
|
-
|
|
29
|
-
Prunes the repository of old images to enforce the "image-versions-to-keep" constant in config/constants.yaml:
|
|
30
|
-
devops registry prune <image> --env <env>
|
|
31
|
-
|
|
32
|
-
This is only relevant when the "infra" constant is set to "digitalocean".
|
|
33
|
-
|
|
34
|
-
EXAMPLES
|
|
35
|
-
${keyExamples}
|
|
36
|
-
`;
|
|
37
|
-
const handlers = {
|
|
38
|
-
"server-url": () => console.log(getConst("registry-base-url")),
|
|
39
|
-
"reg-url": () => console.log(containerRegistryPath()),
|
|
40
|
-
"repo-url": (opts) => {
|
|
41
|
-
console.log(containerRegistryRepoPath(opts.required("image"), opts.required("env"), opts.required("sha")));
|
|
42
|
-
},
|
|
43
|
-
"image-name": (opts) => {
|
|
44
|
-
console.log(containerRegistryImageName(opts.required("image"), opts.required("env")));
|
|
45
|
-
},
|
|
46
|
-
prune: (opts) => {
|
|
47
|
-
const regName = containerRegistryPath();
|
|
48
|
-
const image = opts.required("image");
|
|
49
|
-
const repoName = containerRegistryImageName(image, opts.required("env"));
|
|
50
|
-
prune(regName, repoName, image);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
function run(cmdObj) {
|
|
54
|
-
if (cmdObj.help || cmdObj.args.length < 1)
|
|
55
|
-
printUsageAndExit(usage);
|
|
56
|
-
const [command, image, sha] = cmdObj.args;
|
|
57
|
-
// @ts-expect-error left as an exercise for the reader
|
|
58
|
-
const handler = handlers[command];
|
|
59
|
-
if (!handler) {
|
|
60
|
-
console.error(`Unknown command: ${command}`);
|
|
61
|
-
printUsageAndExit(usage);
|
|
62
|
-
}
|
|
63
|
-
const params = new StrongParams(usage, { image, env: cmdObj.env, sha });
|
|
64
|
-
handler(params);
|
|
65
|
-
}
|
|
66
|
-
export const registry = { oneLiner, keyExamples, run };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser } from "../common";
|
|
2
|
-
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
-
export declare const runMany: {
|
|
4
|
-
command: string;
|
|
5
|
-
oneLiner: string;
|
|
6
|
-
keyExamples: string;
|
|
7
|
-
run: typeof run;
|
|
8
|
-
};
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=run-many.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-many.d.ts","sourceRoot":"","sources":["../../../src/cli/core/run-many.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAyBhE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBA8B1C;AAED,eAAO,MAAM,OAAO;;;;;CAAsD,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { workspaceDirectoryForLanguage } from "../../libs/discovery";
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
|
-
import concurrently, {} from "concurrently";
|
|
4
|
-
const oneLiner = "Runs a script concurrently in all projects that define it in their package.json";
|
|
5
|
-
const keyExamples = `
|
|
6
|
-
$ devops run-many build
|
|
7
|
-
`.trim();
|
|
8
|
-
const usage = `
|
|
9
|
-
${oneLiner}
|
|
10
|
-
|
|
11
|
-
USAGE
|
|
12
|
-
devops run-many <script-name> [--kill-others-on-fail]
|
|
13
|
-
|
|
14
|
-
NOTE
|
|
15
|
-
Only works for node projects. Use 'devopspy' for python projects.
|
|
16
|
-
|
|
17
|
-
EXAMPLES
|
|
18
|
-
${keyExamples}
|
|
19
|
-
`;
|
|
20
|
-
async function run(cmdObj) {
|
|
21
|
-
if (cmdObj.help || cmdObj.args.length === 0)
|
|
22
|
-
printUsageAndExit(usage);
|
|
23
|
-
const parsed = cmdObj.parseOptions({ booleans: ["--kill-others-on-fail"] });
|
|
24
|
-
const [script] = parsed.args;
|
|
25
|
-
const remaining = parsed.args.slice(1).join(" ");
|
|
26
|
-
const commands = [];
|
|
27
|
-
Object.values(workspaceDirectoryForLanguage('node')).forEach(async (packageData) => {
|
|
28
|
-
if (packageData.scripts?.[script]) {
|
|
29
|
-
commands.push({
|
|
30
|
-
name: packageData.name,
|
|
31
|
-
command: `devops --env ${cmdObj.env} run ${packageData.name}:${script} ${remaining}`,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
if (!commands.length) {
|
|
36
|
-
console.error(`No workspaces define the script: ${script}`);
|
|
37
|
-
process.exit(0);
|
|
38
|
-
}
|
|
39
|
-
// prettier-ignore
|
|
40
|
-
const options = parsed.options["--kill-others-on-fail"] ? { killOthers: "failure" } : {};
|
|
41
|
-
concurrently(commands, options)
|
|
42
|
-
.result.then(() => { })
|
|
43
|
-
.catch((error) => {
|
|
44
|
-
console.error("One of the commands failed");
|
|
45
|
-
process.exit(1);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
export const runMany = { command: 'run-many', oneLiner, keyExamples, run };
|
package/dist/cli/core/run.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/core/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AA2BhE,iBAAe,KAAK,CAAC,MAAM,EAAE,gBAAgB,iBAc5C;AAED,eAAO,MAAM,GAAG;;;;CAAwC,CAAC"}
|
package/dist/cli/core/run.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
2
|
-
import url from "url";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { getWorkspace } from "../../libs/discovery";
|
|
5
|
-
const __file__ = url.fileURLToPath(import.meta.url);
|
|
6
|
-
const __cli__ = path.join(path.dirname(__file__), "../..", "cli");
|
|
7
|
-
const execShPath = path.join(__cli__, "exec.sh");
|
|
8
|
-
const oneLiner = "Runs a script defined in package.json after injecting env variables";
|
|
9
|
-
const keyExamples = `$ devops run project:test`;
|
|
10
|
-
const usage = `
|
|
11
|
-
${oneLiner}
|
|
12
|
-
|
|
13
|
-
GENERAL USAGE
|
|
14
|
-
devops run <project-name>:<script-name> [--] [options for script]
|
|
15
|
-
|
|
16
|
-
NOTES
|
|
17
|
-
- Only works for node projects. Use 'devopspy' for python projects.
|
|
18
|
-
- Does not allow interactive mode. If you need interactivity, use devops exec instead.
|
|
19
|
-
|
|
20
|
-
EXAMPLES
|
|
21
|
-
${keyExamples}
|
|
22
|
-
`;
|
|
23
|
-
async function runFn(cmdObj) {
|
|
24
|
-
if (cmdObj.help || cmdObj.args.length === 0)
|
|
25
|
-
printUsageAndExit(usage);
|
|
26
|
-
const [workspace, script] = cmdObj.args[0].split(":");
|
|
27
|
-
if (!workspace || !script)
|
|
28
|
-
printUsageAndExit(usage);
|
|
29
|
-
const rootPath = getWorkspace(workspace).rootPath;
|
|
30
|
-
const remaining = cmdObj.args.slice(1).join(" ");
|
|
31
|
-
cmdObj
|
|
32
|
-
.executorFromEnv(`${execShPath} ${rootPath} bun run ${script} ${remaining}`, { checkEnvYaml: true })
|
|
33
|
-
.spawn();
|
|
34
|
-
}
|
|
35
|
-
export const run = { oneLiner, keyExamples, run: runFn };
|
package/dist/cli/core/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/cli/core/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsC,MAAM,WAAW,CAAC;AAejF,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QAUpC;AAED,eAAO,MAAM,IAAI;;;;CAAiC,CAAC"}
|
package/dist/cli/core/test.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "../common";
|
|
2
|
-
const oneLiner = "Runs tests in all projects or one specific project";
|
|
3
|
-
const keyExamples = `
|
|
4
|
-
$ devops test
|
|
5
|
-
$ devops test project
|
|
6
|
-
`;
|
|
7
|
-
const usage = `
|
|
8
|
-
${oneLiner}
|
|
9
|
-
|
|
10
|
-
USAGE
|
|
11
|
-
${keyExamples}
|
|
12
|
-
`;
|
|
13
|
-
function run(cmdObj) {
|
|
14
|
-
const options = cmdObj.parseOptions({ params: ["--in"] });
|
|
15
|
-
if (cmdObj.help || options.args.length > 1)
|
|
16
|
-
printUsageAndExit(usage);
|
|
17
|
-
const workspace = options.args[0];
|
|
18
|
-
const env = cmdObj.envForced ? cmdObj.env : "test";
|
|
19
|
-
if (workspace) {
|
|
20
|
-
new CommandExecutor(`devops run ${workspace}:test --env ${env}`).spawn();
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
new CommandExecutor(`devops run-many test --env ${env}`).spawn();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export const test = { oneLiner, keyExamples, run };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dml.d.ts","sourceRoot":"","sources":["../../../src/cli/extensions/dml.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAoGhE,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QAoBpC;AAED,eAAO,MAAM,GAAG;;;;CAAiC,CAAC"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
|
-
const oneLiner = "Utilities to manage and run DML scripts in the db project";
|
|
4
|
-
const keyExamples = `
|
|
5
|
-
$ devops dml create --name my-dml-name
|
|
6
|
-
$ devops dml run 20250113153318_my_dml_name
|
|
7
|
-
`;
|
|
8
|
-
const usage = `
|
|
9
|
-
${oneLiner}
|
|
10
|
-
|
|
11
|
-
CREATE DML SCRIPTS
|
|
12
|
-
devops dml create --name <dml-semantic-name>
|
|
13
|
-
|
|
14
|
-
This command creates a new folder under /dml using the current timestamp and a
|
|
15
|
-
snake-case version of the name. Inside the folder, a file called migrate.ts is created.
|
|
16
|
-
You should write your DML script in this file.
|
|
17
|
-
|
|
18
|
-
You can add additional artifacts to the folder, such as a README.md file, sql files, json
|
|
19
|
-
files, csv files, etc. You can also add optional scripts, such as rollback.ts.
|
|
20
|
-
|
|
21
|
-
RUN DML SCRIPTS
|
|
22
|
-
devops dml run <dml-folder-name> [script-file-name] [-- arg1 arg2 ...]
|
|
23
|
-
|
|
24
|
-
The dml-folder-name must be the full name, including the timestamp. This follows prisma
|
|
25
|
-
conventions.
|
|
26
|
-
If the optional script-file-name is omitted, 'migrate' is used by default. The name should
|
|
27
|
-
not include the '.ts' suffix.
|
|
28
|
-
Optionally, args can be passed to the script as command line arguments after double
|
|
29
|
-
dash (--).
|
|
30
|
-
The runner first changes the working directory to 'dml/', then executes the script using
|
|
31
|
-
'bunx tsx'.
|
|
32
|
-
|
|
33
|
-
Note: DML scripts are typically run inside the debug container of the image.
|
|
34
|
-
|
|
35
|
-
EXAMPLES
|
|
36
|
-
${keyExamples.trim()}
|
|
37
|
-
$ devops dml run 20250113153318_my_dml_name rollback
|
|
38
|
-
$ devops dml run 20250113153318_my_dml_name -- staging
|
|
39
|
-
`;
|
|
40
|
-
const dmlFileTemplate = `
|
|
41
|
-
/**
|
|
42
|
-
* Header code that retrieves the context of the DML script.
|
|
43
|
-
* Feel free to modify this code to suit your needs.
|
|
44
|
-
*
|
|
45
|
-
* fullDmlFilePath - path to the current file
|
|
46
|
-
* fullDmlDirPath - path to the current directory
|
|
47
|
-
* dmlFile - name of the current DML script file
|
|
48
|
-
* dmlDir - name of the directory containing the DML scripts
|
|
49
|
-
* args - command line arguments passed to the script
|
|
50
|
-
*
|
|
51
|
-
* Notes:
|
|
52
|
-
* - the script runs with the cwd set to the dml/ directory
|
|
53
|
-
* - remove unused variables from this template, otherwise the linter will complain
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
import { prisma } from 'db';
|
|
57
|
-
import { basename, dirname, sep } from 'path';
|
|
58
|
-
import { fileURLToPath } from 'url';
|
|
59
|
-
|
|
60
|
-
const fullDmlFilePath = fileURLToPath(import.meta.url);
|
|
61
|
-
const fullDmlDirPath = dirname(fullDmlFilePath);
|
|
62
|
-
const dmlFile = basename(fullDmlFilePath);
|
|
63
|
-
const dmlDir = fullDmlDirPath.split(sep).pop();
|
|
64
|
-
|
|
65
|
-
const args = process.argv.slice(2);
|
|
66
|
-
`.trim();
|
|
67
|
-
function createDml(name) {
|
|
68
|
-
const timestamp = new Date()
|
|
69
|
-
.toISOString()
|
|
70
|
-
.replace(/[^0-9]/g, "")
|
|
71
|
-
.slice(0, 14);
|
|
72
|
-
const nameSnake = name.toLowerCase().replace(/[^a-z0-9]/g, "_");
|
|
73
|
-
const folderName = `${timestamp}_${nameSnake}`;
|
|
74
|
-
fs.mkdirSync(`dml/${folderName}`);
|
|
75
|
-
fs.writeFileSync(`dml/${folderName}/migrate.ts`, dmlFileTemplate);
|
|
76
|
-
console.log(`\nCreated DML folder: dml/${folderName}\n`);
|
|
77
|
-
}
|
|
78
|
-
function runDml(cmdObj, folderName, scriptFileName, args) {
|
|
79
|
-
scriptFileName ??= "migrate";
|
|
80
|
-
args ??= [];
|
|
81
|
-
const script = scriptFileName.endsWith(".ts")
|
|
82
|
-
? scriptFileName
|
|
83
|
-
: `${scriptFileName}.ts`;
|
|
84
|
-
cmdObj
|
|
85
|
-
.executorFromEnv(
|
|
86
|
-
// prettier-ignore
|
|
87
|
-
`devops exec --in dml bun ${folderName}/${script} ${args.join(" ")}`)
|
|
88
|
-
.exec();
|
|
89
|
-
}
|
|
90
|
-
function run(cmdObj) {
|
|
91
|
-
if (cmdObj.help || cmdObj.args.length < 1)
|
|
92
|
-
printUsageAndExit(usage);
|
|
93
|
-
const parsed = cmdObj.parseOptions({
|
|
94
|
-
passthroughArgs: true,
|
|
95
|
-
params: ["--name"],
|
|
96
|
-
});
|
|
97
|
-
switch (parsed.args[0]) {
|
|
98
|
-
case "create": {
|
|
99
|
-
const name = parsed.options["--name"];
|
|
100
|
-
if (!name)
|
|
101
|
-
printUsageAndExit(usage);
|
|
102
|
-
return createDml(name);
|
|
103
|
-
}
|
|
104
|
-
case "run": {
|
|
105
|
-
const [_, folderName, scriptFileName] = parsed.args;
|
|
106
|
-
if (!folderName)
|
|
107
|
-
printUsageAndExit(usage);
|
|
108
|
-
return runDml(cmdObj, folderName, scriptFileName, parsed.passthrough);
|
|
109
|
-
}
|
|
110
|
-
default:
|
|
111
|
-
printUsageAndExit(usage);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
export const dml = { oneLiner, keyExamples, run };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from "./dml";
|
|
2
|
-
export * from "./internal-curl";
|
|
3
|
-
export * from "./jwt";
|
|
4
|
-
export * from "./prisma";
|
|
5
|
-
export * from "./redis-bitnami";
|
|
6
|
-
export * from "./redis-ha";
|
|
7
|
-
export * from "./stackgres";
|
|
8
|
-
export * from "./template";
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser } from "../common";
|
|
2
|
-
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
-
export declare const internalCurl: {
|
|
4
|
-
command: string;
|
|
5
|
-
oneLiner: string;
|
|
6
|
-
keyExamples: string;
|
|
7
|
-
run: typeof run;
|
|
8
|
-
};
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=internal-curl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal-curl.d.ts","sourceRoot":"","sources":["../../../src/cli/extensions/internal-curl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAuBhE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAmB1C;AAED,eAAO,MAAM,YAAY;;;;;CAA2D,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { InternalToken } from "../../app-support/crypto";
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
|
-
const oneLiner = "Runs a curl command bearing an internal jwt-like token to allow verifying internal communication within the namespace";
|
|
4
|
-
const keyExamples = `$ devops internal-curl jobs http://service-name:port/path`;
|
|
5
|
-
const usage = `
|
|
6
|
-
${oneLiner}
|
|
7
|
-
|
|
8
|
-
GENERAL USAGE
|
|
9
|
-
devops internal-curl <subject> [curl-options] <url>
|
|
10
|
-
|
|
11
|
-
NOTE
|
|
12
|
-
--env should not be used with this command. It is expected to be run inside pods in the namespace.
|
|
13
|
-
Relies on the MONOREPO_BASE_SECRET environment variable for signing the token.
|
|
14
|
-
|
|
15
|
-
'subject' is the subject of the token. Receiving endpoints should verify it matches the expected value using the
|
|
16
|
-
'InternalToken' class exposed by @vaharoni/devops.
|
|
17
|
-
|
|
18
|
-
EXAMPLES
|
|
19
|
-
${keyExamples}
|
|
20
|
-
`;
|
|
21
|
-
async function run(cmdObj) {
|
|
22
|
-
if (cmdObj.help || cmdObj.args.length === 0 || cmdObj.envForced)
|
|
23
|
-
printUsageAndExit(usage);
|
|
24
|
-
const [subject, ...rest] = cmdObj.args;
|
|
25
|
-
// A trick to allow running this command locally while setting the MONOREPO_BASE_SECRET in .env.global.
|
|
26
|
-
// Basically we have to inject the env variables into the shell, which is why we execute 'devops jwt' first
|
|
27
|
-
let token;
|
|
28
|
-
if (process.env.MONOREPO_BASE_SECRET) {
|
|
29
|
-
token = new InternalToken(subject).generate();
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const res = cmdObj.executorFromEnv(`devops jwt ${subject}`).exec({ asObject: true });
|
|
33
|
-
if (res.statusCode !== 0) {
|
|
34
|
-
console.error("Failed to generate token. Aborting.");
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
token = res.stdout.trim();
|
|
38
|
-
}
|
|
39
|
-
cmdObj.executorFromEnv(`curl -H "Authorization: Bearer ${token}" ${rest.join(" ")}`).exec();
|
|
40
|
-
}
|
|
41
|
-
export const internalCurl = { command: 'internal-curl', oneLiner, keyExamples, run };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../../src/cli/extensions/jwt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAqBhE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAK1C;AAED,eAAO,MAAM,GAAG;;;;CAAiC,CAAC"}
|