@mikarinneoracle/oci-cdk-code-only-preview 0.0.25 → 0.0.26
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 +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -167,7 +167,7 @@ export OCI_FUNCTION_APP_NAME='my-existing-function-app'
|
|
|
167
167
|
|
|
168
168
|
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.
|
|
169
169
|
|
|
170
|
-
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`, `package-lock.json`, `.git`, `.tools`, `.terraform`, `cdktf.out`, and the generated `tail-function-logs.js`. For Node.js functions, `package.json` remains
|
|
170
|
+
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`, `package-lock.json`, `.git`, `.tools`, `.terraform`, `cdktf.out`, and the generated `tail-function-logs.js`. 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.
|
|
171
171
|
|
|
172
172
|
After a successful code-only deploy, OCDK writes the log IDs for `npx ocdk tail:execution-log` automatically.
|
|
173
173
|
|
package/bin/deploy-code-only.js
CHANGED
|
@@ -94,7 +94,7 @@ function preparePackageManifest(archiveRoot) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
function createArchive(functionName) {
|
|
97
|
+
function createArchive(functionName, runtimeName) {
|
|
98
98
|
if (!fs.existsSync(projectDir) || !fs.statSync(projectDir).isDirectory()) {
|
|
99
99
|
fail(`source directory does not exist: ${projectDir}`);
|
|
100
100
|
}
|
|
@@ -102,7 +102,9 @@ function createArchive(functionName) {
|
|
|
102
102
|
const archiveFileName = codeOnlyArchiveFileName(functionName);
|
|
103
103
|
const archivePath = path.join(projectDir, archiveFileName);
|
|
104
104
|
const archiveRoot = path.join(tempDir, 'function');
|
|
105
|
+
const isNodeRuntime = runtimeName.toLowerCase().startsWith('node');
|
|
105
106
|
const excludedTopLevel = new Set(['node_modules', '.git', '.tools', '.terraform', 'cdktf.out', 'tail-function-logs.js', 'package-lock.json']);
|
|
107
|
+
if (!isNodeRuntime) excludedTopLevel.add('package.json');
|
|
106
108
|
fs.cpSync(projectDir, archiveRoot, {
|
|
107
109
|
recursive: true,
|
|
108
110
|
filter: (sourcePath) => {
|
|
@@ -112,7 +114,7 @@ function createArchive(functionName) {
|
|
|
112
114
|
return !excludedTopLevel.has(relativePath.split(path.sep)[0]);
|
|
113
115
|
},
|
|
114
116
|
});
|
|
115
|
-
preparePackageManifest(archiveRoot);
|
|
117
|
+
if (isNodeRuntime) preparePackageManifest(archiveRoot);
|
|
116
118
|
fs.rmSync(archivePath, { force: true });
|
|
117
119
|
const zip = spawnSync('zip', ['-q', '-r', archivePath, 'function'], { cwd: tempDir, encoding: 'utf8', shell: false });
|
|
118
120
|
if (zip.error || zip.status !== 0) {
|
|
@@ -165,7 +167,7 @@ function main() {
|
|
|
165
167
|
const metadata = readFunctionMetadata();
|
|
166
168
|
const applicationId = (process.env.OCI_FUNCTION_APP_ID || '').trim();
|
|
167
169
|
if (!applicationId) fail('Terraform output OCI_FUNCTION_APP_ID is missing. Run through "ocdk deploy --code-only".');
|
|
168
|
-
const archive = createArchive(metadata.functionName);
|
|
170
|
+
const archive = createArchive(metadata.functionName, metadata.runtimeName);
|
|
169
171
|
try {
|
|
170
172
|
const functionId = findFunctionId(applicationId, metadata.functionName);
|
|
171
173
|
const commonArgs = [
|