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

Re-generate library using /synth.py #270

Merged
merged 1 commit into from
Aug 8, 2018
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
17 changes: 16 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,18 @@ jobs:
- image: 'node:6'
user: node
steps: &unit_tests_steps
- checkout
- checkout
- run: &remove_package_lock
name: Remove package-lock.json if needed.
command: |
WORKFLOW_NAME=`python .circleci/get_workflow_name.py`
echo "Workflow name: $WORKFLOW_NAME"
if [ "$WORKFLOW_NAME" = "nightly" ]; then
echo "Nightly build detected, removing package-lock.json."
rm -f package-lock.json samples/package-lock.json
else
echo "Not a nightly build, skipping this step."
fi
- run: &npm_install_and_link
name: Install and link the module
command: |-
Expand All @@ -86,6 +97,7 @@ jobs:
user: node
steps:
- checkout
- run: *remove_package_lock
- run: *npm_install_and_link
- run: &samples_npm_install_and_link
name: Link the module being tested to the samples.
Expand All @@ -106,6 +118,7 @@ jobs:
user: node
steps:
- checkout
- run: *remove_package_lock
- run: *npm_install_and_link
- run:
name: Build documentation.
Expand All @@ -116,6 +129,7 @@ jobs:
user: node
steps:
- checkout
- run: *remove_package_lock
- run:
name: Decrypt credentials.
command: |
Expand All @@ -142,6 +156,7 @@ jobs:
user: node
steps:
- checkout
- run: *remove_package_lock
- run:
name: Decrypt credentials.
command: |
Expand Down
67 changes: 67 additions & 0 deletions .circleci/get_workflow_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Get workflow name for the current build using CircleCI API.
Would be great if this information is available in one of
CircleCI environment variables, but it's not there.
https://circleci.ideas.aha.io/ideas/CCI-I-295
"""

import json
import os
import sys
import urllib2


def main():
try:
username = os.environ['CIRCLE_PROJECT_USERNAME']
reponame = os.environ['CIRCLE_PROJECT_REPONAME']
build_num = os.environ['CIRCLE_BUILD_NUM']
except:
sys.stderr.write(
'Looks like we are not inside CircleCI container. Exiting...\n')
return 1

try:
request = urllib2.Request(
"https://circleci.com/api/v1.1/project/github/%s/%s/%s" %
(username, reponame, build_num),
headers={"Accept": "application/json"})
contents = urllib2.urlopen(request).read()
except:
sys.stderr.write('Cannot query CircleCI API. Exiting...\n')
return 1

try:
build_info = json.loads(contents)
except:
sys.stderr.write(
'Cannot parse JSON received from CircleCI API. Exiting...\n')
return 1

try:
workflow_name = build_info['workflows']['workflow_name']
except:
sys.stderr.write(
'Cannot get workflow name from CircleCI build info. Exiting...\n')
return 1

print workflow_name
return 0


retval = main()
exit(retval)
67 changes: 34 additions & 33 deletions src/v2/bigtable_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,10 @@ class BigtableClient {
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
table_name: request.tableName,
});
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
'table_name': request.tableName
});

return this._innerApiCalls.readRows(request, options);
}
Expand Down Expand Up @@ -298,11 +297,10 @@ class BigtableClient {
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
table_name: request.tableName,
});
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
'table_name': request.tableName
});

return this._innerApiCalls.sampleRowKeys(request, options);
}
Expand Down Expand Up @@ -372,11 +370,10 @@ class BigtableClient {
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
table_name: request.tableName,
});
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
'table_name': request.tableName
});

return this._innerApiCalls.mutateRow(request, options, callback);
}
Expand Down Expand Up @@ -429,11 +426,10 @@ class BigtableClient {
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
table_name: request.tableName,
});
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
'table_name': request.tableName
});

return this._innerApiCalls.mutateRows(request, options);
}
Expand Down Expand Up @@ -518,11 +514,10 @@ class BigtableClient {
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
table_name: request.tableName,
});
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
'table_name': request.tableName
});

return this._innerApiCalls.checkAndMutateRow(request, options, callback);
}
Expand Down Expand Up @@ -596,11 +591,10 @@ class BigtableClient {
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
table_name: request.tableName,
});
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
'table_name': request.tableName
});

return this._innerApiCalls.readModifyWriteRow(request, options, callback);
}
Expand Down Expand Up @@ -633,7 +627,9 @@ class BigtableClient {
* @returns {String} - A string representing the project.
*/
matchProjectFromTableName(tableName) {
return this._pathTemplates.tablePathTemplate.match(tableName).project;
return this._pathTemplates.tablePathTemplate
.match(tableName)
.project;
}

/**
Expand All @@ -644,7 +640,9 @@ class BigtableClient {
* @returns {String} - A string representing the instance.
*/
matchInstanceFromTableName(tableName) {
return this._pathTemplates.tablePathTemplate.match(tableName).instance;
return this._pathTemplates.tablePathTemplate
.match(tableName)
.instance;
}

/**
Expand All @@ -655,8 +653,11 @@ class BigtableClient {
* @returns {String} - A string representing the table.
*/
matchTableFromTableName(tableName) {
return this._pathTemplates.tablePathTemplate.match(tableName).table;
return this._pathTemplates.tablePathTemplate
.match(tableName)
.table;
}
}


module.exports = BigtableClient;
Loading