@catladder/pipeline 1.101.4 → 1.102.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 (35) hide show
  1. package/dist/build/base/createBuildJob.js +1 -1
  2. package/dist/build/custom/testJob.js +2 -2
  3. package/dist/build/node/testJob.js +2 -2
  4. package/dist/build/rails/build.js +11 -1
  5. package/dist/build/rails/test.js +1 -1
  6. package/dist/build/types.d.ts +8 -1
  7. package/dist/bundles/catladder-gitlab/index.js +3 -3
  8. package/dist/constants.js +1 -1
  9. package/dist/context/getEnvironment.js +18 -12
  10. package/dist/context/getEnvironmentVariables.d.ts +2 -7
  11. package/dist/context/getEnvironmentVariables.js +27 -31
  12. package/dist/context/transformJobOnlyVars.d.ts +10 -0
  13. package/dist/context/transformJobOnlyVars.js +160 -0
  14. package/dist/context/utils/envVars.d.ts +8 -0
  15. package/dist/context/utils/envVars.js +52 -0
  16. package/dist/deploy/base.js +3 -3
  17. package/dist/deploy/types/base.d.ts +8 -0
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/dist/types/context.d.ts +16 -6
  20. package/examples/__snapshots__/custom-deploy.ts.snap +8 -0
  21. package/examples/custom-deploy.ts +3 -0
  22. package/package.json +1 -1
  23. package/src/build/base/createBuildJob.ts +1 -0
  24. package/src/build/custom/testJob.ts +1 -0
  25. package/src/build/node/testJob.ts +1 -0
  26. package/src/build/rails/build.ts +4 -1
  27. package/src/build/rails/test.ts +4 -1
  28. package/src/build/types.ts +9 -1
  29. package/src/context/getEnvironment.ts +9 -7
  30. package/src/context/getEnvironmentVariables.ts +36 -24
  31. package/src/context/transformJobOnlyVars.ts +42 -0
  32. package/src/context/utils/envVars.ts +26 -0
  33. package/src/deploy/base.ts +3 -0
  34. package/src/deploy/types/base.ts +10 -0
  35. package/src/types/context.ts +18 -6
@@ -76,6 +76,7 @@ export const getBaseDeploymentJob = (context: Context): JobWithoutScript => {
76
76
  ...DEPLOY_RUNNER_VARIABLES,
77
77
  ...context.environment.envVars,
78
78
  ...(hasDocker ? getDockerImageVariables(context) : {}),
79
+ ...context.environment.jobOnlyVars.deploy.envVars,
79
80
  ...(context.componentConfig.deploy
80
81
  ? context.componentConfig.deploy.extraVars ?? {}
81
82
  : {}),
@@ -115,6 +116,7 @@ export const getBaseDeploymentStopJob = (
115
116
  ],
116
117
  variables: {
117
118
  ...DEPLOY_RUNNER_VARIABLES,
119
+ ...context.environment.jobOnlyVars.deploy.envVars,
118
120
  GIT_STRATEGY: "none",
119
121
  },
120
122
  stage: "stop",
@@ -138,6 +140,7 @@ export const getBaseRollbackJob = (context: Context): JobWithoutScript => {
138
140
  ],
139
141
  variables: {
140
142
  ...DEPLOY_RUNNER_VARIABLES,
143
+ ...context.environment.jobOnlyVars.deploy.envVars,
141
144
  GIT_STRATEGY: "none",
142
145
  },
143
146
  stage: "rollback",
@@ -1,3 +1,5 @@
1
+ import type { EnvVars } from "../../types/config";
2
+
1
3
  export type DeployConfigBase = {
2
4
  /**
3
5
  * whether to deploy automatically or manual. If not defined, these rules apply:
@@ -17,8 +19,16 @@ export type DeployConfigBase = {
17
19
  */
18
20
  jobTags?: string[];
19
21
 
22
+ /**
23
+ * vars that only exist in the deploy job.
24
+ * Can curently not reference other variables from other components
25
+ */
26
+ jobVars?: EnvVars;
27
+
20
28
  /**
21
29
  * additional env vars for the deploy job
30
+ *
31
+ * @deprecated use deploy.jobVars for deploy job specific variables
22
32
  */
23
33
  extraVars?: Record<string, string>;
24
34
  };
@@ -6,6 +6,22 @@ import type {
6
6
  EnvType,
7
7
  } from "./config";
8
8
 
9
+ export type EnvironmentEnvVars = {
10
+ envVars: Record<string, string>;
11
+ secretEnvVarKeys: SecretEnvVar[];
12
+ };
13
+ export type EnvironmentEnvVarPart = {
14
+ host: string;
15
+ url: string;
16
+
17
+ /**
18
+ * vars that only are injected in certain jobs, but not elsewhere
19
+ */
20
+ jobOnlyVars: {
21
+ deploy: EnvironmentEnvVars;
22
+ build: EnvironmentEnvVars;
23
+ };
24
+ } & EnvironmentEnvVars;
9
25
  export type Environment = {
10
26
  host: string;
11
27
  url: string;
@@ -21,13 +37,9 @@ export type Environment = {
21
37
  shortName: string;
22
38
  slugPrefix: string;
23
39
  slug: string;
24
- /**
25
- * env vars contain all build-time env vars. secrets have to be resolved (they are stored in gitlab)
26
- */
27
- envVars: Record<string, string>;
40
+
28
41
  envType: EnvType;
29
- secretEnvVarKeys: SecretEnvVar[];
30
- };
42
+ } & EnvironmentEnvVarPart;
31
43
 
32
44
  export type CommitInfo = {
33
45
  refName: string;