@mikarinneoracle/oci-cdk-code-only-preview 0.0.31 → 0.0.33
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 +1 -1
- package/bin/deploy-code-only.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -184,7 +184,7 @@ export OCI_FUNCTION_APP_NAME='my-existing-function-app'
|
|
|
184
184
|
|
|
185
185
|
These settings are optional: `OCI_CODE_ONLY_SOURCE_DIR` (defaults to the current directory), `OCI_FUNCTION_MEMORY_MB` (from `func.yaml`, otherwise `256`), and `OCI_FUNCTION_TIMEOUT_SECONDS` (from `func.yaml`, otherwise `30`). `OCI_TENANCY_ID`, `OCI_REGION`, and `OCI_NAMESPACE` are also optional when they can be resolved from the active OCI CLI profile.
|
|
186
186
|
|
|
187
|
-
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
|
|
187
|
+
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 and excludes `node_modules`, `package-lock.json`, `.git`, `.tools`, `.terraform`, `cdktf.out`, and the generated `.ocdk/` directory. For Python, OCDK automatically changes Fn's normal `/function/func.py` handler path to `/function/function/func.py`, matching the required archive layout. For Node.js functions, a sanitized `package.json` remains so OCI can install the FDK and other dependencies; OCDK removes its own package dependency (`@mikarinneoracle/oci-cdk-code-only-preview`, and the legacy package name) from that copied manifest. For Python and Java code-only functions, `package.json` is excluded entirely. A successful code-only destroy removes this ZIP after Terraform has destroyed the Function App and infrastructure. With the default `OCI_STACK_ACTION=full-stack`, OCDK creates the API Gateway and uses a Terraform data source to resolve the CLI-managed function OCID for its route. The first code-only deploy therefore runs Terraform once to create the Function App, uploads the function, then runs Terraform again to create the Gateway deployment. Set `OCI_STACK_ACTION=function-only` to omit API Gateway.
|
|
188
188
|
|
|
189
189
|
After a successful code-only deploy, OCDK writes the log IDs for `npx ocdk tail:execution-log` automatically.
|
|
190
190
|
|
package/bin/deploy-code-only.js
CHANGED
|
@@ -98,9 +98,15 @@ function readFunctionMetadata() {
|
|
|
98
98
|
const configuredHandler = (process.env.OCI_FUNCTION_HANDLER || yamlValue(yaml, 'cmd') || yamlValue(yaml, 'entrypoint')).trim();
|
|
99
99
|
// The managed Node runtime already invokes `node`; its handler is the script
|
|
100
100
|
// path, whereas a conventional func.yaml entrypoint is `node func.js`.
|
|
101
|
+
const isPythonRuntime = runtimeName.toLowerCase().startsWith('python');
|
|
101
102
|
const handler = runtimeName.toLowerCase().startsWith('node')
|
|
102
103
|
? configuredHandler.replace(/^node\s+/, '')
|
|
103
|
-
|
|
104
|
+
// Code-only archives must have a function/ directory at their ZIP root.
|
|
105
|
+
// OCI retains that directory beneath /function, so adapt Fn's standard
|
|
106
|
+
// Python entrypoint path to the archive layout.
|
|
107
|
+
: isPythonRuntime
|
|
108
|
+
? configuredHandler.replace(/\/function\/(?!function\/)/g, '/function/function/')
|
|
109
|
+
: configuredHandler;
|
|
104
110
|
const memory = integerValue(process.env.OCI_FUNCTION_MEMORY_MB || yamlValue(yaml, 'memory'), 'OCI_FUNCTION_MEMORY_MB', 256);
|
|
105
111
|
const timeout = integerValue(process.env.OCI_FUNCTION_TIMEOUT_SECONDS || yamlValue(yaml, 'timeout'), 'OCI_FUNCTION_TIMEOUT_SECONDS', 30);
|
|
106
112
|
|
|
@@ -208,6 +214,8 @@ function createArchive(functionName, runtimeName) {
|
|
|
208
214
|
}
|
|
209
215
|
return { tempDir, archivePath };
|
|
210
216
|
}
|
|
217
|
+
// OCI code-only source archives must contain a function/ directory at the
|
|
218
|
+
// ZIP root. Python handler paths are adapted in readFunctionMetadata().
|
|
211
219
|
const archiveRoot = path.join(tempDir, 'function');
|
|
212
220
|
const excludedTopLevel = new Set(['node_modules', '.git', '.tools', '.terraform', 'cdktf.out', '.ocdk', 'tail-function-logs.js', 'package-lock.json']);
|
|
213
221
|
if (!isNodeRuntime) excludedTopLevel.add('package.json');
|