Skip to content

Commit 227ac38

Browse files
authored
ci(ocr): migrate to new CI (#4009)
* ci(ocr): migrate to new CI * add additional envvars * spelling * be explicit about bucket * debug: don't auto-create topic (MAY NEED REVERT)
1 parent 113e558 commit 227ac38

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.github/config/nodejs-dev.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
"functions/log/helloWorld",
150150
"functions/log/processEntry",
151151
"functions/memorystore/redis",
152+
"functions/ocr/app",
152153
"functions/pubsub/publish",
153154
"functions/pubsub/subscribe",
154155
"functions/scheduleinstance",

.github/config/nodejs-prod.jsonc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
"document-ai", // [ERR_REQUIRE_ESM]: require() of ES Module
9191
"functions/billing", // (untested) Error: Request failed with status code 500
9292
"functions/imagemagick", // (untested) Error: A bucket name is needed to use Cloud Storage
93-
"functions/ocr/app", // (untested) Error: Bucket not provided. Make sure you have a "bucket" property in your request
9493
"functions/slack", // TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type ... Received undefined
9594
"functions/v2/imagemagick", // (untested) Error: A bucket name is needed to use Cloud Storage.
9695
"healthcare/fhir", // Error: Cannot find module 'whatwg-url'

functions/ocr/app/ci-setup.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"env": {
3+
"FUNCTIONS_BUCKET": "nodejs-docs-samples-tests",
4+
"RESULT_BUCKET": "nodejs-docs-samples-tests",
5+
"TRANSLATE_TOPIC": "integration-tests-instance",
6+
"RESULT_TOPIC": "integration-tests-instance",
7+
"TO_LANG": "en,es"
8+
}
9+
}

functions/ocr/app/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ const translate = new Translate();
4141
const publishResult = async (topicName, data) => {
4242
const dataBuffer = Buffer.from(JSON.stringify(data));
4343

44-
const [topic] = await pubsub.topic(topicName).get({autoCreate: true});
45-
topic.publishMessage({data: dataBuffer});
44+
pubsub.topic(topicName).publishMessage(dataBuffer);
4645
};
4746

4847
// [START functions_ocr_detect]

0 commit comments

Comments
 (0)