From 2642a16bbd839233406a3b9d1f7d369669ac8e63 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Mon, 17 Jun 2019 18:11:06 -0700 Subject: [PATCH 1/2] build: switch to GitHub magic proxy --- .kokoro/continuous/node10/test.cfg | 22 ++++++++++++++++++++-- .kokoro/test.sh | 11 ++++++----- samples/crud.js | 8 ++++++-- samples/dml.js | 8 ++++++-- samples/indexing.js | 4 +++- samples/timestamp.js | 4 +++- samples/transaction.js | 8 ++++++-- src/database.ts | 20 +++++++++++--------- src/index.ts | 4 +++- synth.metadata | 10 +++++----- 10 files changed, 69 insertions(+), 30 deletions(-) diff --git a/.kokoro/continuous/node10/test.cfg b/.kokoro/continuous/node10/test.cfg index 38c174e6b..fefee48ba 100644 --- a/.kokoro/continuous/node10/test.cfg +++ b/.kokoro/continuous/node10/test.cfg @@ -8,12 +8,30 @@ before_action { } } -# token used by release-please to keep an up-to-date release PR. +# tokens used by release-please to keep an up-to-date release PR. before_action { fetch_keystore { keystore_resource { keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" } } } diff --git a/.kokoro/test.sh b/.kokoro/test.sh index 0da05744c..90c95d929 100755 --- a/.kokoro/test.sh +++ b/.kokoro/test.sh @@ -36,10 +36,11 @@ else echo "coverage is only reported for Node $COVERAGE_NODE" fi -# if the GITHUB_TOKEN is set, we kick off a task to update the release-PR. -GITHUB_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_yoshi-automation-github-key) || true -if [ "$GITHUB_TOKEN" ]; then - npx release-please release-pr --token=$GITHUB_TOKEN \ +# if release-please keys set, we kick off a task to update the release-PR. +if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then + npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ --repo-url=googleapis/nodejs-spanner \ - --package-name=@google-cloud/spanner + --package-name=@google-cloud/spanner \ + --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ + --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please fi diff --git a/samples/crud.js b/samples/crud.js index 657d4a59c..08bb263e7 100644 --- a/samples/crud.js +++ b/samples/crud.js @@ -183,7 +183,9 @@ async function queryData(instanceId, databaseId, projectId) { rows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}` + `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${ + json.AlbumTitle + }` ); }); } catch (err) { @@ -232,7 +234,9 @@ async function readData(instanceId, databaseId, projectId) { rows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}` + `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${ + json.AlbumTitle + }` ); }); } catch (err) { diff --git a/samples/dml.js b/samples/dml.js index 79ab5f1bf..66b3e7c4c 100644 --- a/samples/dml.js +++ b/samples/dml.js @@ -387,7 +387,9 @@ async function queryDataWithParameter(instanceId, databaseId, projectId) { rows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, FirstName: ${json.FirstName}, LastName: ${json.LastName}` + `SingerId: ${json.SingerId}, FirstName: ${json.FirstName}, LastName: ${ + json.LastName + }` ); }); } catch (err) { @@ -618,7 +620,9 @@ async function updateUsingBatchDml(instanceId, databaseId, projectId) { const [rowCounts] = await transaction.batchUpdate(dmlStatements); await transaction.commit(); console.log( - `Successfully executed ${rowCounts.length} SQL statements using Batch DML.` + `Successfully executed ${ + rowCounts.length + } SQL statements using Batch DML.` ); }); } catch (err) { diff --git a/samples/indexing.js b/samples/indexing.js index 88269c837..8b83af5e0 100644 --- a/samples/indexing.js +++ b/samples/indexing.js @@ -151,7 +151,9 @@ async function queryDataWithIndex( ? json.MarketingBudget : null; // This value is nullable console.log( - `AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}, MarketingBudget: ${marketingBudget}` + `AlbumId: ${json.AlbumId}, AlbumTitle: ${ + json.AlbumTitle + }, MarketingBudget: ${marketingBudget}` ); }); } catch (err) { diff --git a/samples/timestamp.js b/samples/timestamp.js index 846d0db7f..120f6b1e9 100644 --- a/samples/timestamp.js +++ b/samples/timestamp.js @@ -157,7 +157,9 @@ async function queryTableWithTimestamp(instanceId, databaseId, projectId) { rows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, VenueId: ${json.VenueId}, EventDate: ${json.EventDate}, Revenue: ${json.Revenue}, LastUpdateTime: ${json.LastUpdateTime}` + `SingerId: ${json.SingerId}, VenueId: ${json.VenueId}, EventDate: ${ + json.EventDate + }, Revenue: ${json.Revenue}, LastUpdateTime: ${json.LastUpdateTime}` ); }); } catch (err) { diff --git a/samples/transaction.js b/samples/transaction.js index eca42d5fd..301a54442 100644 --- a/samples/transaction.js +++ b/samples/transaction.js @@ -52,7 +52,9 @@ function readOnlyTransaction(instanceId, databaseId, projectId) { qOneRows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}` + `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${ + json.AlbumTitle + }` ); }); @@ -68,7 +70,9 @@ function readOnlyTransaction(instanceId, databaseId, projectId) { qTwoRows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}` + `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${ + json.AlbumTitle + }` ); }); diff --git a/src/database.ts b/src/database.ts index 4359629f4..0f97bb4b1 100644 --- a/src/database.ts +++ b/src/database.ts @@ -938,16 +938,18 @@ class Database extends ServiceObject { const snapshot = session.snapshot(options); - snapshot.begin((err: null | Error): void => { - if (err) { - this.pool_.release(session); - callback(err); - return; - } + snapshot.begin( + (err: null | Error): void => { + if (err) { + this.pool_.release(session); + callback(err); + return; + } - this._releaseOnEnd(session, snapshot); - callback(err, snapshot); - }); + this._releaseOnEnd(session, snapshot); + callback(err, snapshot); + } + ); }); } diff --git a/src/index.ts b/src/index.ts index f84c837ba..3430c2a8e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -384,7 +384,9 @@ class Spanner extends Service { delete reqOpts.instance.nodes; } if (config.config && config.config.indexOf('/') === -1) { - reqOpts.instance.config = `projects/${this.projectId}/instanceConfigs/${config.config}`; + reqOpts.instance.config = `projects/${this.projectId}/instanceConfigs/${ + config.config + }`; } this.request( { diff --git a/synth.metadata b/synth.metadata index ce766beea..94268e62a 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-06-12T11:24:51.499887Z", + "updateTime": "2019-06-18T01:04:43.021756Z", "sources": [ { "generator": { "name": "artman", - "version": "0.24.1", - "dockerImage": "googleapis/artman@sha256:6018498e15310260dc9b03c9d576608908ed9fbabe42e1494ff3d827fea27b19" + "version": "0.26.0", + "dockerImage": "googleapis/artman@sha256:6db0735b0d3beec5b887153a2a7c7411fc7bb53f73f6f389a822096bd14a3a15" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "f117dac435e96ebe58d85280a3faf2350c4d4219", - "internalRef": "252714985" + "sha": "384aa843867c4d17756d14a01f047b6368494d32", + "internalRef": "253675319" } }, { From f73e631bd926ae85840ef36c464e552beba6b6f7 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Tue, 18 Jun 2019 13:27:52 -0700 Subject: [PATCH 2/2] lint: address linting issues --- samples/crud.js | 8 ++------ samples/dml.js | 8 ++------ samples/indexing.js | 4 +--- samples/timestamp.js | 4 +--- samples/transaction.js | 8 ++------ src/database.ts | 20 +++++++++----------- src/index.ts | 4 +--- 7 files changed, 18 insertions(+), 38 deletions(-) diff --git a/samples/crud.js b/samples/crud.js index 08bb263e7..657d4a59c 100644 --- a/samples/crud.js +++ b/samples/crud.js @@ -183,9 +183,7 @@ async function queryData(instanceId, databaseId, projectId) { rows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${ - json.AlbumTitle - }` + `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}` ); }); } catch (err) { @@ -234,9 +232,7 @@ async function readData(instanceId, databaseId, projectId) { rows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${ - json.AlbumTitle - }` + `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}` ); }); } catch (err) { diff --git a/samples/dml.js b/samples/dml.js index 66b3e7c4c..79ab5f1bf 100644 --- a/samples/dml.js +++ b/samples/dml.js @@ -387,9 +387,7 @@ async function queryDataWithParameter(instanceId, databaseId, projectId) { rows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, FirstName: ${json.FirstName}, LastName: ${ - json.LastName - }` + `SingerId: ${json.SingerId}, FirstName: ${json.FirstName}, LastName: ${json.LastName}` ); }); } catch (err) { @@ -620,9 +618,7 @@ async function updateUsingBatchDml(instanceId, databaseId, projectId) { const [rowCounts] = await transaction.batchUpdate(dmlStatements); await transaction.commit(); console.log( - `Successfully executed ${ - rowCounts.length - } SQL statements using Batch DML.` + `Successfully executed ${rowCounts.length} SQL statements using Batch DML.` ); }); } catch (err) { diff --git a/samples/indexing.js b/samples/indexing.js index 8b83af5e0..88269c837 100644 --- a/samples/indexing.js +++ b/samples/indexing.js @@ -151,9 +151,7 @@ async function queryDataWithIndex( ? json.MarketingBudget : null; // This value is nullable console.log( - `AlbumId: ${json.AlbumId}, AlbumTitle: ${ - json.AlbumTitle - }, MarketingBudget: ${marketingBudget}` + `AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}, MarketingBudget: ${marketingBudget}` ); }); } catch (err) { diff --git a/samples/timestamp.js b/samples/timestamp.js index 120f6b1e9..846d0db7f 100644 --- a/samples/timestamp.js +++ b/samples/timestamp.js @@ -157,9 +157,7 @@ async function queryTableWithTimestamp(instanceId, databaseId, projectId) { rows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, VenueId: ${json.VenueId}, EventDate: ${ - json.EventDate - }, Revenue: ${json.Revenue}, LastUpdateTime: ${json.LastUpdateTime}` + `SingerId: ${json.SingerId}, VenueId: ${json.VenueId}, EventDate: ${json.EventDate}, Revenue: ${json.Revenue}, LastUpdateTime: ${json.LastUpdateTime}` ); }); } catch (err) { diff --git a/samples/transaction.js b/samples/transaction.js index 301a54442..eca42d5fd 100644 --- a/samples/transaction.js +++ b/samples/transaction.js @@ -52,9 +52,7 @@ function readOnlyTransaction(instanceId, databaseId, projectId) { qOneRows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${ - json.AlbumTitle - }` + `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}` ); }); @@ -70,9 +68,7 @@ function readOnlyTransaction(instanceId, databaseId, projectId) { qTwoRows.forEach(row => { const json = row.toJSON(); console.log( - `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${ - json.AlbumTitle - }` + `SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}` ); }); diff --git a/src/database.ts b/src/database.ts index 0f97bb4b1..4359629f4 100644 --- a/src/database.ts +++ b/src/database.ts @@ -938,18 +938,16 @@ class Database extends ServiceObject { const snapshot = session.snapshot(options); - snapshot.begin( - (err: null | Error): void => { - if (err) { - this.pool_.release(session); - callback(err); - return; - } - - this._releaseOnEnd(session, snapshot); - callback(err, snapshot); + snapshot.begin((err: null | Error): void => { + if (err) { + this.pool_.release(session); + callback(err); + return; } - ); + + this._releaseOnEnd(session, snapshot); + callback(err, snapshot); + }); }); } diff --git a/src/index.ts b/src/index.ts index 3430c2a8e..f84c837ba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -384,9 +384,7 @@ class Spanner extends Service { delete reqOpts.instance.nodes; } if (config.config && config.config.indexOf('/') === -1) { - reqOpts.instance.config = `projects/${this.projectId}/instanceConfigs/${ - config.config - }`; + reqOpts.instance.config = `projects/${this.projectId}/instanceConfigs/${config.config}`; } this.request( {