@catladder/pipeline 0.0.2 → 0.0.6
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/scripts/createSamplePipeline.d.ts +2 -0
- package/dist/scripts/createSamplePipeline.js +14 -0
- package/dist/scripts/magic/build/docker.d.ts +2 -0
- package/dist/scripts/magic/build/docker.js +68 -0
- package/dist/scripts/magic/build/index.d.ts +9 -0
- package/dist/scripts/magic/build/index.js +10 -0
- package/dist/scripts/magic/build/node.d.ts +5 -0
- package/dist/scripts/magic/build/node.js +137 -0
- package/dist/scripts/magic/build/types.d.ts +12 -0
- package/dist/scripts/magic/build/types.js +7 -0
- package/dist/scripts/magic/createChildPipeline/index.d.ts +5 -0
- package/dist/scripts/magic/createChildPipeline/index.js +153 -0
- package/dist/scripts/magic/createPipeline.d.ts +14 -0
- package/dist/scripts/magic/createPipeline.js +80 -0
- package/dist/scripts/magic/deploy/index.d.ts +9 -0
- package/dist/scripts/magic/deploy/index.js +12 -0
- package/dist/scripts/magic/deploy/kubernetes.d.ts +5 -0
- package/dist/scripts/magic/deploy/kubernetes.js +62 -0
- package/dist/scripts/magic/deploy/types.d.ts +41 -0
- package/dist/scripts/magic/deploy/types.js +7 -0
- package/dist/scripts/magic/index.d.ts +2 -0
- package/dist/scripts/magic/sample-config.d.ts +3 -0
- package/dist/scripts/magic/sample-config.js +77 -0
- package/dist/scripts/magic/tests/createPipeline.test.d.ts +1 -0
- package/dist/scripts/magic/tests/createPipeline.test.js +89 -0
- package/dist/scripts/magic/types/config.d.ts +49 -0
- package/dist/scripts/magic/types/config.js +17 -0
- package/dist/scripts/magic/types/context.d.ts +19 -0
- package/dist/scripts/magic/types/context.js +2 -0
- package/dist/scripts/magic/types/gitlab-types.d.ts +57 -0
- package/dist/scripts/magic/types/gitlab-types.js +2 -0
- package/dist/scripts/magic/types/index.d.ts +3 -0
- package/dist/scripts/magic/types/index.js +15 -0
- package/dist/scripts/magic.d.ts +2 -0
- package/dist/scripts/magic.js +43 -0
- package/dist/scripts/monorepoGenerate.d.ts +2 -0
- package/dist/scripts/monorepoGenerate.js +164 -0
- package/dist/scripts/printAllValues.d.ts +2 -0
- package/dist/scripts/printAllValues.js +58 -0
- package/dist/scripts/printBuildEnv.d.ts +2 -0
- package/dist/scripts/printBuildEnv.js +77 -0
- package/dist/scripts/utils/extractAllValues.d.ts +1 -0
- package/dist/scripts/utils/extractAllValues.js +78 -0
- package/dist/scripts/utils/extractBuildEnv.d.ts +5 -0
- package/dist/scripts/utils/extractBuildEnv.js +152 -0
- package/dist/scripts/utils/extractValuesFromEnvVars.d.ts +2 -0
- package/dist/scripts/utils/extractValuesFromEnvVars.js +63 -0
- package/dist/scripts/utils/extractValuesFromMr.d.ts +2 -0
- package/dist/scripts/utils/extractValuesFromMr.js +86 -0
- package/dist/tests/extractValuesFromMr.test.d.ts +1 -0
- package/dist/tests/extractValuesFromMr.test.js +68 -0
- package/package.json +1 -1
- package/scripts/createSamplePipeline.ts +10 -0
- package/scripts/kubernetesCreateSecret +3 -2
- package/scripts/kubernetesDelete +1 -1
- package/scripts/kubernetesDeploy +6 -8
- package/scripts/kubernetesEnsureNamespace +2 -2
- package/scripts/magic/{types/build → build}/docker.ts +13 -6
- package/scripts/magic/build/index.ts +16 -0
- package/scripts/magic/{types/build → build}/node.ts +56 -33
- package/scripts/magic/build/types.ts +17 -0
- package/scripts/magic/createChildPipeline/index.ts +48 -35
- package/scripts/magic/createPipeline.ts +10 -6
- package/scripts/magic/deploy/index.ts +19 -0
- package/scripts/magic/deploy/kubernetes.ts +65 -0
- package/scripts/magic/{types/deploy → deploy}/types.ts +0 -0
- package/scripts/magic/sample-config.ts +1 -1
- package/scripts/magic/tests/createPipeline.test.ts +41 -0
- package/scripts/magic/types/config.ts +3 -3
- package/scripts/magic/types/context.ts +9 -1
- package/scripts/magic/types/gitlab-types.ts +4 -12
- package/scripts/magic.ts +4 -4
- package/scripts/utils/extractBuildEnv.ts +2 -0
- package/scripts/magic/types/build/index.ts +0 -11
- package/scripts/magic/types/build/types.ts +0 -9
- package/scripts/magic/types/deploy/index.ts +0 -11
- package/scripts/magic/types/deploy/kubernetes.ts +0 -38
package/scripts/magic.ts
CHANGED
|
@@ -17,16 +17,16 @@ const isHotfixBranch = false; // TODO: $CI_COMMIT_BRANCH =~ /^[0-9]+\.([0-9]+|x
|
|
|
17
17
|
const isMergeRequest = Boolean(CI_MERGE_REQUEST_ID);
|
|
18
18
|
const isTaggedRelease = Boolean(CI_COMMIT_TAG);
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const fullPath = (ext: string) => process.cwd() + "/catladder." + ext;
|
|
21
21
|
const readConfig = () => {
|
|
22
22
|
const found = ["ts", "js", "yml", "yaml"].find((extension) =>
|
|
23
|
-
existsSync(
|
|
23
|
+
existsSync(fullPath(extension))
|
|
24
24
|
);
|
|
25
25
|
if (found) {
|
|
26
26
|
if (found === "ts" || found === "js") {
|
|
27
|
-
return require(
|
|
27
|
+
return require(fullPath(found)).default;
|
|
28
28
|
} else {
|
|
29
|
-
return parse(
|
|
29
|
+
return parse(fullPath(found));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GitlabJobs } from "../gitlab-types";
|
|
2
|
-
import { Context } from "../context";
|
|
3
|
-
import { createNodeJobs } from "./node";
|
|
4
|
-
import { BuildConfig } from "./types";
|
|
5
|
-
|
|
6
|
-
export const buildJobCreators: {
|
|
7
|
-
[type in BuildConfig["type"]]: (context: Context) => GitlabJobs;
|
|
8
|
-
} = {
|
|
9
|
-
node: createNodeJobs,
|
|
10
|
-
"node-static": createNodeJobs, // TODO
|
|
11
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GitlabJobs } from "../gitlab-types";
|
|
2
|
-
import { ComponentConfig } from "../config";
|
|
3
|
-
import { Context } from "../context";
|
|
4
|
-
import { createKubernetesDeployJobs } from "./kubernetes";
|
|
5
|
-
|
|
6
|
-
export const deployJobCreators: {
|
|
7
|
-
[type in ComponentConfig["deploy"]["type"]]: (context: Context) => GitlabJobs;
|
|
8
|
-
} = {
|
|
9
|
-
kubernetes: createKubernetesDeployJobs,
|
|
10
|
-
serverless: () => [],
|
|
11
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { GitlabJobs } from "../gitlab-types";
|
|
2
|
-
import { Context } from "../context";
|
|
3
|
-
import { isOfType } from "./types";
|
|
4
|
-
|
|
5
|
-
export const createKubernetesDeployJobs = (context: Context): GitlabJobs => {
|
|
6
|
-
const deployConfig = context.componentConfig.deploy;
|
|
7
|
-
if (!isOfType(deployConfig, "kubernetes")) {
|
|
8
|
-
// should not happen
|
|
9
|
-
throw new Error("deploy config is not kubernetes");
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return [
|
|
13
|
-
{
|
|
14
|
-
name: "deploy-to-kubernetes",
|
|
15
|
-
env: true,
|
|
16
|
-
job: (environment) => ({
|
|
17
|
-
variables: {
|
|
18
|
-
...environment.variables,
|
|
19
|
-
RELEASE_NAME: "${CUSTOMER_NAME}-${APP_NAME}-${CI_ENVIRONMENT_SLUG}",
|
|
20
|
-
},
|
|
21
|
-
stage: "deploy",
|
|
22
|
-
dependencies: [],
|
|
23
|
-
script: [
|
|
24
|
-
"kubernetesEnsureNamespace",
|
|
25
|
-
"kubernetesCreateSecret",
|
|
26
|
-
"kubernetesDeploy",
|
|
27
|
-
],
|
|
28
|
-
environment: {
|
|
29
|
-
name: environment.fullName,
|
|
30
|
-
url: environment.url,
|
|
31
|
-
kubernetes: {
|
|
32
|
-
namespace: environment.variables.KUBE_NAMESPACE,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
};
|