@mikarinneoracle/oci-cdk-code-only-preview 0.0.34 → 0.0.35
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 +2 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -193,7 +193,7 @@ export OCI_FUNCTION_APP_NAME='my-existing-function-app'
|
|
|
193
193
|
|
|
194
194
|
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.
|
|
195
195
|
|
|
196
|
-
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.
|
|
196
|
+
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. Python functions retain the standard Fn entrypoint from `func.yaml`, such as `/python/bin/fdk /function/func.py handler`. 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.
|
|
197
197
|
|
|
198
198
|
After a successful code-only deploy, OCDK writes the log IDs for `npx ocdk tail:execution-log` automatically.
|
|
199
199
|
|
package/bin/deploy-code-only.js
CHANGED
|
@@ -98,15 +98,9 @@ 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');
|
|
102
101
|
const handler = runtimeName.toLowerCase().startsWith('node')
|
|
103
102
|
? configuredHandler.replace(/^node\s+/, '')
|
|
104
|
-
|
|
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;
|
|
103
|
+
: configuredHandler;
|
|
110
104
|
const memory = integerValue(process.env.OCI_FUNCTION_MEMORY_MB || yamlValue(yaml, 'memory'), 'OCI_FUNCTION_MEMORY_MB', 256);
|
|
111
105
|
const timeout = integerValue(process.env.OCI_FUNCTION_TIMEOUT_SECONDS || yamlValue(yaml, 'timeout'), 'OCI_FUNCTION_TIMEOUT_SECONDS', 30);
|
|
112
106
|
|
|
@@ -215,7 +209,7 @@ function createArchive(functionName, runtimeName) {
|
|
|
215
209
|
return { tempDir, archivePath };
|
|
216
210
|
}
|
|
217
211
|
// OCI code-only source archives must contain a function/ directory at the
|
|
218
|
-
// ZIP root.
|
|
212
|
+
// ZIP root.
|
|
219
213
|
const archiveRoot = path.join(tempDir, 'function');
|
|
220
214
|
const excludedTopLevel = new Set(['node_modules', '.git', '.tools', '.terraform', 'cdktf.out', '.ocdk', 'tail-function-logs.js', 'package-lock.json']);
|
|
221
215
|
if (!isNodeRuntime) excludedTopLevel.add('package.json');
|