@mikarinneoracle/oci-cdk-code-only-preview 0.0.10 → 0.0.11
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/README.md +2 -0
- package/bin/ocdk.js +11 -1
- package/bin/write-log-config.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -135,6 +135,8 @@ These settings are optional: `OCI_CODE_ONLY_SOURCE_DIR` (defaults to the current
|
|
|
135
135
|
|
|
136
136
|
Each deploy re-builds `<function-name>.zip` in the project root and uploads that file. The ZIP has the required `function/` directory at its root, includes source files, and excludes `node_modules`, `.git`, `.tools`, `.terraform`, and `cdktf.out`. A successful code-only destroy removes this ZIP after Terraform has destroyed the Function App and infrastructure. The current preview path is function-only: it does not create an API Gateway because the CLI-managed function OCID is not in Terraform state.
|
|
137
137
|
|
|
138
|
+
After a successful code-only deploy, OCDK writes the log IDs for `npx ocdk tail:execution-log` automatically.
|
|
139
|
+
|
|
138
140
|
Use the same flag or environment variable for deletion. OCDK deletes the CLI-managed function first, then lets Terraform destroy the Function App and its infrastructure:
|
|
139
141
|
|
|
140
142
|
```bash
|
package/bin/ocdk.js
CHANGED
|
@@ -180,7 +180,17 @@ if (command === 'deploy' && codeOnlyEnabled) {
|
|
|
180
180
|
shell: false,
|
|
181
181
|
env: { ...env, OCI_FUNCTION_APP_ID: functionAppId },
|
|
182
182
|
});
|
|
183
|
-
process.exit(result.status ?? 1);
|
|
183
|
+
if (result.status !== 0) process.exit(result.status ?? 1);
|
|
184
|
+
const logConfig = spawnSync('node', [path.join(root, 'bin', 'write-log-config.js')], {
|
|
185
|
+
stdio: 'inherit',
|
|
186
|
+
cwd: projectDir,
|
|
187
|
+
shell: false,
|
|
188
|
+
env,
|
|
189
|
+
});
|
|
190
|
+
if (logConfig.status !== 0) {
|
|
191
|
+
console.warn('Code-only function deployed, but log-tail configuration could not be written. Run: npx ocdk write-log-config');
|
|
192
|
+
}
|
|
193
|
+
process.exit(0);
|
|
184
194
|
}
|
|
185
195
|
|
|
186
196
|
// Destroy the CLI-managed archive function before Terraform destroys its
|
package/bin/write-log-config.js
CHANGED
|
@@ -10,7 +10,7 @@ const fs = require('fs');
|
|
|
10
10
|
const packageRoot = path.join(__dirname, '..');
|
|
11
11
|
const projectRoot = process.cwd();
|
|
12
12
|
const stackName = process.env.OCI_STACK_NAME || 'oci-stack';
|
|
13
|
-
const stackDir = path.join(
|
|
13
|
+
const stackDir = path.join(packageRoot, 'cdktf.out', 'stacks', stackName);
|
|
14
14
|
|
|
15
15
|
if (!fs.existsSync(stackDir)) {
|
|
16
16
|
console.error('Stack directory not found:', stackDir);
|