@catladder/pipeline 1.102.0 → 1.103.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.
- package/dist/build/base/createBuildJob.js +2 -1
- package/dist/build/base/writeDotEnv.d.ts +7 -0
- package/dist/build/base/writeDotEnv.js +43 -0
- package/dist/bundles/catladder-gitlab/index.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +6 -0
- package/examples/__snapshots__/native-app.ts.snap +2958 -0
- package/examples/native-app.ts +81 -0
- package/package.json +1 -1
- package/src/build/base/createBuildJob.ts +2 -0
- package/src/build/base/writeDotEnv.ts +21 -0
- package/src/types/config.ts +7 -0
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
import type { CatladderJob } from "../src/types/jobs";
|
|
3
|
+
import { createAllPipelines } from "./__utils__/helpers";
|
|
4
|
+
const APP_GEM_CACHE: CatladderJob["cache"] = [
|
|
5
|
+
{
|
|
6
|
+
key: {
|
|
7
|
+
files: ["app/Gemfile.lock"],
|
|
8
|
+
},
|
|
9
|
+
paths: ["app/vendor"],
|
|
10
|
+
},
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const config: Config = {
|
|
14
|
+
appName: "test-app",
|
|
15
|
+
customerName: "pan",
|
|
16
|
+
components: {
|
|
17
|
+
app: {
|
|
18
|
+
dir: "app",
|
|
19
|
+
dotEnv: true,
|
|
20
|
+
vars: {
|
|
21
|
+
public: {
|
|
22
|
+
GRAPHQL_URL: "${api:ROOT_URL}/graphql",
|
|
23
|
+
},
|
|
24
|
+
secret: [
|
|
25
|
+
"APP_STORE_CONNECT_API_KEY_CONTENT",
|
|
26
|
+
"APP_STORE_CONNECT_ISSUER_ID",
|
|
27
|
+
"APP_STORE_CONNECT_API_KEY_ID",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
build: {
|
|
31
|
+
extraVars: {
|
|
32
|
+
LC_A: "L=en_US.UTF-8",
|
|
33
|
+
LANG: "en_US.UTF-8",
|
|
34
|
+
},
|
|
35
|
+
type: "node",
|
|
36
|
+
buildCommand: [
|
|
37
|
+
"bundle config set --local path 'vendor/ruby'",
|
|
38
|
+
"gem install bundler",
|
|
39
|
+
"bundle install",
|
|
40
|
+
"bundle exec pod install --project-directory=ios",
|
|
41
|
+
"bundle exec fastlane build",
|
|
42
|
+
],
|
|
43
|
+
jobTags: ["mac-runner"],
|
|
44
|
+
jobCache: APP_GEM_CACHE,
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
deploy: {
|
|
48
|
+
type: "custom",
|
|
49
|
+
extraVars: {
|
|
50
|
+
LC_A: "L=en_US.UTF-8",
|
|
51
|
+
LANG: "en_US.UTF-8",
|
|
52
|
+
},
|
|
53
|
+
requiresDocker: false,
|
|
54
|
+
script: [
|
|
55
|
+
"bundle config set --local path 'vendor/ruby'",
|
|
56
|
+
"gem install bundler",
|
|
57
|
+
"bundle install",
|
|
58
|
+
"bundle exec fastlane deploy_test",
|
|
59
|
+
],
|
|
60
|
+
jobTags: ["mac-runner"],
|
|
61
|
+
jobCache: APP_GEM_CACHE,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
api: {
|
|
66
|
+
dir: "api",
|
|
67
|
+
build: {
|
|
68
|
+
type: "node",
|
|
69
|
+
},
|
|
70
|
+
deploy: {
|
|
71
|
+
type: "google-cloudrun",
|
|
72
|
+
projectId: "asdf",
|
|
73
|
+
region: "asia-east1",
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
it("matches snapshot", async () => {
|
|
80
|
+
expect(await createAllPipelines(config)).toMatchSnapshot();
|
|
81
|
+
});
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
RUNNER_BUILD_RESOURCE_VARIABLES,
|
|
11
11
|
} from "./constants";
|
|
12
12
|
import { writeBuildInfo } from "./writeBuildInfo";
|
|
13
|
+
import { writeDotEnv } from "./writeDotEnv";
|
|
13
14
|
|
|
14
15
|
export const createBuildJob = (
|
|
15
16
|
context: Context,
|
|
@@ -32,6 +33,7 @@ export const createBuildJob = (
|
|
|
32
33
|
},
|
|
33
34
|
|
|
34
35
|
script: [
|
|
36
|
+
...(context.componentConfig.dotEnv ? writeDotEnv(context) : []),
|
|
35
37
|
...writeBuildInfo(context),
|
|
36
38
|
...ensureNodeVersion(context), // in pure node repos, we might want to have the nvmrc file in top-level
|
|
37
39
|
`cd ${context.componentConfig.dir}`,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Context } from "../../types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* writes a .env file in the components folder
|
|
5
|
+
* @param context
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export const writeDotEnv = (context: Context) => {
|
|
9
|
+
const envVars = context.environment.envVars;
|
|
10
|
+
|
|
11
|
+
// make key=value and sanitize multiline
|
|
12
|
+
const keyValueString = Object.entries(envVars)
|
|
13
|
+
.map(([key, value]) => `${key}=${value.replaceAll("\n", "\\n")}`)
|
|
14
|
+
.join("\n");
|
|
15
|
+
|
|
16
|
+
return [
|
|
17
|
+
`cat <<EOF > ${context.componentConfig.dir}/.env
|
|
18
|
+
${keyValueString}
|
|
19
|
+
EOF`,
|
|
20
|
+
];
|
|
21
|
+
};
|
package/src/types/config.ts
CHANGED
|
@@ -144,6 +144,13 @@ export type ComponentConfig<C extends ConfigProps = never> = {
|
|
|
144
144
|
* This feedback will help us to generalize use cases
|
|
145
145
|
*/
|
|
146
146
|
customJobs?: CatladderJob[] | ((context: Context) => CatladderJob[]);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* experimental. whether to create a .env localy and during build jobs
|
|
150
|
+
*
|
|
151
|
+
* Be careful, this will overwrite any existing .env file!
|
|
152
|
+
*/
|
|
153
|
+
dotEnv?: boolean;
|
|
147
154
|
} & DefaultEnvConfig;
|
|
148
155
|
|
|
149
156
|
export type ConfigProps = {
|