Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 0990f91

Browse files
dpebotsduskis
authored andcommitted
Re-generate library using /synth.py (#270)
1 parent e1d33a2 commit 0990f91

4 files changed

Lines changed: 138 additions & 122 deletions

File tree

.circleci/config.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,18 @@ jobs:
5959
- image: 'node:6'
6060
user: node
6161
steps: &unit_tests_steps
62-
- checkout
62+
- checkout
63+
- run: &remove_package_lock
64+
name: Remove package-lock.json if needed.
65+
command: |
66+
WORKFLOW_NAME=`python .circleci/get_workflow_name.py`
67+
echo "Workflow name: $WORKFLOW_NAME"
68+
if [ "$WORKFLOW_NAME" = "nightly" ]; then
69+
echo "Nightly build detected, removing package-lock.json."
70+
rm -f package-lock.json samples/package-lock.json
71+
else
72+
echo "Not a nightly build, skipping this step."
73+
fi
6374
- run: &npm_install_and_link
6475
name: Install and link the module
6576
command: |-
@@ -86,6 +97,7 @@ jobs:
8697
user: node
8798
steps:
8899
- checkout
100+
- run: *remove_package_lock
89101
- run: *npm_install_and_link
90102
- run: &samples_npm_install_and_link
91103
name: Link the module being tested to the samples.
@@ -106,6 +118,7 @@ jobs:
106118
user: node
107119
steps:
108120
- checkout
121+
- run: *remove_package_lock
109122
- run: *npm_install_and_link
110123
- run:
111124
name: Build documentation.
@@ -116,6 +129,7 @@ jobs:
116129
user: node
117130
steps:
118131
- checkout
132+
- run: *remove_package_lock
119133
- run:
120134
name: Decrypt credentials.
121135
command: |
@@ -142,6 +156,7 @@ jobs:
142156
user: node
143157
steps:
144158
- checkout
159+
- run: *remove_package_lock
145160
- run:
146161
name: Decrypt credentials.
147162
command: |

.circleci/get_workflow_name.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""
16+
Get workflow name for the current build using CircleCI API.
17+
Would be great if this information is available in one of
18+
CircleCI environment variables, but it's not there.
19+
https://circleci.ideas.aha.io/ideas/CCI-I-295
20+
"""
21+
22+
import json
23+
import os
24+
import sys
25+
import urllib2
26+
27+
28+
def main():
29+
try:
30+
username = os.environ['CIRCLE_PROJECT_USERNAME']
31+
reponame = os.environ['CIRCLE_PROJECT_REPONAME']
32+
build_num = os.environ['CIRCLE_BUILD_NUM']
33+
except:
34+
sys.stderr.write(
35+
'Looks like we are not inside CircleCI container. Exiting...\n')
36+
return 1
37+
38+
try:
39+
request = urllib2.Request(
40+
"https://circleci.com/api/v1.1/project/github/%s/%s/%s" %
41+
(username, reponame, build_num),
42+
headers={"Accept": "application/json"})
43+
contents = urllib2.urlopen(request).read()
44+
except:
45+
sys.stderr.write('Cannot query CircleCI API. Exiting...\n')
46+
return 1
47+
48+
try:
49+
build_info = json.loads(contents)
50+
except:
51+
sys.stderr.write(
52+
'Cannot parse JSON received from CircleCI API. Exiting...\n')
53+
return 1
54+
55+
try:
56+
workflow_name = build_info['workflows']['workflow_name']
57+
except:
58+
sys.stderr.write(
59+
'Cannot get workflow name from CircleCI build info. Exiting...\n')
60+
return 1
61+
62+
print workflow_name
63+
return 0
64+
65+
66+
retval = main()
67+
exit(retval)

src/v2/bigtable_client.js

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,10 @@ class BigtableClient {
251251
options = options || {};
252252
options.otherArgs = options.otherArgs || {};
253253
options.otherArgs.headers = options.otherArgs.headers || {};
254-
options.otherArgs.headers[
255-
'x-goog-request-params'
256-
] = gax.routingHeader.fromParams({
257-
table_name: request.tableName,
258-
});
254+
options.otherArgs.headers['x-goog-request-params'] =
255+
gax.routingHeader.fromParams({
256+
'table_name': request.tableName
257+
});
259258

260259
return this._innerApiCalls.readRows(request, options);
261260
}
@@ -298,11 +297,10 @@ class BigtableClient {
298297
options = options || {};
299298
options.otherArgs = options.otherArgs || {};
300299
options.otherArgs.headers = options.otherArgs.headers || {};
301-
options.otherArgs.headers[
302-
'x-goog-request-params'
303-
] = gax.routingHeader.fromParams({
304-
table_name: request.tableName,
305-
});
300+
options.otherArgs.headers['x-goog-request-params'] =
301+
gax.routingHeader.fromParams({
302+
'table_name': request.tableName
303+
});
306304

307305
return this._innerApiCalls.sampleRowKeys(request, options);
308306
}
@@ -372,11 +370,10 @@ class BigtableClient {
372370
options = options || {};
373371
options.otherArgs = options.otherArgs || {};
374372
options.otherArgs.headers = options.otherArgs.headers || {};
375-
options.otherArgs.headers[
376-
'x-goog-request-params'
377-
] = gax.routingHeader.fromParams({
378-
table_name: request.tableName,
379-
});
373+
options.otherArgs.headers['x-goog-request-params'] =
374+
gax.routingHeader.fromParams({
375+
'table_name': request.tableName
376+
});
380377

381378
return this._innerApiCalls.mutateRow(request, options, callback);
382379
}
@@ -429,11 +426,10 @@ class BigtableClient {
429426
options = options || {};
430427
options.otherArgs = options.otherArgs || {};
431428
options.otherArgs.headers = options.otherArgs.headers || {};
432-
options.otherArgs.headers[
433-
'x-goog-request-params'
434-
] = gax.routingHeader.fromParams({
435-
table_name: request.tableName,
436-
});
429+
options.otherArgs.headers['x-goog-request-params'] =
430+
gax.routingHeader.fromParams({
431+
'table_name': request.tableName
432+
});
437433

438434
return this._innerApiCalls.mutateRows(request, options);
439435
}
@@ -518,11 +514,10 @@ class BigtableClient {
518514
options = options || {};
519515
options.otherArgs = options.otherArgs || {};
520516
options.otherArgs.headers = options.otherArgs.headers || {};
521-
options.otherArgs.headers[
522-
'x-goog-request-params'
523-
] = gax.routingHeader.fromParams({
524-
table_name: request.tableName,
525-
});
517+
options.otherArgs.headers['x-goog-request-params'] =
518+
gax.routingHeader.fromParams({
519+
'table_name': request.tableName
520+
});
526521

527522
return this._innerApiCalls.checkAndMutateRow(request, options, callback);
528523
}
@@ -596,11 +591,10 @@ class BigtableClient {
596591
options = options || {};
597592
options.otherArgs = options.otherArgs || {};
598593
options.otherArgs.headers = options.otherArgs.headers || {};
599-
options.otherArgs.headers[
600-
'x-goog-request-params'
601-
] = gax.routingHeader.fromParams({
602-
table_name: request.tableName,
603-
});
594+
options.otherArgs.headers['x-goog-request-params'] =
595+
gax.routingHeader.fromParams({
596+
'table_name': request.tableName
597+
});
604598

605599
return this._innerApiCalls.readModifyWriteRow(request, options, callback);
606600
}
@@ -633,7 +627,9 @@ class BigtableClient {
633627
* @returns {String} - A string representing the project.
634628
*/
635629
matchProjectFromTableName(tableName) {
636-
return this._pathTemplates.tablePathTemplate.match(tableName).project;
630+
return this._pathTemplates.tablePathTemplate
631+
.match(tableName)
632+
.project;
637633
}
638634

639635
/**
@@ -644,7 +640,9 @@ class BigtableClient {
644640
* @returns {String} - A string representing the instance.
645641
*/
646642
matchInstanceFromTableName(tableName) {
647-
return this._pathTemplates.tablePathTemplate.match(tableName).instance;
643+
return this._pathTemplates.tablePathTemplate
644+
.match(tableName)
645+
.instance;
648646
}
649647

650648
/**
@@ -655,8 +653,11 @@ class BigtableClient {
655653
* @returns {String} - A string representing the table.
656654
*/
657655
matchTableFromTableName(tableName) {
658-
return this._pathTemplates.tablePathTemplate.match(tableName).table;
656+
return this._pathTemplates.tablePathTemplate
657+
.match(tableName)
658+
.table;
659659
}
660660
}
661661

662+
662663
module.exports = BigtableClient;

0 commit comments

Comments
 (0)