Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.
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
8 changes: 2 additions & 6 deletions .github/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
rules:
- author: "renovate-bot"
title: "^(fix|chore)\\(deps\\):"
changedFiles:
- "package\\.json$"
maxFiles: 2
processes:
- "NodeDependency"
5 changes: 3 additions & 2 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ branchProtectionRules:
- "ci/kokoro: Samples test"
- "ci/kokoro: System test"
- lint
- test (14)
- test (16)
- test (18)
- test (20)
- test (22)
- cla/google
- windows
- OwlBot Post Processor
permissionRules:
- team: yoshi-admins
permission: admin
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
node-version: 18
- run: npm install
- run: npm run lint
# docs:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# - uses: actions/setup-node@v6
# with:
# node-version: 18
# - run: npm install
# - run: npm run docs
# - uses: JustinBeckwith/linkinator-action@v1
# with:
# paths: docs/
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 18
- run: npm install
- run: npm run docs
- uses: JustinBeckwith/linkinator-action@v1
with:
paths: docs/

Check warning on line 74 in .github/workflows/ci.yaml

View check run for this annotation

GitHub Advanced Security / CodeQL

Workflow does not contain permissions

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
Comment on lines +64 to +74

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
17 changes: 7 additions & 10 deletions .kokoro/samples-test.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 7 additions & 10 deletions .kokoro/system-test.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 7 additions & 10 deletions .kokoro/test.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**_THIS REPOSITORY IS DEPRECATED. ALL OF ITS CONTENT AND HISTORY HAS BEEN MOVED TO [GOOGLE-CLOUD-NODE](https://github.com/googleapis/google-cloud-node/tree/main/packages/handwritten)_**

[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
Expand Down Expand Up @@ -74,7 +76,8 @@ async function quickstart() {

// Print the row key and data (column value, labels, timestamp)
const rowData = JSON.stringify(singleRow.data, null, 4);
console.log(`Row key: ${singleRow.id}\nData: ${rowData}`);
console.log(`Row key: ${singleRow.id}
Data: ${rowData}`);
}
quickstart();

Expand Down
168 changes: 4 additions & 164 deletions owlbot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2021 Google LLC
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# 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
#
Expand All @@ -11,167 +11,7 @@
# 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.
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.node as node
import logging
import os
from pathlib import Path
from synthtool import _tracked_paths
from typing import AnyStr
import shutil

logging.basicConfig(level=logging.DEBUG)

staging = Path("owl-bot-staging")

if staging.is_dir():
versions = ['v2']
versions_admin = [f"admin/{p}" for p in versions]

logging.info(f"Copying files from staging directory {staging}.")

src_paths = {}
src_files = {}
for version in versions + versions_admin:
src_paths[version] = staging / version
src_files[version] = list([fn for fn in src_paths[version].glob('**/*.*')])

# Copy bigtable library.
# src/index.ts src/admin/v2/index.ts has added AdminClients manually; we don't want to override it.
# src/*.ts is a added layer for the client libraries, they need extra setting in tsconfig.json & tslint.json
# Tracking issues: 1. https://github.com/googleapis/nodejs-bigtable/issues/636
# 2. https://github.com/googleapis/nodejs-bigtable/issues/635
for version in versions:
library = src_paths[version]
_tracked_paths.add(library)
admin_files = filter(
lambda f: str(f).find('_admin') >= 0,
src_files[version]
)
excludes = [
'package.json',
'README.md',
'src/index.ts',
'src/v2/index.ts',
'tsconfig.json',
'tslint.json',
'.github/sync-repo-settings.yaml',
'.github/workflows/ci.yaml',
'.OwlBot.yaml',
'samples/generated/v2/*', # we don't want to encourage non-veneer use here.
'.kokoro/samples-test.sh', # get to green
'.kokoro/system-test.sh',
'.kokoro/test.sh',
] + list(admin_files)
logging.info(f"excluding files for non-admin: {excludes}")
s.copy([library], excludes = excludes)

# Copy the admin library pieces and knit them in.
# Don't override system-test for admin/v2, just keep the v2 version.
for version in versions:
admin_version = f"admin/{version}"
library = src_paths[admin_version]
inProtoPath = f"protos/google/bigtable/{admin_version}"
protos = library / inProtoPath
classes = library / 'src' / version
samples = library / 'samples' / 'generated'
tests = library / 'test'
_tracked_paths.add(library)

# We also have to munge the proto paths in the *_proto_list.json due to making it a level deeper.
# That also applies to the classes themselves.
classesStr = str(classes)
jsons = [fn
for fn
in src_files[admin_version]
if str(fn)[:len(classesStr)] == classesStr]
for jfn in jsons:
logging.info(f"munging json file: {str(jfn)}")
contents = jfn.read_text()
contents = contents.replace("'../..", "'../../..")
contents = contents.replace('"../..', '"../../..')
jfn.write_text(contents)

# Also to the tests that import stuff from src. ../ -> ../../../
testsStr = str(tests)
tfns = [fn
for fn
in src_files[admin_version]
if str(fn)[:len(testsStr)] == testsStr]
for tfn in tfns:
logging.info(f"munging test file: {str(tfn)}")
contents = tfn.read_text()

# Fix relative paths.
contents = contents.replace("'../", "'../../../")

# Use the selective subclasses.
contents = contents.replace(".v2.BigtableInstanceAdminClient", ".admin.InstanceAdminClient")
contents = contents.replace(".v2.BigtableTableAdminClient", ".admin.TableAdminClient")

# Statics also.
contents = contents.replace("bigtabletableadminModule.v2.BigtableTableAdminClient", \
"bigtabletableadminModule.admin.TableAdminClient")
contents = contents.replace("bigtabletableadminModule.v2.BigtableInstanceAdminClient", \
"bigtabletableadminModule.admin.InstanceAdminClient")

tfn.write_text(contents)

# Finally, the samples. Shift to selective subclasses, and mark the samples
# with CUJs as internal, in favour of the handwritten ones.
samplesStr = str(samples)
sfns = [fn
for fn
in src_files[admin_version]
if str(fn)[:len(samplesStr)] == samplesStr]
for sfn in sfns:
logging.info(f"munging sample file: {str(sfn)}")
contents = sfn.read_text()
contents = contents.replace("const {BigtableInstanceAdminClient} = require('@google-cloud/bigtable').v2", \
"const {InstanceAdminClient} = require('@google-cloud/bigtable').admin")
contents = contents.replace("const {BigtableTableAdminClient} = require('@google-cloud/bigtable').v2", \
"const {TableAdminClient} = require('@google-cloud/bigtable').admin")
contents = contents.replace("new BigtableInstanceAdminClient", "new InstanceAdminClient")
contents = contents.replace("new BigtableTableAdminClient", "new TableAdminClient")

# We need to disable this one so the handwritten sample
# can take over for the CUJ.
contents = contents.replace("bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async", \
"bigtableadmin_v2_generated_BigtableTableAdmin_RestoreTable_async_internal")

sfn.write_text(contents)

os.system(f"mkdir -p {inProtoPath}")
s.copy([protos / '*'], destination=inProtoPath)
os.system(f"mkdir -p src/{admin_version}")
s.copy([classes / '*'], destination=f"src/{admin_version}")
os.system(f"mkdir -p samples/generated/{admin_version}")
s.copy([samples / 'v2' / '*admin*'], destination=f"samples/generated/{admin_version}")
os.system(f"mkdir -p test/{admin_version}")
s.copy([tests / '*admin*.ts'], destination=f"test/{admin_version}")

# Replace the client name for generated system-test.
system_test_files=['system-test/fixtures/sample/src/index.ts','system-test/fixtures/sample/src/index.js']
for file in system_test_files:
s.replace(file, 'BigtableClient', 'Bigtable')
s.replace(file, 'client.close', '// client.close') # this does not work with the manual layer
s.replace(file, 'function doStuffWith', '// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction doStuffWith')

# The staging directory should never be merged into the main branch.
shutil.rmtree(staging)

common_templates = gcp.CommonTemplates()
templates = common_templates.node_library(
source_location='build/src'
)
s.copy(templates,excludes=[
'.github/auto-approve.yml',
'.github/sync-repo-settings.yaml',
'.github/workflows/ci.yaml',
'.kokoro/samples-test.sh', # get to green
'.kokoro/system-test.sh',
'.kokoro/test.sh',
node.owlbot_main(templates_excludes=[
'README.md'
])

node.postprocess_gapic_library_hermetic()
Loading
Loading