Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add kokoro config for composer-storage-trigger #1321

Merged
merged 2 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .kokoro/functions/composer-storage-trigger.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Set the folder in which the tests are run
env_vars: {
key: "PROJECT"
value: "functions/composer-storage-trigger"
}

# Tell the trampoline which build file to use.
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-docs-samples/.kokoro/build.sh"
}
12 changes: 6 additions & 6 deletions functions/composer-storage-trigger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ const FormData = require('form-data');
* and
* https://cloud.google.com/iap/docs/authentication-howto
*
* @param {!Object} event The Cloud Functions event.
* @param {!Object} data The Cloud Functions event data.
* @returns {Promise}
*/
exports.triggerDag = async event => {
exports.triggerDag = async data => {
// Fill in your Composer environment information here.

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

// Make the request
try {
Expand Down Expand Up @@ -86,7 +86,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
headers: {'User-Agent': userAgent, 'Metadata-Flavor': 'Google'},
}
);
const tokenResponse = res.json();
const tokenResponse = await res.json();
if (tokenResponse.error) {
return Promise.reject(tokenResponse.error);
}
Expand Down Expand Up @@ -116,7 +116,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
},
}
);
const blobJson = blob.json();
const blobJson = await blob.json();
if (blobJson.error) {
return Promise.reject(blobJson.error);
}
Expand All @@ -132,7 +132,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
method: 'POST',
body: form,
});
const tokenJson = token.json();
const tokenJson = await token.json();
if (tokenJson.error) {
return Promise.reject(tokenJson.error);
}
Expand Down