@catladder/cli 1.153.0 → 1.154.0

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.
Files changed (135) hide show
  1. package/dist/bundles/catenv/index.js +3 -3
  2. package/dist/bundles/cli/index.js +6 -6
  3. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +2 -2
  4. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -1
  5. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +2 -2
  6. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  7. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +1 -1
  8. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  9. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js +2 -10
  10. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  11. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +2 -2
  12. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  13. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js +2 -26
  14. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  15. package/dist/cli/src/gcloud/serviceAccounts.js +3 -3
  16. package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
  17. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.d.ts +3 -0
  18. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js +81 -0
  19. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js.map +1 -0
  20. package/dist/pipeline/src/build/base/createAppBuildJob.d.ts +3 -3
  21. package/dist/pipeline/src/build/base/createAppBuildJob.js +14 -13
  22. package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
  23. package/dist/pipeline/src/build/base/index.d.ts +6 -2
  24. package/dist/pipeline/src/build/base/index.js +23 -5
  25. package/dist/pipeline/src/build/base/index.js.map +1 -1
  26. package/dist/pipeline/src/build/base/writeDotEnv.js +3 -2
  27. package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
  28. package/dist/pipeline/src/build/custom/buildJob.js +2 -12
  29. package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
  30. package/dist/pipeline/src/build/docker.js +6 -6
  31. package/dist/pipeline/src/build/docker.js.map +1 -1
  32. package/dist/pipeline/src/build/index.d.ts +14 -5
  33. package/dist/pipeline/src/build/index.js +23 -3
  34. package/dist/pipeline/src/build/index.js.map +1 -1
  35. package/dist/pipeline/src/build/node/buildJob.d.ts +7 -2
  36. package/dist/pipeline/src/build/node/buildJob.js +44 -42
  37. package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
  38. package/dist/pipeline/src/build/node/cache.d.ts +2 -2
  39. package/dist/pipeline/src/build/node/cache.js +17 -9
  40. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  41. package/dist/pipeline/src/build/node/index.d.ts +2 -2
  42. package/dist/pipeline/src/build/node/index.js.map +1 -1
  43. package/dist/pipeline/src/build/node/meteor.js +2 -8
  44. package/dist/pipeline/src/build/node/meteor.js.map +1 -1
  45. package/dist/pipeline/src/build/node/testJob.d.ts +3 -2
  46. package/dist/pipeline/src/build/node/testJob.js +10 -3
  47. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  48. package/dist/pipeline/src/build/node/yarn.js +1 -1
  49. package/dist/pipeline/src/build/node/yarn.js.map +1 -1
  50. package/dist/pipeline/src/build/rails/build.d.ts +1 -1
  51. package/dist/pipeline/src/build/rails/build.js +7 -2
  52. package/dist/pipeline/src/build/rails/build.js.map +1 -1
  53. package/dist/pipeline/src/build/rails/test.d.ts +1 -1
  54. package/dist/pipeline/src/build/rails/test.js +5 -0
  55. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  56. package/dist/pipeline/src/build/sbom.js +7 -2
  57. package/dist/pipeline/src/build/sbom.js.map +1 -1
  58. package/dist/pipeline/src/build/types.d.ts +49 -5
  59. package/dist/pipeline/src/build/types.js +9 -1
  60. package/dist/pipeline/src/build/types.js.map +1 -1
  61. package/dist/pipeline/src/context/createAllComponentsContext.d.ts +8 -0
  62. package/dist/pipeline/src/context/createAllComponentsContext.js +68 -0
  63. package/dist/pipeline/src/context/createAllComponentsContext.js.map +1 -0
  64. package/dist/pipeline/src/context/createComponentContext.d.ts +0 -4
  65. package/dist/pipeline/src/context/createComponentContext.js +81 -19
  66. package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
  67. package/dist/pipeline/src/context/createWorkspaceContext.d.ts +9 -0
  68. package/dist/pipeline/src/context/createWorkspaceContext.js +86 -0
  69. package/dist/pipeline/src/context/createWorkspaceContext.js.map +1 -0
  70. package/dist/pipeline/src/context/getBuildInfoVariables.d.ts +1 -1
  71. package/dist/pipeline/src/context/getBuildInfoVariables.js.map +1 -1
  72. package/dist/pipeline/src/context/getEnvironmentContext.d.ts +1 -1
  73. package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
  74. package/dist/pipeline/src/context/getEnvironmentVariables.js +10 -6
  75. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  76. package/dist/pipeline/src/context/getLabels.js +2 -2
  77. package/dist/pipeline/src/context/getLabels.js.map +1 -1
  78. package/dist/pipeline/src/deploy/base/deploy.d.ts +1 -1
  79. package/dist/pipeline/src/deploy/base/deploy.js +29 -6
  80. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  81. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js +3 -3
  82. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
  83. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.d.ts +4 -4
  84. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
  85. package/dist/pipeline/src/deploy/cloudRun/index.d.ts +2 -2
  86. package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
  87. package/dist/pipeline/src/deploy/custom/index.d.ts +2 -2
  88. package/dist/pipeline/src/deploy/custom/index.js.map +1 -1
  89. package/dist/pipeline/src/deploy/dockerTag/index.d.ts +2 -2
  90. package/dist/pipeline/src/deploy/dockerTag/index.js.map +1 -1
  91. package/dist/pipeline/src/deploy/index.d.ts +7 -7
  92. package/dist/pipeline/src/deploy/index.js.map +1 -1
  93. package/dist/pipeline/src/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
  94. package/dist/pipeline/src/deploy/kubernetes/additionalSecretKeys.js.map +1 -1
  95. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +1 -1
  96. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  97. package/dist/pipeline/src/deploy/kubernetes/deployJob.js +1 -1
  98. package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
  99. package/dist/pipeline/src/deploy/kubernetes/index.d.ts +2 -2
  100. package/dist/pipeline/src/deploy/kubernetes/index.js.map +1 -1
  101. package/dist/pipeline/src/deploy/sbom.d.ts +1 -1
  102. package/dist/pipeline/src/deploy/sbom.js +6 -3
  103. package/dist/pipeline/src/deploy/sbom.js.map +1 -1
  104. package/dist/pipeline/src/pipeline/createAllJobs.d.ts +12 -10
  105. package/dist/pipeline/src/pipeline/createAllJobs.js +84 -44
  106. package/dist/pipeline/src/pipeline/createAllJobs.js.map +1 -1
  107. package/dist/pipeline/src/pipeline/createChildPipeline.js.map +1 -1
  108. package/dist/pipeline/src/pipeline/createJobsForComponent.js +3 -4
  109. package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
  110. package/dist/pipeline/src/pipeline/createJobsForWorkspace.d.ts +3 -0
  111. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js +10 -0
  112. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -0
  113. package/dist/pipeline/src/pipeline/createMainPipeline.js +18 -8
  114. package/dist/pipeline/src/pipeline/createMainPipeline.js.map +1 -1
  115. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.d.ts +3 -3
  116. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js +158 -51
  117. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
  118. package/dist/pipeline/src/pipeline/packageManager.d.ts +2 -1
  119. package/dist/pipeline/src/pipeline/packageManager.js +36 -15
  120. package/dist/pipeline/src/pipeline/packageManager.js.map +1 -1
  121. package/dist/pipeline/src/types/config.d.ts +2 -1
  122. package/dist/pipeline/src/types/context.d.ts +80 -12
  123. package/dist/pipeline/src/types/context.js +9 -0
  124. package/dist/pipeline/src/types/context.js.map +1 -1
  125. package/dist/pipeline/src/types/environmentContext.d.ts +5 -6
  126. package/dist/pipeline/src/types/jobs.d.ts +5 -0
  127. package/dist/tsconfig.tsbuildinfo +1 -1
  128. package/package.json +1 -1
  129. package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +4 -4
  130. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +2 -10
  131. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +2 -2
  132. package/src/apps/cli/commands/project/setup/setupContext.ts +2 -14
  133. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +3 -3
  134. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +3 -16
  135. package/src/gcloud/serviceAccounts.ts +4 -4
