@quadnix/octo-build 0.0.17 → 0.2.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/LICENSE +661 -0
- package/README.md +117 -8
- package/dist/commands/apply/apply.command.d.ts +25 -0
- package/dist/commands/apply/apply.command.js +130 -0
- package/dist/commands/apply/apply.command.js.map +1 -0
- package/dist/commands/apply/index.d.ts +1 -0
- package/dist/commands/apply/index.js +2 -0
- package/dist/commands/apply/index.js.map +1 -0
- package/dist/commands/build/build.command.d.ts +1 -1
- package/dist/commands/build/build.command.js +4 -4
- package/dist/commands/build/build.command.js.map +1 -1
- package/dist/commands/build/main.d.ts +22 -0
- package/dist/commands/build/main.js +22 -0
- package/dist/commands/build/main.js.map +1 -1
- package/dist/commands/build/parsers/build-file.parser.d.ts +6 -0
- package/dist/commands/build/parsers/build-file.parser.js +6 -0
- package/dist/commands/build/parsers/build-file.parser.js.map +1 -1
- package/dist/commands/build/streams/stream-manager.d.ts +6 -0
- package/dist/commands/build/streams/stream-manager.js +7 -1
- package/dist/commands/build/streams/stream-manager.js.map +1 -1
- package/dist/commands/commit/commit.command.d.ts +23 -0
- package/dist/commands/commit/commit.command.js +81 -0
- package/dist/commands/commit/commit.command.js.map +1 -0
- package/dist/commands/commit/index.d.ts +1 -0
- package/dist/commands/commit/index.js +2 -0
- package/dist/commands/commit/index.js.map +1 -0
- package/dist/commands/create-anchor/create-anchor.command.js +1 -1
- package/dist/commands/create-anchor/create-anchor.command.js.map +1 -1
- package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.d.ts +18 -3
- package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js +29 -11
- package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js.map +1 -1
- package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/templates/anchors/anchor/anchor.schema.ts.ejs +9 -1
- package/dist/commands/create-app/create-app.command.d.ts +1 -1
- package/dist/commands/create-app/create-app.command.js +7 -3
- package/dist/commands/create-app/create-app.command.js.map +1 -1
- package/dist/commands/create-app/generator-octo-app-template/generators/app/index.d.ts +17 -1
- package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js +72 -16
- package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js.map +1 -1
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/README.md.ejs +73 -14
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/gitignore.ejs +14 -0
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/index.ts.ejs +19 -0
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/package.json.ejs +9 -1
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-dynamodb-service/octo.yaml.ejs +111 -0
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/octo.yaml.ejs +28 -16
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/octo.yaml.ejs +25 -3
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/tsconfig.json.ejs +0 -3
- package/dist/commands/{create-resource/create-resource.command.d.ts → create-external-resource/create-external-resource.command.d.ts} +1 -1
- package/dist/commands/create-external-resource/create-external-resource.command.js +64 -0
- package/dist/commands/create-external-resource/create-external-resource.command.js.map +1 -0
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/index.d.ts +17 -2
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/index.js +36 -35
- package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/index.js.map +1 -0
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/actions/add.resource.action.ts.ejs +7 -16
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/actions/delete.resource.action.ts.ejs +21 -3
- package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/templates/resources/resource/actions/update.resource.action.ts.ejs +63 -0
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/index.ts.ejs +1 -2
- package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +28 -0
- package/dist/commands/create-external-resource/index.d.ts +1 -0
- package/dist/commands/create-external-resource/index.js +2 -0
- package/dist/commands/create-external-resource/index.js.map +1 -0
- package/dist/commands/create-model/create-model.command.js +1 -1
- package/dist/commands/create-model/create-model.command.js.map +1 -1
- package/dist/commands/create-model/generator-octo-model-template/generators/app/index.d.ts +17 -2
- package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js +26 -9
- package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js.map +1 -1
- package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/model.ts.ejs +41 -1
- package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/schema.ts.ejs +6 -1
- package/dist/commands/create-module/create-module.command.js +1 -1
- package/dist/commands/create-module/create-module.command.js.map +1 -1
- package/dist/commands/create-module/generator-octo-module-template/generators/app/index.d.ts +17 -2
- package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js +27 -10
- package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js.map +1 -1
- package/dist/commands/create-overlay/create-overlay.command.js +4 -3
- package/dist/commands/create-overlay/create-overlay.command.js.map +1 -1
- package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.d.ts +17 -2
- package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js +26 -9
- package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js.map +1 -1
- package/dist/commands/{create-cdk/create-cdk.command.d.ts → create-terraform-resource/create-terraform-resource.command.d.ts} +3 -3
- package/dist/commands/{create-resource/create-resource.command.js → create-terraform-resource/create-terraform-resource.command.js} +17 -11
- package/dist/commands/create-terraform-resource/create-terraform-resource.command.js.map +1 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.d.ts +25 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.js +71 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.js.map +1 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/index.schema.ts.ejs +43 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/index.ts.ejs +1 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +83 -0
- package/dist/commands/create-terraform-resource/index.d.ts +1 -0
- package/dist/commands/create-terraform-resource/index.js +2 -0
- package/dist/commands/create-terraform-resource/index.js.map +1 -0
- package/dist/commands/generate/generate.command.d.ts +16 -0
- package/dist/commands/generate/generate.command.js +35 -0
- package/dist/commands/generate/generate.command.js.map +1 -0
- package/dist/commands/generate/index.d.ts +1 -0
- package/dist/commands/generate/index.js +2 -0
- package/dist/commands/generate/index.js.map +1 -0
- package/dist/commands/get-response/get-response.command.d.ts +18 -0
- package/dist/commands/get-response/get-response.command.js +39 -0
- package/dist/commands/get-response/get-response.command.js.map +1 -0
- package/dist/commands/get-response/index.d.ts +1 -0
- package/dist/commands/get-response/index.js +2 -0
- package/dist/commands/get-response/index.js.map +1 -0
- package/dist/commands/lock/index.d.ts +1 -0
- package/dist/commands/lock/index.js +2 -0
- package/dist/commands/lock/index.js.map +1 -0
- package/dist/commands/lock/lock.command.d.ts +18 -0
- package/dist/commands/lock/lock.command.js +31 -0
- package/dist/commands/lock/lock.command.js.map +1 -0
- package/dist/commands/run-action/index.d.ts +1 -0
- package/dist/commands/run-action/index.js +2 -0
- package/dist/commands/run-action/index.js.map +1 -0
- package/dist/commands/run-action/run-action.command.d.ts +12 -0
- package/dist/commands/run-action/run-action.command.js +40 -0
- package/dist/commands/run-action/run-action.command.js.map +1 -0
- package/dist/commands/unlock/index.d.ts +1 -0
- package/dist/commands/unlock/index.js +2 -0
- package/dist/commands/unlock/index.js.map +1 -0
- package/dist/commands/unlock/unlock.command.d.ts +18 -0
- package/dist/commands/unlock/unlock.command.js +35 -0
- package/dist/commands/unlock/unlock.command.js.map +1 -0
- package/dist/commands/validate/index.d.ts +1 -0
- package/dist/commands/validate/index.js +2 -0
- package/dist/commands/validate/index.js.map +1 -0
- package/dist/commands/validate/validate.command.d.ts +17 -0
- package/dist/commands/validate/validate.command.js +62 -0
- package/dist/commands/validate/validate.command.js.map +1 -0
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/resources/octo-v1.schema.json +108 -27
- package/dist/utilities/definition/yaml/yaml-definition.utility.d.ts +103 -13
- package/dist/utilities/definition/yaml/yaml-definition.utility.js +215 -68
- package/dist/utilities/definition/yaml/yaml-definition.utility.js.map +1 -1
- package/dist/utilities/octo/octo.utility.d.ts +65 -0
- package/dist/utilities/octo/octo.utility.js +178 -0
- package/dist/utilities/octo/octo.utility.js.map +1 -0
- package/dist/utilities/process/process.utility.d.ts +8 -0
- package/dist/utilities/process/process.utility.js +8 -0
- package/dist/utilities/process/process.utility.js.map +1 -1
- package/dist/utilities/project-index/project-index.utility.d.ts +27 -0
- package/dist/utilities/project-index/project-index.utility.js +71 -0
- package/dist/utilities/project-index/project-index.utility.js.map +1 -0
- package/dist/utilities/string/string.utility.d.ts +22 -0
- package/dist/utilities/string/string.utility.js +27 -0
- package/dist/utilities/string/string.utility.js.map +1 -1
- package/package.json +11 -8
- package/dist/commands/create-cdk/create-cdk.command.js +0 -70
- package/dist/commands/create-cdk/create-cdk.command.js.map +0 -1
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.d.ts +0 -10
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js +0 -107
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js.map +0 -1
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/README.md.ejs +0 -23
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/eslint.config.js.ejs +0 -337
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitignore.ejs +0 -82
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitkeep.ejs +0 -0
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/package.json.ejs +0 -57
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/prettierrc.ejs +0 -5
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.schema.ts.ejs +0 -19
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.ts.ejs +0 -17
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/factories/dummy-credentials.factory.ts.ejs +0 -28
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.spec.ts.ejs +0 -90
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.ts.ejs +0 -16
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.schema.ts.ejs +0 -10
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.ts.ejs +0 -3
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/actions/add-dummy-app.model.action.ts.ejs +0 -59
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/index.ts.ejs +0 -1
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/actions/add-http-fetch.resource.action.ts.ejs +0 -55
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/http-fetch.resource.ts.ejs +0 -12
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.schema.ts.ejs +0 -35
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.ts.ejs +0 -3
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/utilities/dummy/dummy.utility.ts.ejs +0 -11
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.build.json.ejs +0 -11
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.json.ejs +0 -39
- package/dist/commands/create-cdk/index.d.ts +0 -1
- package/dist/commands/create-cdk/index.js +0 -2
- package/dist/commands/create-cdk/index.js.map +0 -1
- package/dist/commands/create-resource/create-resource.command.js.map +0 -1
- package/dist/commands/create-resource/generator-octo-resource-template/generators/app/index.js.map +0 -1
- package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/update-tags.resource.action.ts.ejs +0 -86
- package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/validate.resource.action.ts.ejs +0 -40
- package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +0 -12
- package/dist/commands/create-resource/index.d.ts +0 -1
- package/dist/commands/create-resource/index.js +0 -2
- package/dist/commands/create-resource/index.js.map +0 -1
- package/dist/commands/run/index.d.ts +0 -1
- package/dist/commands/run/index.js +0 -2
- package/dist/commands/run/index.js.map +0 -1
- package/dist/commands/run/run.command.d.ts +0 -11
- package/dist/commands/run/run.command.js +0 -96
- package/dist/commands/run/run.command.js.map +0 -1
- package/dist/commands/state/index.d.ts +0 -1
- package/dist/commands/state/index.js +0 -2
- package/dist/commands/state/index.js.map +0 -1
- package/dist/commands/state/state.command.d.ts +0 -14
- package/dist/commands/state/state.command.js +0 -79
- package/dist/commands/state/state.command.js.map +0 -1
- /package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/index.schema.ts.ejs +0 -0
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { createRequire } from 'module';
|
|
2
3
|
import { dirname, join, resolve } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import {
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
5
|
+
import { LocalStateProvider, RemoteStateProvider, TestStateProvider, } from '@quadnix/octo';
|
|
5
6
|
import { Ajv2020 as Ajv } from 'ajv/dist/2020.js';
|
|
6
7
|
import { load } from 'js-yaml';
|
|
7
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
/**
|
|
10
|
+
* Reads `octo.yml` and turns each section into the values {@link Octo} is booted with.
|
|
11
|
+
*/
|
|
8
12
|
export class YamlDefinitionUtility {
|
|
13
|
+
/**
|
|
14
|
+
* @param definitionFilePath Path to the definition file.
|
|
15
|
+
* @throws If the file is unreadable, or fails schema validation.
|
|
16
|
+
*/
|
|
9
17
|
constructor(definitionFilePath) {
|
|
10
18
|
definitionFilePath = resolve(process.cwd(), definitionFilePath);
|
|
19
|
+
this.definitionDir = dirname(definitionFilePath);
|
|
11
20
|
if (!existsSync(definitionFilePath)) {
|
|
12
21
|
throw new Error('Cannot find definition file: ' + definitionFilePath);
|
|
13
22
|
}
|
|
@@ -20,32 +29,20 @@ export class YamlDefinitionUtility {
|
|
|
20
29
|
}
|
|
21
30
|
this.validateDefinition();
|
|
22
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Substitutes `${env.KEY}` references in a value with what the definition's `env` block declares.
|
|
34
|
+
*
|
|
35
|
+
* Arrays and objects are walked, because a module input is as nested as its schema: a reference
|
|
36
|
+
* can sit inside a list of images, or a key of an object, as readily as at the top level.
|
|
37
|
+
*
|
|
38
|
+
* @throws If a value holds one of its own ancestors, which no substitution over it terminates on.
|
|
39
|
+
*/
|
|
23
40
|
resolveEnvironmentValue(value) {
|
|
24
|
-
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
const pattern = value.match(/^\$\{env\.(.+)}$/);
|
|
28
|
-
if (!pattern || pattern.length < 2) {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
const environmentKey = this.definition.env.find((e) => e.key === pattern[1]);
|
|
32
|
-
if (!environmentKey) {
|
|
33
|
-
throw new Error(`Key "${pattern[1]}" not found under "env"!`);
|
|
34
|
-
}
|
|
35
|
-
let resolvedValue = process.env[pattern[1]] || environmentKey.value;
|
|
36
|
-
const { kind } = environmentKey;
|
|
37
|
-
switch (kind) {
|
|
38
|
-
case 'boolean': {
|
|
39
|
-
return Boolean(resolvedValue);
|
|
40
|
-
}
|
|
41
|
-
case 'number': {
|
|
42
|
-
return Number(resolvedValue);
|
|
43
|
-
}
|
|
44
|
-
default: {
|
|
45
|
-
return String(resolvedValue);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
41
|
+
return this.resolveNestedEnvironmentValue(value, new Set());
|
|
48
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Imports the hook callbacks the definition names, in the shape {@link Octo.registerHooks} takes.
|
|
45
|
+
*/
|
|
49
46
|
async resolveHooks() {
|
|
50
47
|
const hooks = {
|
|
51
48
|
postCommitHooks: [],
|
|
@@ -60,8 +57,8 @@ export class YamlDefinitionUtility {
|
|
|
60
57
|
}
|
|
61
58
|
for (const hookDef of this.definition.hooks) {
|
|
62
59
|
const { importPath, method } = hookDef;
|
|
63
|
-
const resolvedImport = importPath.startsWith('.') || importPath.startsWith('/') ? resolve(process.cwd(), importPath) : importPath;
|
|
64
60
|
try {
|
|
61
|
+
const resolvedImport = this.resolveImportPath(importPath);
|
|
65
62
|
const imported = await import(resolvedImport);
|
|
66
63
|
if (!imported[method]) {
|
|
67
64
|
throw new Error(`Unable to find export "${method}" in path "${resolvedImport}"!`);
|
|
@@ -77,11 +74,14 @@ export class YamlDefinitionUtility {
|
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
76
|
catch (error) {
|
|
80
|
-
throw new Error(`Failed to import path "${
|
|
77
|
+
throw new Error(`Failed to import path "${importPath}": ${error?.message || String(error)}`);
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
80
|
return hooks;
|
|
84
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Imports every module class the definition's `imports` block names.
|
|
84
|
+
*/
|
|
85
85
|
async resolveImports() {
|
|
86
86
|
const imports = [];
|
|
87
87
|
if (!this.definition.imports?.length) {
|
|
@@ -89,8 +89,8 @@ export class YamlDefinitionUtility {
|
|
|
89
89
|
}
|
|
90
90
|
for (const importDef of this.definition.imports) {
|
|
91
91
|
const { className, importPath } = importDef;
|
|
92
|
-
const resolvedImport = importPath.startsWith('.') || importPath.startsWith('/') ? resolve(process.cwd(), importPath) : importPath;
|
|
93
92
|
try {
|
|
93
|
+
const resolvedImport = this.resolveImportPath(importPath);
|
|
94
94
|
const imported = await import(resolvedImport);
|
|
95
95
|
if (!imported[className]) {
|
|
96
96
|
throw new Error(`Unable to find export "${className}" in path "${resolvedImport}"!`);
|
|
@@ -100,32 +100,45 @@ export class YamlDefinitionUtility {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
catch (error) {
|
|
103
|
-
throw new Error(`Failed to import path "${
|
|
103
|
+
throw new Error(`Failed to import path "${importPath}": ${error?.message || String(error)}`);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
return imports;
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* The listeners the definition lists. The logging listener writes to stderr, so stdout carries only
|
|
110
|
+
* a command's own output.
|
|
111
|
+
*/
|
|
108
112
|
async resolveListeners() {
|
|
109
113
|
const listeners = [];
|
|
110
114
|
if (!this.definition.settings?.listeners?.length) {
|
|
111
115
|
return listeners;
|
|
112
116
|
}
|
|
113
117
|
for (const listenerDef of this.definition.settings.listeners) {
|
|
114
|
-
if (listenerDef.type === '
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
listeners.push({ type: imported.HtmlReportEventListener });
|
|
118
|
-
}
|
|
118
|
+
if (listenerDef.type === 'JournalEventListener') {
|
|
119
|
+
const imported = await import('@quadnix/octo-event-listeners/journal');
|
|
120
|
+
listeners.push({ type: imported.JournalEventListener });
|
|
119
121
|
}
|
|
120
122
|
else if (listenerDef.type === 'LoggingEventListener') {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
const imported = await import('@quadnix/octo-event-listeners/logging');
|
|
124
|
+
// Default to whether stderr is a terminal, so a redirected log carries no escape codes. An
|
|
125
|
+
// explicit `colorize:` in the definition still wins.
|
|
126
|
+
listeners.push({
|
|
127
|
+
args: [
|
|
128
|
+
{
|
|
129
|
+
colorize: listenerDef.colorize ?? Boolean(process.stderr.isTTY),
|
|
130
|
+
level: listenerDef.level ?? 'info',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
type: imported.LoggingEventListener,
|
|
134
|
+
});
|
|
125
135
|
}
|
|
126
136
|
}
|
|
127
137
|
return listeners;
|
|
128
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Pairs each `modules` entry with its imported class, and resolves its inputs.
|
|
141
|
+
*/
|
|
129
142
|
resolveModules(imports) {
|
|
130
143
|
const modules = [];
|
|
131
144
|
if (!this.definition.modules?.length) {
|
|
@@ -145,16 +158,44 @@ export class YamlDefinitionUtility {
|
|
|
145
158
|
}
|
|
146
159
|
return modules;
|
|
147
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* How often terraform state is checked into the state provider while a terraform command runs, or
|
|
163
|
+
* `undefined` for the default. Only `RemoteStateProvider` sets it.
|
|
164
|
+
*/
|
|
165
|
+
resolveStateCheckInIntervalInMs() {
|
|
166
|
+
const stateProvider = this.definition.settings.stateProvider;
|
|
167
|
+
if (stateProvider.type !== 'RemoteStateProvider' || stateProvider.checkInIntervalInSeconds === undefined) {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
return stateProvider.checkInIntervalInSeconds * 1000;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Builds the `IStateProvider` the definition asks for.
|
|
174
|
+
*/
|
|
148
175
|
resolveStateProvider() {
|
|
149
176
|
const stateProvider = this.definition.settings.stateProvider;
|
|
150
|
-
|
|
177
|
+
// Anchored to the definition file for the same reason imports are: `run-action` runs with
|
|
178
|
+
// terragrunt's cache directory as its cwd, and a state path resolved from there would point at
|
|
179
|
+
// an empty directory - the action would read no prior state and write its result nowhere useful.
|
|
180
|
+
if (stateProvider.type === 'LocalStateProvider') {
|
|
151
181
|
return {
|
|
152
|
-
type: new
|
|
182
|
+
type: new LocalStateProvider(resolve(this.definitionDir, stateProvider.statePath)),
|
|
153
183
|
};
|
|
154
184
|
}
|
|
155
|
-
else if (stateProvider.type === '
|
|
185
|
+
else if (stateProvider.type === 'RemoteStateProvider') {
|
|
156
186
|
return {
|
|
157
|
-
type: new
|
|
187
|
+
type: new RemoteStateProvider({
|
|
188
|
+
appId: this.resolveEnvironmentValue(stateProvider.appId),
|
|
189
|
+
localStateDirectoryPath: resolve(this.definitionDir, stateProvider.statePath),
|
|
190
|
+
lockContext: stateProvider.lockContext
|
|
191
|
+
? this.resolveEnvironmentValue(stateProvider.lockContext)
|
|
192
|
+
: undefined,
|
|
193
|
+
organizationId: this.resolveEnvironmentValue(stateProvider.organizationId),
|
|
194
|
+
// Resolved from the shell: a session is a credential, and a credential written into the
|
|
195
|
+
// definition file is a credential committed beside the state it reaches.
|
|
196
|
+
sessionId: this.resolveEnvironmentValue(stateProvider.sessionId),
|
|
197
|
+
stateManagementServiceUrl: this.resolveEnvironmentValue(stateProvider.stateManagementServiceUrl),
|
|
198
|
+
}),
|
|
158
199
|
};
|
|
159
200
|
}
|
|
160
201
|
else if (stateProvider.type === 'TestStateProvider') {
|
|
@@ -166,40 +207,146 @@ export class YamlDefinitionUtility {
|
|
|
166
207
|
throw new Error(`Invalid state provider!`);
|
|
167
208
|
}
|
|
168
209
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
210
|
+
/**
|
|
211
|
+
* The tag registrations the definition declares, in the shape `Octo.registerTags()` takes.
|
|
212
|
+
*
|
|
213
|
+
* A `scope` naming a `moduleId` reaches that module's resources; an absent or empty one reaches
|
|
214
|
+
* every resource of the run.
|
|
215
|
+
*/
|
|
216
|
+
resolveTags() {
|
|
217
|
+
const tags = [];
|
|
218
|
+
if (!this.definition.tags?.length) {
|
|
219
|
+
return tags;
|
|
220
|
+
}
|
|
221
|
+
for (const tagDefinition of this.definition.tags) {
|
|
222
|
+
const resolvedTags = {};
|
|
223
|
+
for (const [key, value] of Object.entries(tagDefinition.tags)) {
|
|
224
|
+
// A tag value is always a string, so an `${env.KEY}` declared as a number or a boolean is
|
|
225
|
+
// rendered rather than handed to the resource as the kind it was declared with.
|
|
226
|
+
resolvedTags[key] = String(this.resolveEnvironmentValue(value));
|
|
227
|
+
}
|
|
228
|
+
tags.push({ scope: tagDefinition.scope || {}, tags: resolvedTags });
|
|
229
|
+
}
|
|
230
|
+
return tags;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The terraform version, required providers, and provider blocks the definition declares.
|
|
234
|
+
*/
|
|
235
|
+
resolveTerraformOptions() {
|
|
236
|
+
const terraform = this.definition.terraform;
|
|
237
|
+
const providers = terraform.providers.map((p) => {
|
|
238
|
+
const spec = {};
|
|
239
|
+
for (const [key, value] of Object.entries(p.spec || {})) {
|
|
240
|
+
spec[key] = this.resolveEnvironmentValue(value);
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
accountId: this.resolveEnvironmentValue(p.accountId),
|
|
244
|
+
accountName: p.accountName ? this.resolveEnvironmentValue(p.accountName) : undefined,
|
|
245
|
+
providerType: p.providerType,
|
|
246
|
+
regionId: this.resolveEnvironmentValue(p.regionId),
|
|
247
|
+
// Passed through as-is: undefined lets octo apply its per-provider-type default.
|
|
248
|
+
setRegionAttribute: p.setRegionAttribute,
|
|
249
|
+
spec,
|
|
250
|
+
};
|
|
251
|
+
});
|
|
252
|
+
return {
|
|
253
|
+
providers,
|
|
254
|
+
requiredProviders: terraform.requiredProviders,
|
|
255
|
+
requiredVersion: this.resolveEnvironmentValue(terraform.requiredVersion),
|
|
179
256
|
};
|
|
180
|
-
|
|
181
|
-
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Substitutes one `${env.KEY}` reference with what the definition's `env` block declares for that
|
|
260
|
+
* key, read in the kind the block gives it. Anything holding no reference is returned as it came.
|
|
261
|
+
*/
|
|
262
|
+
resolveEnvironmentReference(value) {
|
|
263
|
+
if (typeof value !== 'string') {
|
|
264
|
+
return value;
|
|
182
265
|
}
|
|
183
|
-
|
|
184
|
-
|
|
266
|
+
const pattern = value.match(/^\$\{env\.(.+)}$/);
|
|
267
|
+
if (!pattern || pattern.length < 2) {
|
|
268
|
+
return value;
|
|
185
269
|
}
|
|
186
|
-
|
|
187
|
-
|
|
270
|
+
// `env` is optional in the schema, so a definition can reference `${env.X}` without declaring
|
|
271
|
+
// one. Treat that as an empty block and let the "not found" error below report it.
|
|
272
|
+
const environmentKey = (this.definition.env ?? []).find((e) => e.key === pattern[1]);
|
|
273
|
+
if (!environmentKey) {
|
|
274
|
+
throw new Error(`Key "${pattern[1]}" not found under "env"!`);
|
|
188
275
|
}
|
|
189
|
-
|
|
190
|
-
|
|
276
|
+
let resolvedValue = process.env[pattern[1]] || environmentKey.value;
|
|
277
|
+
const { kind } = environmentKey;
|
|
278
|
+
switch (kind) {
|
|
279
|
+
case 'boolean': {
|
|
280
|
+
// A shell always supplies a string, and `Boolean("false")` is `true`. Parse the string form
|
|
281
|
+
// rather than coercing it, and reject anything that is not plainly a boolean.
|
|
282
|
+
if (typeof resolvedValue === 'boolean') {
|
|
283
|
+
return resolvedValue;
|
|
284
|
+
}
|
|
285
|
+
const normalizedValue = String(resolvedValue).trim().toLowerCase();
|
|
286
|
+
if (normalizedValue === 'true') {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
else if (normalizedValue === 'false') {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
throw new Error(`Value "${resolvedValue}" for key "${pattern[1]}" is not a boolean!`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
case 'number': {
|
|
297
|
+
return Number(resolvedValue);
|
|
298
|
+
}
|
|
299
|
+
default: {
|
|
300
|
+
return String(resolvedValue);
|
|
301
|
+
}
|
|
191
302
|
}
|
|
192
|
-
|
|
193
|
-
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Resolves a definition-file import specifier to something `import()` can load.
|
|
306
|
+
*
|
|
307
|
+
* A relative path resolves against the **definition file's own directory**. It cannot resolve
|
|
308
|
+
* against the current working directory: terraform invokes `octo run-action` from inside a
|
|
309
|
+
* terragrunt cache directory, so a definition saying `./dist/index.js` - which is what every
|
|
310
|
+
* generated app says - would be looked for under the cache and never found.
|
|
311
|
+
*
|
|
312
|
+
* A bare specifier resolves against the **user's project root**, not octo-build's own install
|
|
313
|
+
* directory - node would otherwise resolve it from wherever octo-build happens to live. A flat
|
|
314
|
+
* `node_modules` hides that; a linked store does not, and there the user's own dependencies are
|
|
315
|
+
* invisible.
|
|
316
|
+
*/
|
|
317
|
+
resolveImportPath(importPath) {
|
|
318
|
+
if (importPath.startsWith('.') || importPath.startsWith('/')) {
|
|
319
|
+
return resolve(this.definitionDir, importPath);
|
|
194
320
|
}
|
|
195
|
-
|
|
196
|
-
|
|
321
|
+
const requireFromProject = createRequire(join(this.definitionDir, 'package.json'));
|
|
322
|
+
return pathToFileURL(requireFromProject.resolve(importPath)).href;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Walks a value, substituting every `${env.KEY}` reference it holds at any depth.
|
|
326
|
+
*
|
|
327
|
+
* `ancestors` is the chain currently being walked rather than everything already seen. A YAML
|
|
328
|
+
* anchor used in two places points one node at two parents, which resolves twice and is no cycle;
|
|
329
|
+
* a node reappearing beneath itself is one, and walking it never ends.
|
|
330
|
+
*
|
|
331
|
+
* @throws If a value holds one of its own ancestors.
|
|
332
|
+
*/
|
|
333
|
+
resolveNestedEnvironmentValue(value, ancestors) {
|
|
334
|
+
if (value === null || typeof value !== 'object') {
|
|
335
|
+
return this.resolveEnvironmentReference(value);
|
|
197
336
|
}
|
|
198
|
-
if (
|
|
199
|
-
|
|
337
|
+
if (ancestors.has(value)) {
|
|
338
|
+
throw new Error('Definition holds a value that contains itself!');
|
|
200
339
|
}
|
|
201
|
-
|
|
340
|
+
ancestors.add(value);
|
|
341
|
+
const resolvedValue = Array.isArray(value)
|
|
342
|
+
? value.map((v) => this.resolveNestedEnvironmentValue(v, ancestors))
|
|
343
|
+
: Object.fromEntries(Object.entries(value).map(([key, v]) => [key, this.resolveNestedEnvironmentValue(v, ancestors)]));
|
|
344
|
+
ancestors.delete(value);
|
|
345
|
+
return resolvedValue;
|
|
202
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Checks the definition against `octo-v1.schema.json`.
|
|
349
|
+
*/
|
|
203
350
|
validateDefinition() {
|
|
204
351
|
if (!this.definition?.version || typeof this.definition?.version !== 'number') {
|
|
205
352
|
throw new Error(`Definition version "${this.definition?.version}" must be a number!`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-definition.utility.js","sourceRoot":"","sources":["../../../../src/utilities/definition/yaml/yaml-definition.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAsB,4BAA4B,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;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AAC,CAAC;QAErC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAE7E,MAAM,QAAQ,GAAa,EAAE,CAAC;YAC9B,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;gBACxC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,YAAY,IAAI,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACjE,CAAC;YACD,KAAK,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;YAE7B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"yaml-definition.utility.js","sourceRoot":"","sources":["../../../../src/utilities/definition/yaml/yaml-definition.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAEL,kBAAkB,EAElB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AA6D1D;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAUhC;;;OAGG;IACH,YAAY,kBAA0B;QACpC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AAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAErC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAE7E,MAAM,QAAQ,GAAa,EAAE,CAAC;YAC9B,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;gBACxC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,YAAY,IAAI,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACjE,CAAC;YACD,KAAK,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;YAE7B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type App, Octo } from '@quadnix/octo';
|
|
2
|
+
/**
|
|
3
|
+
* Boots octo the way every lifecycle command does, from the definition file `OCTO_DEFINITION_FILE_PATH`
|
|
4
|
+
* names, and reports what went wrong when a command fails.
|
|
5
|
+
*/
|
|
6
|
+
export declare class OctoUtility {
|
|
7
|
+
/**
|
|
8
|
+
* Boots octo with every listener, hook, module and terraform provider the definition lists, and
|
|
9
|
+
* composes the app. Prints nothing, so stdout carries only the command's own output.
|
|
10
|
+
*/
|
|
11
|
+
static bootOcto(): Promise<{
|
|
12
|
+
app: App;
|
|
13
|
+
octo: Octo;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Boots only the state provider the definition names, without loading a single module, and returns
|
|
17
|
+
* how often terraform state is checked into it during a terraform command. Loads every listener the definition lists.
|
|
18
|
+
*
|
|
19
|
+
* `apply` is a terraform action rather than an octo mode, so it has no reason to compose a model
|
|
20
|
+
* graph - but terraform state is checked out of the state provider and back into it around every
|
|
21
|
+
* terraform command, so the provider still has to be there, and terraform's output reaches the
|
|
22
|
+
* terminal only through the listeners.
|
|
23
|
+
*/
|
|
24
|
+
static bootStateProvider(): Promise<{
|
|
25
|
+
stateCheckInIntervalInMs: number | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Makes the environment survive the trip into terraform's `local-exec`.
|
|
29
|
+
*
|
|
30
|
+
* An external resource shells back out to `octo` from the terraform that terragrunt runs -
|
|
31
|
+
* `run-action` from its `local-exec` provisioner, `get-response` from its `data "external"` - and
|
|
32
|
+
* those commands inherit this process's environment. Two things about it are wrong by default, and
|
|
33
|
+
* both fail only after real infrastructure exists:
|
|
34
|
+
*
|
|
35
|
+
* - **`octo` is a bare binary name**, resolved through `PATH`. Invoking a binary by path -
|
|
36
|
+
* `node_modules/.bin/octo apply` - does not put its directory on `PATH` for child processes, so
|
|
37
|
+
* the callback dies with `octo: command not found`. The generated app runs the flow through
|
|
38
|
+
* package scripts, and `npm run` does put that directory on `PATH`, but running the binary
|
|
39
|
+
* directly is still supported and has to work the same. The project's bin directory is prepended
|
|
40
|
+
* here, and the directory this CLI is running from after it, so a globally installed or linked
|
|
41
|
+
* octo still wins over nothing at all.
|
|
42
|
+
* - **`OCTO_DEFINITION_FILE_PATH` is usually relative** (`octo.yaml` - the package scripts set
|
|
43
|
+
* exactly that), and terraform runs `local-exec` with a terragrunt cache directory as its cwd,
|
|
44
|
+
* where that resolves to nothing. It is made absolute here, against the cwd the user actually
|
|
45
|
+
* invoked from.
|
|
46
|
+
*/
|
|
47
|
+
static prepareCallbackEnvironment(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Prints an octo error to stderr, including the properties it carries - the diff that matched no
|
|
50
|
+
* action, most of all - which a bare stack trace would hide.
|
|
51
|
+
*/
|
|
52
|
+
static reportError(error: any): void;
|
|
53
|
+
/**
|
|
54
|
+
* Runs one lifecycle command: announces it, runs `body`, and exits with 1 after reporting what it
|
|
55
|
+
* threw. The command's end is announced, and awaited by listeners such as the journal, before the
|
|
56
|
+
* process exits.
|
|
57
|
+
*/
|
|
58
|
+
static runCommand(command: string, body: () => Promise<void>): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* The absolute path of the definition file, from `OCTO_DEFINITION_FILE_PATH`.
|
|
61
|
+
*
|
|
62
|
+
* @throws If the variable is unset, or names a file that does not exist.
|
|
63
|
+
*/
|
|
64
|
+
private static resolveDefinitionFilePath;
|
|
65
|
+
}
|