@mikarinneoracle/oci-cdk-code-only-preview 0.0.28 → 0.0.29
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 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -157,7 +157,7 @@ mvn -DskipTests package
|
|
|
157
157
|
# or: gradle build -x test
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
OCDK also runs this build automatically when no artifact exists yet, and searches the project root, Maven `target/`, and Gradle `build/libs/`. The
|
|
160
|
+
OCDK also runs this build automatically when no artifact exists yet, and searches the project root, Maven `target/`, and Gradle `build/libs/`. The OCI service validates the JAR contents; if several non-source JARs exist, set `OCI_FUNCTION_JAR_PATH` to the one to deploy explicitly. Java archives do not contain the project source tree or a `function/` directory.
|
|
161
161
|
|
|
162
162
|
#### Find the available code-only runtimes
|
|
163
163
|
|
package/bin/deploy-code-only.js
CHANGED
|
@@ -123,12 +123,6 @@ function buildJavaProject() {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
function isFatJavaJar(jarPath) {
|
|
127
|
-
const result = spawnSync('jar', ['tf', jarPath], { encoding: 'utf8', shell: false });
|
|
128
|
-
if (result.error || result.status !== 0) return false;
|
|
129
|
-
return /(^|\n)com\/fnproject\/fn\/(api|runtime)\//.test(result.stdout || '');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
126
|
function resolveJavaJar() {
|
|
133
127
|
const configuredPath = (process.env.OCI_CODE_ONLY_JAR_PATH || process.env.OCI_FUNCTION_JAR_PATH || '').trim();
|
|
134
128
|
if (configuredPath) {
|
|
@@ -136,9 +130,6 @@ function resolveJavaJar() {
|
|
|
136
130
|
if (!fs.existsSync(jarPath) || !fs.statSync(jarPath).isFile() || !jarPath.endsWith('.jar')) {
|
|
137
131
|
fail(`OCI_FUNCTION_JAR_PATH must point to an existing .jar file: ${jarPath}`);
|
|
138
132
|
}
|
|
139
|
-
if (!isFatJavaJar(jarPath)) {
|
|
140
|
-
fail(`Java archive is not a fat/uber JAR: ${jarPath}. Configure your Maven Shade or Gradle Shadow build, then point OCI_FUNCTION_JAR_PATH to its output.`);
|
|
141
|
-
}
|
|
142
133
|
return jarPath;
|
|
143
134
|
}
|
|
144
135
|
let candidates = listJavaJarCandidates();
|
|
@@ -148,14 +139,11 @@ function resolveJavaJar() {
|
|
|
148
139
|
}
|
|
149
140
|
const uniqueCandidates = [...new Set(candidates)];
|
|
150
141
|
if (uniqueCandidates.length === 1) {
|
|
151
|
-
if (!isFatJavaJar(uniqueCandidates[0])) {
|
|
152
|
-
fail(`Java build produced a non-fat JAR: ${uniqueCandidates[0]}. Configure your Maven Shade or Gradle Shadow build, then set OCI_FUNCTION_JAR_PATH to its fat/uber JAR.`);
|
|
153
|
-
}
|
|
154
142
|
return uniqueCandidates[0];
|
|
155
143
|
}
|
|
156
144
|
const found = uniqueCandidates.length ? ` Found: ${uniqueCandidates.join(', ')}` : '';
|
|
157
|
-
const guidance = ' Run `mvn -DskipTests package` (or `gradle build -x test`) to produce
|
|
158
|
-
fail(`Java code-only deploy requires exactly one
|
|
145
|
+
const guidance = ' Run `mvn -DskipTests package` (or `gradle build -x test`) to produce the function JAR, then set OCI_FUNCTION_JAR_PATH (for example target/my-function.jar).';
|
|
146
|
+
fail(`Java code-only deploy requires exactly one JAR.${guidance}${found}`);
|
|
159
147
|
}
|
|
160
148
|
|
|
161
149
|
function createArchive(functionName, runtimeName) {
|