Skip to content

Commit c00c94f

Browse files
authored
fix: add kokoro config for composer-storage-trigger (#1321)
* Upgrade composer sample to Node 8 * fix: Add CI test config
1 parent 359ddc5 commit c00c94f

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set the folder in which the tests are run
4+
env_vars: {
5+
key: "PROJECT"
6+
value: "functions/composer-storage-trigger"
7+
}
8+
9+
# Tell the trampoline which build file to use.
10+
env_vars: {
11+
key: "TRAMPOLINE_BUILD_FILE"
12+
value: "github/nodejs-docs-samples/.kokoro/build.sh"
13+
}

functions/composer-storage-trigger/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const FormData = require('form-data');
2828
* and
2929
* https://cloud.google.com/iap/docs/authentication-howto
3030
*
31-
* @param {!Object} event The Cloud Functions event.
31+
* @param {!Object} data The Cloud Functions event data.
3232
* @returns {Promise}
3333
*/
34-
exports.triggerDag = async event => {
34+
exports.triggerDag = async data => {
3535
// Fill in your Composer environment information here.
3636

3737
// The project that holds your function
@@ -47,7 +47,7 @@ exports.triggerDag = async event => {
4747
// Other constants
4848
const WEBSERVER_URL = `https://${WEBSERVER_ID}.appspot.com/api/experimental/dags/${DAG_NAME}/dag_runs`;
4949
const USER_AGENT = 'gcf-event-trigger';
50-
const BODY = {conf: JSON.stringify(event.data)};
50+
const BODY = {conf: JSON.stringify(data)};
5151

5252
// Make the request
5353
try {
@@ -86,7 +86,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
8686
headers: {'User-Agent': userAgent, 'Metadata-Flavor': 'Google'},
8787
}
8888
);
89-
const tokenResponse = res.json();
89+
const tokenResponse = await res.json();
9090
if (tokenResponse.error) {
9191
return Promise.reject(tokenResponse.error);
9292
}
@@ -116,7 +116,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
116116
},
117117
}
118118
);
119-
const blobJson = blob.json();
119+
const blobJson = await blob.json();
120120
if (blobJson.error) {
121121
return Promise.reject(blobJson.error);
122122
}
@@ -132,7 +132,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
132132
method: 'POST',
133133
body: form,
134134
});
135-
const tokenJson = token.json();
135+
const tokenJson = await token.json();
136136
if (tokenJson.error) {
137137
return Promise.reject(tokenJson.error);
138138
}

0 commit comments

Comments
 (0)