@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
package/dist/cli/common.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { execSync, spawn } from "child_process";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import { allSupportedEnvs } from "../libs/k8s-constants";
|
|
5
|
-
import { globEnvYamlFiles } from "../libs/discovery";
|
|
6
|
-
export class CLICommandParser {
|
|
7
|
-
command;
|
|
8
|
-
args;
|
|
9
|
-
env;
|
|
10
|
-
envForced;
|
|
11
|
-
help;
|
|
12
|
-
skipEnvCheck;
|
|
13
|
-
constructor(cmdArray) {
|
|
14
|
-
const parsedArgs = this._separateOptions(cmdArray.filter(Boolean), {
|
|
15
|
-
params: ["--env"],
|
|
16
|
-
booleans: ["--help", "--skip-env-check"],
|
|
17
|
-
});
|
|
18
|
-
const [command, ...args] = parsedArgs.args;
|
|
19
|
-
this.command = command;
|
|
20
|
-
this.args = args;
|
|
21
|
-
this.envForced = Boolean(parsedArgs.options["--env"]);
|
|
22
|
-
this.env =
|
|
23
|
-
parsedArgs.options["--env"] ??
|
|
24
|
-
process.env["MONOREPO_ENV"] ??
|
|
25
|
-
"development";
|
|
26
|
-
this.help = Boolean(parsedArgs.options["--help"]);
|
|
27
|
-
this.skipEnvCheck = Boolean(parsedArgs.options["--skip-env-check"]);
|
|
28
|
-
// We need to hardcode this to avoid chicken-and-egg problem (validate env depends on constants.yaml existence)
|
|
29
|
-
if (this.command !== 'init') {
|
|
30
|
-
this._validateEnv(this.env);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// Copies the env
|
|
34
|
-
executorFromEnv(commandStr, options = {}) {
|
|
35
|
-
const checkEnvYamlOverride = this.skipEnvCheck
|
|
36
|
-
? { checkEnvYaml: false }
|
|
37
|
-
: {};
|
|
38
|
-
return new CommandExecutor(commandStr, {
|
|
39
|
-
env: this.env,
|
|
40
|
-
...options,
|
|
41
|
-
...checkEnvYamlOverride,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
// Example:
|
|
45
|
-
// const cmd = new CLICommandParser('devops run --some-flag --in workspace arg1'.split(' '));
|
|
46
|
-
// cmd.parseOptions({ boolean: ['--some-flag'], params: ['--in'] })
|
|
47
|
-
// # => { args: ['arg1'], options: { '--some-flag': true, '--in': 'workspace' } }
|
|
48
|
-
//
|
|
49
|
-
// Note that the global param --env is already extracted and can be accessed with cmd.env
|
|
50
|
-
parseOptions({ params, booleans, passthroughArgs = false, } = {}) {
|
|
51
|
-
return this._separateOptions(this.args, {
|
|
52
|
-
params,
|
|
53
|
-
booleans,
|
|
54
|
-
passthroughArgs,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
_validateEnv(env) {
|
|
58
|
-
if (!allSupportedEnvs().includes(env)) {
|
|
59
|
-
console.error(
|
|
60
|
-
// prettier-ignore
|
|
61
|
-
`Environment must be one of: ${allSupportedEnvs().join(", ")}. Received: ${env}`);
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
_separateOptions(args, { params, booleans, passthroughArgs = false, } = {}) {
|
|
67
|
-
const paramsLookup = new Set(params ?? []);
|
|
68
|
-
const booleansLookup = new Set(booleans ?? []);
|
|
69
|
-
const isParam = (arg) => paramsLookup.has(arg);
|
|
70
|
-
const isBoolean = (arg) => booleansLookup.has(arg);
|
|
71
|
-
const passthroughArgsStart = passthroughArgs ? args.indexOf("--") : -1;
|
|
72
|
-
// prettier-ignore
|
|
73
|
-
const numArgsToProcess = passthroughArgsStart === -1 ? args.length : passthroughArgsStart;
|
|
74
|
-
const getResPassthrough = () => {
|
|
75
|
-
if (!passthroughArgs || passthroughArgsStart < 0)
|
|
76
|
-
return { passthrough: [] };
|
|
77
|
-
return { passthrough: args.slice(passthroughArgsStart + 1) };
|
|
78
|
-
};
|
|
79
|
-
const resArgs = [];
|
|
80
|
-
const resParams = {};
|
|
81
|
-
const resOptions = {};
|
|
82
|
-
for (let i = 0; i < numArgsToProcess; ++i) {
|
|
83
|
-
const curr = args[i];
|
|
84
|
-
if (isParam(curr)) {
|
|
85
|
-
const next = args[i + 1];
|
|
86
|
-
resParams[curr] = next;
|
|
87
|
-
++i;
|
|
88
|
-
}
|
|
89
|
-
else if (isBoolean(curr)) {
|
|
90
|
-
resOptions[curr] = true;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
resArgs.push(curr);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
args: resArgs,
|
|
98
|
-
argsStr: resArgs.join(" "),
|
|
99
|
-
options: { ...resOptions, ...resParams },
|
|
100
|
-
...getResPassthrough(),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
export class CommandExecutor {
|
|
105
|
-
commandStr;
|
|
106
|
-
env;
|
|
107
|
-
quiet;
|
|
108
|
-
redactedCommand;
|
|
109
|
-
checkEnvYaml;
|
|
110
|
-
constructor(commandStr, { env, quiet = false, redactedCommand, checkEnvYaml = false, } = {}) {
|
|
111
|
-
this.env = env;
|
|
112
|
-
this.quiet = quiet ?? false;
|
|
113
|
-
this.commandStr = commandStr;
|
|
114
|
-
this.checkEnvYaml = checkEnvYaml;
|
|
115
|
-
this.redactedCommand = redactedCommand;
|
|
116
|
-
}
|
|
117
|
-
exec({ onlyStatusCode = false, asObject = false, env = {}, } = {}) {
|
|
118
|
-
this._checkEnvYamlFiles();
|
|
119
|
-
const fullCommand = this._prepareFullCommand();
|
|
120
|
-
const envToUse = this._getProcessEnv(env);
|
|
121
|
-
try {
|
|
122
|
-
const output = execSync(fullCommand, { env: envToUse });
|
|
123
|
-
if (onlyStatusCode)
|
|
124
|
-
return 0;
|
|
125
|
-
if (!this.quiet)
|
|
126
|
-
console.log(output.toString());
|
|
127
|
-
if (asObject)
|
|
128
|
-
return { statusCode: 0, stdout: output.toString() };
|
|
129
|
-
return output.toString();
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
const typedError = error;
|
|
133
|
-
if (onlyStatusCode)
|
|
134
|
-
return typedError.status;
|
|
135
|
-
const stdout = typedError.stdout?.toString().trim();
|
|
136
|
-
const stderr = typedError.stderr?.toString().trim();
|
|
137
|
-
if (!this.quiet) {
|
|
138
|
-
console.warn(stdout);
|
|
139
|
-
console.error(stderr);
|
|
140
|
-
}
|
|
141
|
-
if (asObject)
|
|
142
|
-
return { statusCode: typedError.status, stdout, stderr };
|
|
143
|
-
process.exit(typedError.status);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
/** Should be used for CLI commands intended to be used locally. Provides interactivity. Unlike exec(), stdout is not returned. */
|
|
147
|
-
spawn({ env, pipeStdoutTo } = {}) {
|
|
148
|
-
this._checkEnvYamlFiles();
|
|
149
|
-
const fullCommand = this._prepareFullCommand();
|
|
150
|
-
const envToUse = this._getProcessEnv(env);
|
|
151
|
-
const stdio = pipeStdoutTo === "stderr" ? ["inherit", "pipe", "inherit"] : "inherit";
|
|
152
|
-
return new Promise((resolve) => {
|
|
153
|
-
try {
|
|
154
|
-
const childProcess = spawn(fullCommand, {
|
|
155
|
-
stdio,
|
|
156
|
-
env: envToUse,
|
|
157
|
-
shell: true,
|
|
158
|
-
});
|
|
159
|
-
if (pipeStdoutTo === "stderr") {
|
|
160
|
-
childProcess.stdout?.pipe(process.stderr);
|
|
161
|
-
}
|
|
162
|
-
childProcess.on("close", (code) => {
|
|
163
|
-
if (code !== 0) {
|
|
164
|
-
console.error(chalk.red(`Process exited with code ${code}`));
|
|
165
|
-
process.exit(code);
|
|
166
|
-
}
|
|
167
|
-
resolve(code);
|
|
168
|
-
});
|
|
169
|
-
childProcess.on("error", (error) => {
|
|
170
|
-
console.error(chalk.red(`Error: ${error.message}`));
|
|
171
|
-
process.exit(1);
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
if (error instanceof Error) {
|
|
176
|
-
console.error(chalk.red(`${error.message}`));
|
|
177
|
-
}
|
|
178
|
-
process.exit(1);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
_prepareFullCommand() {
|
|
183
|
-
const envPrefix = this.env ? this._envInjectorPrefix() : "";
|
|
184
|
-
const fullCommand = [envPrefix, this.commandStr].join(" ").trim();
|
|
185
|
-
const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env} MONOREPO_ROOT=${process.cwd()}` : "";
|
|
186
|
-
const fullCommandLog = [envPrefixLog, fullCommand].join(" ").trim();
|
|
187
|
-
if (this.redactedCommand) {
|
|
188
|
-
console.warn(chalk.yellow(fullCommandLog.replace(this.commandStr, this.redactedCommand)));
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
console.warn(chalk.yellow(fullCommandLog));
|
|
192
|
-
}
|
|
193
|
-
return fullCommand;
|
|
194
|
-
}
|
|
195
|
-
_getProcessEnv(envOverride = {}) {
|
|
196
|
-
return { ...process.env, MONOREPO_ENV: this.env, MONOREPO_ROOT: process.cwd(), ...envOverride };
|
|
197
|
-
}
|
|
198
|
-
_envInjectorPrefix() {
|
|
199
|
-
const envFiles = dotEnvFilesForEnv(this.env);
|
|
200
|
-
if (envFiles.length === 0) {
|
|
201
|
-
return "";
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
return `bunx dotenvx -q run -f ${envFiles.join(" ")} -- `;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
_checkEnvYamlFiles() {
|
|
208
|
-
if (!this.checkEnvYaml)
|
|
209
|
-
return;
|
|
210
|
-
const envYamlFiles = globEnvYamlFiles();
|
|
211
|
-
const checkEnvCmd = new CommandExecutor(`devops env _validate ${envYamlFiles.join(" ")}`, { env: this.env, quiet: true, checkEnvYaml: false });
|
|
212
|
-
checkEnvCmd.exec();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
export function dotEnvFilesForEnv(env) {
|
|
216
|
-
const globalEnvFilePath = "config/.env.global";
|
|
217
|
-
const specificEnvFilePath = `config/.env.${env}`;
|
|
218
|
-
const envFiles = [];
|
|
219
|
-
if (env && fs.existsSync(specificEnvFilePath))
|
|
220
|
-
envFiles.push(specificEnvFilePath);
|
|
221
|
-
if (fs.existsSync(globalEnvFilePath))
|
|
222
|
-
envFiles.push(globalEnvFilePath);
|
|
223
|
-
return envFiles;
|
|
224
|
-
}
|
|
225
|
-
export function printUsageAndExit(text) {
|
|
226
|
-
console.warn(text);
|
|
227
|
-
process.exit(1);
|
|
228
|
-
}
|
|
229
|
-
export class StrongParams {
|
|
230
|
-
usage;
|
|
231
|
-
args;
|
|
232
|
-
constructor(usage, args) {
|
|
233
|
-
this.usage = usage;
|
|
234
|
-
this.args = args;
|
|
235
|
-
}
|
|
236
|
-
required(key) {
|
|
237
|
-
if (!this.args[key]) {
|
|
238
|
-
console.error(`Missing required argument: ${key}`);
|
|
239
|
-
printUsageAndExit(this.usage);
|
|
240
|
-
}
|
|
241
|
-
return this.args[key];
|
|
242
|
-
}
|
|
243
|
-
optional(key) {
|
|
244
|
-
return this.args[key];
|
|
245
|
-
}
|
|
246
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.spec.d.ts","sourceRoot":"","sources":["../../src/cli/common.spec.ts"],"names":[],"mappings":""}
|
package/dist/cli/common.spec.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { CLICommandParser } from './common';
|
|
3
|
-
describe('CLICommandParser', () => {
|
|
4
|
-
// Extra white space intentional
|
|
5
|
-
const subject = new CLICommandParser('run tmp/test.sh --env production --in workspace --flag arg'.split(' '));
|
|
6
|
-
it('constructor: builds object correctly', () => {
|
|
7
|
-
expect(subject.command).toEqual('run');
|
|
8
|
-
expect(subject.env).toEqual('production');
|
|
9
|
-
expect(subject.args).toEqual([
|
|
10
|
-
'tmp/test.sh',
|
|
11
|
-
'--in',
|
|
12
|
-
'workspace',
|
|
13
|
-
'--flag',
|
|
14
|
-
'arg',
|
|
15
|
-
]);
|
|
16
|
-
});
|
|
17
|
-
describe('parseOptions', () => {
|
|
18
|
-
it('detects params and booleans', () => {
|
|
19
|
-
const res = subject.parseOptions({
|
|
20
|
-
params: ['--in'],
|
|
21
|
-
booleans: ['--flag'],
|
|
22
|
-
});
|
|
23
|
-
expect(res.args).toEqual(['tmp/test.sh', 'arg']);
|
|
24
|
-
expect(res.argsStr).toEqual('tmp/test.sh arg');
|
|
25
|
-
expect(res.options).toEqual({ '--in': 'workspace', '--flag': true });
|
|
26
|
-
});
|
|
27
|
-
it('leaves intact params that are not in the list', () => {
|
|
28
|
-
const res = subject.parseOptions();
|
|
29
|
-
expect(res.args).toEqual([
|
|
30
|
-
'tmp/test.sh',
|
|
31
|
-
'--in',
|
|
32
|
-
'workspace',
|
|
33
|
-
'--flag',
|
|
34
|
-
'arg',
|
|
35
|
-
]);
|
|
36
|
-
expect(res.argsStr).toEqual('tmp/test.sh --in workspace --flag arg');
|
|
37
|
-
expect(res.options).toEqual({});
|
|
38
|
-
});
|
|
39
|
-
it('handles passthrough args when they exist', () => {
|
|
40
|
-
const altSubject = new CLICommandParser('run tmp/test.sh --env production --in workspace --flag arg -- p1 p2'.split(' '));
|
|
41
|
-
const res = altSubject.parseOptions({
|
|
42
|
-
params: ['--in'],
|
|
43
|
-
booleans: ['--flag'],
|
|
44
|
-
passthroughArgs: true,
|
|
45
|
-
});
|
|
46
|
-
expect(res.args).toEqual(['tmp/test.sh', 'arg']);
|
|
47
|
-
expect(res.argsStr).toEqual('tmp/test.sh arg');
|
|
48
|
-
expect(res.options).toEqual({ '--in': 'workspace', '--flag': true });
|
|
49
|
-
expect(res.passthrough).toEqual(['p1', 'p2']);
|
|
50
|
-
});
|
|
51
|
-
it('handles passthrough args when they do not exist', () => {
|
|
52
|
-
const altSubject = new CLICommandParser('run tmp/test.sh --env production --in workspace --flag arg'.split(' '));
|
|
53
|
-
const res = altSubject.parseOptions({
|
|
54
|
-
params: ['--in'],
|
|
55
|
-
booleans: ['--flag'],
|
|
56
|
-
passthroughArgs: true,
|
|
57
|
-
});
|
|
58
|
-
expect(res.args).toEqual(['tmp/test.sh', 'arg']);
|
|
59
|
-
expect(res.argsStr).toEqual('tmp/test.sh arg');
|
|
60
|
-
expect(res.options).toEqual({ '--in': 'workspace', '--flag': true });
|
|
61
|
-
expect(res.passthrough).toEqual([]);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser } from "../common";
|
|
2
|
-
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
-
export declare const affected: {
|
|
4
|
-
oneLiner: string;
|
|
5
|
-
keyExamples: string;
|
|
6
|
-
run: typeof run;
|
|
7
|
-
};
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=affected.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"affected.d.ts","sourceRoot":"","sources":["../../../src/cli/core/affected.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AAoD9E,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAoD1C;AAED,eAAO,MAAM,QAAQ;;;;CAAiC,CAAC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
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 const affected = { oneLiner, keyExamples, run };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser } from "../common";
|
|
2
|
-
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
-
export declare const cloudrun: {
|
|
4
|
-
oneLiner: string;
|
|
5
|
-
keyExamples: string;
|
|
6
|
-
run: typeof run;
|
|
7
|
-
};
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=cloudrun.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloudrun.d.ts","sourceRoot":"","sources":["../../../src/cli/core/cloudrun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AA6E9E,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAmD1C;AAED,eAAO,MAAM,QAAQ;;;;CAAiC,CAAC"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
2
|
-
import { buildDev, deploy } from "../../libs/cloudrun-helpers";
|
|
3
|
-
const oneLiner = "Supports cloudrun images";
|
|
4
|
-
const keyExamples = `
|
|
5
|
-
$ devops cloudrun deploy cloudrun-image SHA --env staging --region us-east1 [--forward-env ENV1,ENV2 --allow-unauthenticated]
|
|
6
|
-
$ devops cloudrun build-dev cloudrun-image
|
|
7
|
-
`.trim();
|
|
8
|
-
const usage = `
|
|
9
|
-
${oneLiner}
|
|
10
|
-
|
|
11
|
-
USAGE
|
|
12
|
-
Configuration prerequisites:
|
|
13
|
-
- The image should be defined in images.yaml with:
|
|
14
|
-
cloudrun: true
|
|
15
|
-
- The artifact registry URL should be set in config/constants.yaml:
|
|
16
|
-
cloudrun-artifact-registry-repo-path: REGION-docker.pkg.dev/PROJECT_ID/REPO
|
|
17
|
-
|
|
18
|
-
Deploy a cloudrun image to Cloud Run:
|
|
19
|
-
devops cloudrun deploy <image> <sha> --env <env> --region <region> [options]
|
|
20
|
-
|
|
21
|
-
Options:
|
|
22
|
-
--forward-env ENV1,ENV2 Comma-separated env var names to forward into the service
|
|
23
|
-
--allow-unauthenticated Allow unauthenticated access
|
|
24
|
-
--cpu <cpu> CPU, e.g. 0.25, 0.5, 1
|
|
25
|
-
--memory <mem> Memory, e.g. 256Mi, 512Mi, 1Gi
|
|
26
|
-
--min-instances <n> Minimum instances
|
|
27
|
-
--max-instances <n> Maximum instances
|
|
28
|
-
--timeout <time> Request timeout, e.g. 60s
|
|
29
|
-
-- Pass through additional args to gcloud (e.g. -- --ingress internal)
|
|
30
|
-
|
|
31
|
-
Notes:
|
|
32
|
-
- The image must already be pushed to the artifact registry.
|
|
33
|
-
- <env> also supports local environments (e.g. development).
|
|
34
|
-
- For remote monorepo environments, variables specified in --forward-env that
|
|
35
|
-
are not present in the current process's env are fetched from the cluster.
|
|
36
|
-
|
|
37
|
-
Build a cloudrun image locally in development environment:
|
|
38
|
-
devops cloudrun build-dev cloudrun-image
|
|
39
|
-
|
|
40
|
-
This command builds the image locally with a random SHA and pushes it to the artifact registry.
|
|
41
|
-
|
|
42
|
-
EXAMPLES
|
|
43
|
-
${keyExamples}
|
|
44
|
-
`;
|
|
45
|
-
const handlers = {
|
|
46
|
-
"build-dev": (opts) => {
|
|
47
|
-
buildDev(opts.required("image"));
|
|
48
|
-
},
|
|
49
|
-
_deploy: (opts) => {
|
|
50
|
-
const rawForwardEnv = opts.optional("forwardEnv");
|
|
51
|
-
const forwardEnv = rawForwardEnv
|
|
52
|
-
? rawForwardEnv.split(",").map(v => v.trim()).filter(Boolean)
|
|
53
|
-
: [];
|
|
54
|
-
const minInstancesStr = opts.optional("minInstances");
|
|
55
|
-
const maxInstancesStr = opts.optional("maxInstances");
|
|
56
|
-
deploy({
|
|
57
|
-
image: opts.required("image"),
|
|
58
|
-
env: opts.required("env"),
|
|
59
|
-
sha: opts.required("sha"),
|
|
60
|
-
region: opts.required("region"),
|
|
61
|
-
forwardEnv,
|
|
62
|
-
allowUnauthenticated: opts.optional("allowUnauthenticated") === "true",
|
|
63
|
-
cpu: opts.optional("cpu"),
|
|
64
|
-
memory: opts.optional("memory"),
|
|
65
|
-
minInstances: minInstancesStr ? Number(minInstancesStr) : undefined,
|
|
66
|
-
maxInstances: maxInstancesStr ? Number(maxInstancesStr) : undefined,
|
|
67
|
-
timeout: opts.optional("timeout"),
|
|
68
|
-
extraArgs: opts.optional("extraArgs"),
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
async function run(cmdObj) {
|
|
73
|
-
if (cmdObj.help || cmdObj.args.length === 0)
|
|
74
|
-
printUsageAndExit(usage);
|
|
75
|
-
const parsed = cmdObj.parseOptions({
|
|
76
|
-
params: [
|
|
77
|
-
"--keep-last",
|
|
78
|
-
"--forward-env",
|
|
79
|
-
"--region",
|
|
80
|
-
"--cpu",
|
|
81
|
-
"--memory",
|
|
82
|
-
"--min-instances",
|
|
83
|
-
"--max-instances",
|
|
84
|
-
"--timeout",
|
|
85
|
-
"--sha",
|
|
86
|
-
],
|
|
87
|
-
booleans: ["--allow-unauthenticated"],
|
|
88
|
-
passthroughArgs: true,
|
|
89
|
-
});
|
|
90
|
-
const [subcommand, image, sha] = parsed.args;
|
|
91
|
-
// Inject env variables as forwarding is needed
|
|
92
|
-
if (subcommand === "deploy") {
|
|
93
|
-
cmdObj.executorFromEnv(`devops cloudrun _deploy ${cmdObj.args.slice(1).join(" ")}`, { checkEnvYaml: false }).spawn();
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const handler = handlers[subcommand];
|
|
97
|
-
if (!handler) {
|
|
98
|
-
console.error(`Unknown subcommand: ${subcommand}`);
|
|
99
|
-
printUsageAndExit(usage);
|
|
100
|
-
}
|
|
101
|
-
const params = new StrongParams(usage, {
|
|
102
|
-
env: cmdObj.env,
|
|
103
|
-
subcommand,
|
|
104
|
-
image,
|
|
105
|
-
sha,
|
|
106
|
-
keepLast: parsed.options["--keep-last"],
|
|
107
|
-
forwardEnv: parsed.options["--forward-env"],
|
|
108
|
-
region: parsed.options["--region"],
|
|
109
|
-
allowUnauthenticated: parsed.options["--allow-unauthenticated"] ? "true" : undefined,
|
|
110
|
-
cpu: parsed.options["--cpu"],
|
|
111
|
-
memory: parsed.options["--memory"],
|
|
112
|
-
minInstances: parsed.options["--min-instances"],
|
|
113
|
-
maxInstances: parsed.options["--max-instances"],
|
|
114
|
-
timeout: parsed.options["--timeout"],
|
|
115
|
-
extraArgs: parsed.passthrough ? parsed.passthrough.join(" ") : undefined,
|
|
116
|
-
});
|
|
117
|
-
handler(params);
|
|
118
|
-
}
|
|
119
|
-
export const cloudrun = { oneLiner, keyExamples, run };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser } from "../common";
|
|
2
|
-
declare function run(cmdObj: CLICommandParser): void;
|
|
3
|
-
export declare const consoleCommand: {
|
|
4
|
-
command: string;
|
|
5
|
-
oneLiner: string;
|
|
6
|
-
keyExamples: string;
|
|
7
|
-
run: typeof run;
|
|
8
|
-
};
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=console.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/cli/core/console.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAsC,MAAM,WAAW,CAAC;AAsBjF,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QA2BpC;AAMD,eAAO,MAAM,cAAc;;;;;CAAqD,CAAC"}
|
package/dist/cli/core/console.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { generateDebugPod } from "../../libs/k8s-generate";
|
|
2
|
-
import { kubectlCommand } from "../../libs/k8s-helpers";
|
|
3
|
-
import { getImageVersion } from "../../libs/k8s-image-config";
|
|
4
|
-
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "../common";
|
|
5
|
-
import yaml from "yaml";
|
|
6
|
-
const oneLiner = "Spin up a debug pod of the specified image and get a shell into it.";
|
|
7
|
-
const keyExamples = `
|
|
8
|
-
$ devops console main-node
|
|
9
|
-
`.trim();
|
|
10
|
-
const usage = `
|
|
11
|
-
${oneLiner}
|
|
12
|
-
|
|
13
|
-
USAGE
|
|
14
|
-
devops console <image> [--version <version>]
|
|
15
|
-
|
|
16
|
-
Options:
|
|
17
|
-
--version <version> The version (git SHA) of the image to use.
|
|
18
|
-
If not specified, the live version of the image (obtained using 'devops image version get <image>') is used.
|
|
19
|
-
|
|
20
|
-
EXAMPLES
|
|
21
|
-
${keyExamples}
|
|
22
|
-
`;
|
|
23
|
-
function run(cmdObj) {
|
|
24
|
-
if (cmdObj.help || cmdObj.args.length === 0)
|
|
25
|
-
printUsageAndExit(usage);
|
|
26
|
-
const parsed = cmdObj.parseOptions({ params: ["--version"] });
|
|
27
|
-
if (parsed.args.length !== 1)
|
|
28
|
-
printUsageAndExit(usage);
|
|
29
|
-
const image = parsed.args[0];
|
|
30
|
-
const version = parsed.options["--version"];
|
|
31
|
-
const gitSha = version ?? getImageVersion(cmdObj.env, image);
|
|
32
|
-
if (!gitSha) {
|
|
33
|
-
console.error(`No git SHA found for image ${image} in environment ${cmdObj.env}`);
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
const debugYaml = generateDebugPod(cmdObj.env, image, gitSha);
|
|
37
|
-
if (!debugYaml) {
|
|
38
|
-
console.error(`The image ${image} does not specify debug-template in images.yaml`);
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
const userName = new CommandExecutor(`kubectl auth whoami -o jsonpath='{.status.userInfo.username}'`).exec();
|
|
42
|
-
const debugManifestsJson = JSON.stringify(yaml.parse(debugYaml));
|
|
43
|
-
const randomId = Math.random().toString(36).substring(2, 10);
|
|
44
|
-
const podName = ['ephemeral-console', slugify(userName), slugify(image), randomId].filter(Boolean).join('-');
|
|
45
|
-
new CommandExecutor(kubectlCommand(`run ${podName} --restart=Never --rm -it --image=overridden --overrides='${debugManifestsJson}'`, { monorepoEnv: cmdObj.env })).spawn();
|
|
46
|
-
}
|
|
47
|
-
function slugify(str, maxLength = 20) {
|
|
48
|
-
return str.toLowerCase().trim().replace(/[^a-zA-Z0-9]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, maxLength);
|
|
49
|
-
}
|
|
50
|
-
export const consoleCommand = { command: 'console', oneLiner, keyExamples, run };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CLICommandParser } from "../common";
|
|
2
|
-
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
-
export declare const constant: {
|
|
4
|
-
oneLiner: string;
|
|
5
|
-
keyExamples: string;
|
|
6
|
-
run: typeof run;
|
|
7
|
-
};
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../../src/cli/core/constant.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAehE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAI1C;AAED,eAAO,MAAM,QAAQ;;;;CAAiC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { getConst } from "../../libs/config";
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
|
-
const oneLiner = "Prints to stdout a constant from constant.yaml";
|
|
4
|
-
const keyExamples = `$ devops constant infra`;
|
|
5
|
-
const usage = `
|
|
6
|
-
${oneLiner}
|
|
7
|
-
|
|
8
|
-
GENERAL USAGE
|
|
9
|
-
devops constant <constant-name>
|
|
10
|
-
|
|
11
|
-
EXAMPLES
|
|
12
|
-
${keyExamples}
|
|
13
|
-
`;
|
|
14
|
-
async function run(cmdObj) {
|
|
15
|
-
if (cmdObj.help || cmdObj.args.length === 0)
|
|
16
|
-
printUsageAndExit(usage);
|
|
17
|
-
const [constant] = cmdObj.args;
|
|
18
|
-
console.log(getConst(constant));
|
|
19
|
-
}
|
|
20
|
-
export const constant = { oneLiner, keyExamples, run };
|
package/dist/cli/core/env.d.ts
DELETED