@mikarinneoracle/oci-cdk-code-only-preview 0.0.33 → 0.0.34
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 +9 -0
- package/bin/ocdk.js +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,6 +105,15 @@ The repository-local preview installation is required only for preview-only feat
|
|
|
105
105
|
|
|
106
106
|
Code-only deployment first uses Terraform to create or manage the Function Application and its networking/logging resources. It then uploads a ZIP archive directly to OCI Functions with OCI CLI preview. OCI builds and manages the execution image: no Docker build, OCIR repository, or image push occurs.
|
|
107
107
|
|
|
108
|
+
After the Function App exists, use the direct OCI CLI upload command to update only the code-only function and skip Terraform entirely:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
export OCI_FUNCTION_APP_ID='ocid1.fnapp.oc1...'
|
|
112
|
+
npx ocdk deploy-code-only
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`deploy-code-only` requires `OCI_FUNCTION_APP_ID`; it does not create, look up, or change the Function App, API Gateway, networking, logging, or Terraform state.
|
|
116
|
+
|
|
108
117
|
Activate the path with either `-code-only`, `--code-only`, or `OCI_CODE_ONLY=1`. The compatibility environment key `code-only=1` is also recognized when a process launcher can set a hyphenated environment name.
|
|
109
118
|
|
|
110
119
|
```bash
|
package/bin/ocdk.js
CHANGED
|
@@ -83,6 +83,7 @@ Usage: ocdk <command> [options]
|
|
|
83
83
|
|
|
84
84
|
Commands (same as CDK):
|
|
85
85
|
deploy Deploy the stack
|
|
86
|
+
deploy-code-only Upload/update an existing code-only Function App without Terraform
|
|
86
87
|
diff Compare stack with current state
|
|
87
88
|
synth Synthesize Terraform
|
|
88
89
|
destroy Destroy the stack
|
|
@@ -155,6 +156,32 @@ if (command === 'tail:execution-log') {
|
|
|
155
156
|
|
|
156
157
|
// Code-only Functions use CDKTF for the Function Application/infrastructure,
|
|
157
158
|
// then OCI CLI preview for the archive-function itself.
|
|
159
|
+
if (command === 'deploy-code-only') {
|
|
160
|
+
const projectDir = process.cwd();
|
|
161
|
+
const script = path.join(root, 'bin', 'deploy-code-only.js');
|
|
162
|
+
const applicationId = process.env.OCI_FUNCTION_APP_ID?.trim();
|
|
163
|
+
if (!script || !fs.existsSync(script)) {
|
|
164
|
+
console.error('Missing script: "deploy-code-only". Update @mikarinneoracle/oci-cdk-code-only-preview.');
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
if (!applicationId) {
|
|
168
|
+
console.error('Code-only deploy failed: OCI_FUNCTION_APP_ID is required for "ocdk deploy-code-only". This command does not run Terraform to create or discover the Function App.');
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
const result = spawnSync('node', [script, ...args.slice(1)], {
|
|
172
|
+
stdio: 'inherit',
|
|
173
|
+
cwd: projectDir,
|
|
174
|
+
shell: false,
|
|
175
|
+
env: {
|
|
176
|
+
...process.env,
|
|
177
|
+
OCI_CODE_ONLY: '1',
|
|
178
|
+
OCI_PROJECT_DIR: projectDir,
|
|
179
|
+
OCI_FUNCTION_APP_ID: applicationId,
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
process.exit(result.status ?? 1);
|
|
183
|
+
}
|
|
184
|
+
|
|
158
185
|
if (command === 'deploy' && codeOnlyEnabled) {
|
|
159
186
|
const projectDir = process.cwd();
|
|
160
187
|
const script = path.join(root, 'bin', 'deploy-code-only.js');
|