@@ -1,9 +1,9 @@
1
1
  import type { StringOrBashExpression } from "../bash/BashExpression";
2
- import type { BuildConfig } from "../build";
2
+ import type { BuildConfigFromWorkspace, BuildConfigStandalone, WorkspaceBuildConfig } from "../build";
3
3
  import type { PredefinedVariables, SecretEnvVar } from "../context";
4
4
  import type { DeployConfig } from "../deploy";
5
- import type { PipelineTrigger, ComponentConfig, Config, EnvType } from "./config";
6
- import type { CatladderJob } from "./jobs";
5
+ import type { ComponentConfig, Config, EnvType, PipelineTrigger } from "./config";
6
+ import type { BaseStage, CatladderJob } from "./jobs";
7
7
  import type { PipelineType } from "./pipeline";
8
8
  export type UnspecifiedEnvVars = Record<string, StringOrBashExpression | undefined | null>;
9
9
  export type EnvironmentEnvVars<V extends UnspecifiedEnvVars = UnspecifiedEnvVars> = {
@@ -28,6 +28,9 @@ export type Environment = {
28
28
  * the full name of the app. We use this as RELEASE_NAME in kubernetes and the service name in google cloud run
29
29
  */
30
30
  fullName: StringOrBashExpression;
31
+ /**
32
+ * @deprecated this is the same as context.env, use that instead
33
+ */
31
34
  shortName: string;
32
35
  /**
33
36
  * the environment slug without component name.
@@ -49,33 +52,78 @@ export type YarnWorkspace = {
49
52
  workspaceDependencies: string[];
50
53
  mismatchedWorkspaceDependencies: string[];
51
54
  };
52
- export type YarnPackageManagerInfoComponent = {
55
+ export type YarnPackageManagerInfoBase = {
53
56
  type: "yarn";
54
57
  version: string;
55
58
  workspaces: YarnWorkspace[];
56
- currentWorkspace?: YarnWorkspace;
57
59
  isClassic: boolean;
60
+ };
61
+ export type YarnPackageManagerInfoComponent = YarnPackageManagerInfoBase & {
62
+ currentWorkspace?: YarnWorkspace;
58
63
  componentIsInWorkspace: boolean;
59
64
  pathsToCopyInDocker: string[];
60
65
  currentWorkspaceDependencies: string[];
61
66
  };
62
67
  export type PackageManagerInfoComponent = YarnPackageManagerInfoComponent;
68
+ /**
69
+ * not confuse with yarn workspaces
70
+ */
71
+ export type PackageManagerInfoBase = YarnPackageManagerInfoBase;
63
72
  export type ContextBeforeConfig = {
64
73
  componentName: string;
65
74
  fullConfig: Config;
66
75
  packageManagerInfo?: PackageManagerInfoComponent;
67
76
  };
68
- export type BuildContextComponent = {
77
+ export type BuildContextBase = {
78
+ /**
79
+ * the directory where the component or workspace is located
80
+ */
69
81
  dir: string;
70
- config: BuildConfig;
82
+ /**
83
+ * directories of all components that are part of the build.
84
+ * In case of a standalone build, this is just the dir of the component + yarn workspace dependencies (if mode = all)
85
+ *
86
+ * in case of a workspace this contains all components in the workspace (+ yarn workspace dependencies if mode = all)
87
+ */
88
+ getComponentDirs: (mode: "direct" | "all") => string[];
89
+ };
90
+ export type BuildContextComponentBase = BuildContextBase;
91
+ export type BuildContextStandalone<C extends BuildConfigStandalone = BuildConfigStandalone> = BuildContextComponentBase & {
92
+ config: C;
93
+ type: "standalone";
94
+ buildType: C["type"];
95
+ };
96
+ export type BuildContextFromWorkspace = BuildContextComponentBase & {
97
+ config: BuildConfigFromWorkspace;
98
+ workspaceName: string;
99
+ buildType: WorkspaceBuildConfig["type"];
100
+ /**
101
+ * merged docker config
102
+ */
103
+ workspaceBuildConfig: WorkspaceBuildConfig;
104
+ type: "fromWorkspace";
105
+ };
106
+ export type BuildContextWorkspace = BuildContextBase & {
107
+ type: "workspace";
108
+ buildType: WorkspaceBuildConfig["type"];
109
+ config: WorkspaceBuildConfig;
71
110
  };
72
- export type BuildContext = BuildContextComponent;
111
+ export type BuildContextComponent = BuildContextStandalone | BuildContextFromWorkspace;
112
+ export type BuildContext = BuildContextComponent | BuildContextWorkspace;
73
113
  export type DeployContext = {
74
114
  config: DeployConfig;
75
115
  };
76
- export type ComponentContext = {
77
- componentName: string;
116
+ export type ComponentContext<BC extends BuildContextComponent = BuildContextComponent> = {
117
+ type: "component";
78
118
  env: string;
119
+ /**
120
+ * the name of the component
121
+ */
122
+ name: string;
123
+ /**
124
+ * @deprecated use name instead
125
+ */
126
+ componentName: string;
79
127
  /**
80
128
  * the merged component config.
81
129
  *
@@ -83,7 +131,7 @@ export type ComponentContext = {
83
131
  *
84
132
  */
85
133
  componentConfig: ComponentConfig;
86
- build: BuildContextComponent;
134
+ build: BC;
87
135
  deploy?: DeployContext | null;
88
136
  fullConfig: Config;
89
137
  environment: Environment;
@@ -92,4 +140,24 @@ export type ComponentContext = {
92
140
  packageManagerInfo: PackageManagerInfoComponent;
93
141
  customJobs?: CatladderJob[];
94
142
  };
95
- export type Context = ComponentContext;
143
+ export type Context = ComponentContext | WorkspaceContext;
144
+ export type CatladderJobWithContext<S = BaseStage> = CatladderJob<S> & {
145
+ context: ComponentContext;
146
+ };
147
+ export declare const componentContextIsStandaloneBuild: (context: ComponentContext<BuildContextComponent>) => context is ComponentContext<BuildContextStandalone<BuildConfigStandalone>>;
148
+ export declare const componentContextHasWorkspaceBuild: (context: ComponentContext<BuildContextComponent>) => context is ComponentContext<BuildContextFromWorkspace>;
149
+ export type WorkspaceContext = {
150
+ type: "workspace";
151
+ /**
152
+ * the name of the workspace
153
+ */
154
+ name: string;
155
+ fullConfig: Config;
156
+ workspaceConfig: WorkspaceBuildConfig;
157
+ packageManagerInfo: PackageManagerInfoBase;
158
+ components: Array<ComponentContext>;
159
+ build: BuildContextWorkspace;
160
+ trigger: PipelineTrigger;
161
+ pipelineType: PipelineType;
162
+ env: string;
163
+ };
@@ -1,3 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.componentContextHasWorkspaceBuild = exports.componentContextIsStandaloneBuild = void 0;
4
+ var componentContextIsStandaloneBuild = function (context) {
5
+ return context.build.type === "standalone";
6
+ };
7
+ exports.componentContextIsStandaloneBuild = componentContextIsStandaloneBuild;
8
+ var componentContextHasWorkspaceBuild = function (context) {
9
+ return context.build.type === "fromWorkspace";
10
+ };
11
+ exports.componentContextHasWorkspaceBuild = componentContextHasWorkspaceBuild;
3
12
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../../pipeline/src/types/context.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../../pipeline/src/types/context.ts"],"names":[],"mappings":";;;AA+LO,IAAM,iCAAiC,GAAG,UAC/C,OAAgD;IAEhD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC;AAC7C,CAAC,CAAC;AAJW,QAAA,iCAAiC,qCAI5C;AAEK,IAAM,iCAAiC,GAAG,UAC/C,OAAgD;IAEhD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,eAAe,CAAC;AAChD,CAAC,CAAC;AAJW,QAAA,iCAAiC,qCAI5C"}
@@ -1,13 +1,12 @@
1
1
  import type { StringOrBashExpression } from "../bash/BashExpression";
2
- import type { BuildConfigGeneric, BuildConfigType } from "../build";
3
- import type { DeployConfigGeneric } from "../deploy";
4
- import type { DeployConfigType } from "../deploy";
2
+ import type { BuildConfig } from "../build";
3
+ import type { DeployConfig } from "../deploy";
5
4
  import type { Config, EnvConfigWithComponent, EnvType } from "./config";
6
5
  import type { PipelineType } from "./pipeline";
7
- export type EnvironmentContext<B extends BuildConfigType, D extends DeployConfigType> = {
6
+ export type EnvironmentContext<B extends BuildConfig = BuildConfig, D extends DeployConfig = DeployConfig> = {
8
7
  envConfigRaw: EnvConfigWithComponent;
9
- buildConfigRaw: false | BuildConfigGeneric<B>;
10
- deployConfigRaw: false | DeployConfigGeneric<D>;
8
+ buildConfigRaw: false | B;
9
+ deployConfigRaw: false | D;
11
10
  env: string;
12
11
  envType: EnvType;
13
12
  componentName: string;
@@ -6,6 +6,10 @@ export type CatladderJobNeed = string | {
6
6
  job: string;
7
7
  artifacts: boolean;
8
8
  componentName?: string;
9
+ } | {
10
+ job: string;
11
+ artifacts: boolean;
12
+ workspaceName: string;
9
13
  };
10
14
  export type CatladderJobEnvironmentConfig = {
11
15
  action?: GitlabEnvironment["action"];
@@ -38,6 +42,7 @@ export type CatladderJob<S = BaseStage> = {
38
42
  needsStages?: {
39
43
  stage: S;
40
44
  artifacts?: boolean;
45
+ workspaceName?: string;
41
46
  }[];
42
47
  /**
43
48
  * does this require another job (from the same component)?