Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit b312004

Browse files
chore: migrate to owl bot (#958)
* chore: migrate to owl bot * chore: copy files from googleapis-gen 397c0bfd367a2427104f988d5329bc117caafd95 * chore: run the post processor * lint Co-authored-by: Justin Beckwith <[email protected]>
1 parent 49478b9 commit b312004

20 files changed

+224
-210
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docker:
2+
digest: sha256:f556e6e7be625deb1b2429fe608df27be57185c3e6b7d39ee0059f1609f17530
3+
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest
4+

.github/.OwlBot.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2021 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+
docker:
15+
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest
16+
17+
18+
begin-after-commit-hash: 397c0bfd367a2427104f988d5329bc117caafd95
19+

.github/generated-files-bot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
generatedFiles:
2+
- path: '.kokoro/**'
3+
message: '`.kokoro` files are templated and should be updated in [`synthtool`](https://github.com/googleapis/synthtool)'
4+
- path: '.github/CODEOWNERS'
5+
message: 'CODEOWNERS should instead be modified via the `codeowner_team` property in .repo-metadata.json'
6+
- path: '.github/workflows/**'
7+
message: '`.github/workflows` (GitHub Actions) should be updated in [`synthtool`](https://github.com/googleapis/synthtool)'
8+
- path: '.github/generated-files-bot.+(yml|yaml)'
9+
message: '`.github/generated-files-bot.(yml|yaml)` should be updated in [`synthtool`](https://github.com/googleapis/synthtool)'
10+
- path: 'README.md'
11+
message: '`README.md` is managed by [`synthtool`](https://github.com/googleapis/synthtool). However, a partials file can be used to update the README, e.g.: https://github.com/googleapis/nodejs-storage/blob/master/.readme-partials.yaml'
12+
- path: 'samples/README.md'
13+
message: '`samples/README.md` is managed by [`synthtool`](https://github.com/googleapis/synthtool). However, a partials file can be used to update the README, e.g.: https://github.com/googleapis/nodejs-storage/blob/master/.readme-partials.yaml'
14+
ignoreAuthors:
15+
- 'gcf-owl-bot[bot]'
16+
- 'yoshi-automation'

synth.py renamed to owlbot.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import synthtool as s
16-
import synthtool.gcp as gcp
1715
import synthtool.languages.node as node
18-
import logging
1916

20-
logging.basicConfig(level=logging.DEBUG)
21-
22-
AUTOSYNTH_MULTIPLE_COMMITS = True
23-
24-
common_templates = gcp.CommonTemplates()
25-
templates = common_templates.node_library()
26-
s.copy(templates, excludes=['.eslintignore', '.mocharc.js', '.github/workflows/ci.yaml'])
27-
28-
node.install()
29-
node.fix()
17+
node.owlbot_main(templates_excludes=['.eslintignore', '.mocharc.js', '.github/workflows/ci.yaml'])

src/agent/controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class Controller extends ServiceObject {
134134
} else if (response.statusCode === 404) {
135135
// The v2 API returns 404 (google.rpc.Code.NOT_FOUND) when the agent
136136
// registration expires. We should re-register.
137-
callback(null, (response as {}) as t.Response);
137+
callback(null, response as {} as t.Response);
138138
return;
139139
} else if (response.statusCode !== 200) {
140140
callback(
@@ -146,7 +146,7 @@ export class Controller extends ServiceObject {
146146
} else {
147147
body = body || {};
148148
that.nextWaitToken = body.nextWaitToken;
149-
callback(null, (response as {}) as t.Response, body);
149+
callback(null, response as {} as t.Response, body);
150150
}
151151
}
152152
);

src/agent/debuglet.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ export class Debuglet extends EventEmitter {
457457
let sourceContext;
458458
try {
459459
sourceContext =
460-
((that.config.sourceContext as {}) as SourceContext) ||
460+
(that.config.sourceContext as {} as SourceContext) ||
461461
(await Debuglet.getSourceContextFromFile());
462462
} catch (err5) {
463463
that.logger.warn('Unable to discover source context', err5);
@@ -741,9 +741,11 @@ export class Debuglet extends EventEmitter {
741741
);
742742
// TODO: Handle the case when `that.debuggee` is null.
743743
// TODO: Handle the case when `result` is undefined.
744-
(that.debuggee as Debuggee).id = (result as {
745-
debuggee: Debuggee;
746-
}).debuggee.id;
744+
(that.debuggee as Debuggee).id = (
745+
result as {
746+
debuggee: Debuggee;
747+
}
748+
).debuggee.id;
747749
// TODO: Handle the case when `result` is undefined.
748750
that.emit('registered', (result as {debuggee: Debuggee}).debuggee.id);
749751
that.debuggeeRegistered.resolve();
@@ -926,9 +928,7 @@ export class Debuglet extends EventEmitter {
926928
// field. It is possible that breakpoint.id is always
927929
// undefined!
928930
// TODO: Make sure the use of `that` here is correct.
929-
delete that.completedBreakpointMap[
930-
((breakpoint as {}) as {id: number}).id
931-
];
931+
delete that.completedBreakpointMap[(breakpoint as {} as {id: number}).id];
932932
});
933933

934934
// Remove active breakpoints that the server no longer care about.
@@ -946,9 +946,9 @@ export class Debuglet extends EventEmitter {
946946
* @return {Object.<string, Breakpoint>} A map of breakpoint IDs to breakpoints.
947947
* @private
948948
*/
949-
convertBreakpointListToMap_(
950-
breakpointList: stackdriver.Breakpoint[]
951-
): {[key: string]: stackdriver.Breakpoint} {
949+
convertBreakpointListToMap_(breakpointList: stackdriver.Breakpoint[]): {
950+
[key: string]: stackdriver.Breakpoint;
951+
} {
952952
const map: {[id: string]: stackdriver.Breakpoint} = {};
953953
breakpointList.forEach(breakpoint => {
954954
// TODO: Address the case when `breakpoint.id` is `undefined`.
@@ -1098,13 +1098,15 @@ export class Debuglet extends EventEmitter {
10981098
const that = this;
10991099

11001100
// TODO: Address the case when `that.debuggee` is `null`.
1101-
that.controller.updateBreakpoint(that.debuggee as Debuggee, breakpoint, (
1102-
err /*, body*/
1103-
) => {
1104-
if (err) {
1105-
that.logger.error('Unable to complete breakpoint on server', err);
1101+
that.controller.updateBreakpoint(
1102+
that.debuggee as Debuggee,
1103+
breakpoint,
1104+
(err /*, body*/) => {
1105+
if (err) {
1106+
that.logger.error('Unable to complete breakpoint on server', err);
1107+
}
11061108
}
1107-
});
1109+
);
11081110
}
11091111

11101112
/**

src/agent/io/sourcemapper.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ async function processSourcemap(
7474
// TODO: Resolve the cast of `contents as any` (This is needed because the
7575
// type is expected to be of `RawSourceMap` but the existing
7676
// working code uses a string.)
77-
consumer = (new sourceMap.SourceMapConsumer(
78-
(contents as {}) as sourceMap.RawSourceMap
79-
) as {}) as sourceMap.RawSourceMap;
77+
consumer = new sourceMap.SourceMapConsumer(
78+
contents as {} as sourceMap.RawSourceMap
79+
) as {} as sourceMap.RawSourceMap;
8080
} catch (e) {
8181
throw new Error(
8282
'An error occurred while reading the ' +
@@ -246,7 +246,8 @@ export class SourceMapper {
246246
};
247247

248248
// TODO: Determine how to remove the explicit cast here.
249-
const consumer: sourceMap.SourceMapConsumer = (entry.mapConsumer as {}) as sourceMap.SourceMapConsumer;
249+
const consumer: sourceMap.SourceMapConsumer =
250+
entry.mapConsumer as {} as sourceMap.SourceMapConsumer;
250251
const allPos = consumer.allGeneratedPositionsFor(sourcePos);
251252
/*
252253
* Based on testing, it appears that the following code is needed to
@@ -270,7 +271,7 @@ export class SourceMapper {
270271
// TODO: The `sourceMap.Position` type definition has a `column`
271272
// attribute and not a `col` attribute. Determine if the type
272273
// definition or this code is correct.
273-
column: ((mappedPos as {}) as {col: number}).col, // SourceMapConsumer uses
274+
column: (mappedPos as {} as {col: number}).col, // SourceMapConsumer uses
274275
// zero-based column
275276
// numbers which is the
276277
// same as the expected

src/agent/state/inspector-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class StateResolver {
151151
};
152152

153153
// TODO: Determine why _extend is used here
154-
this.resolvedVariableTable = ((util as {}) as {_extend: Function})._extend(
154+
this.resolvedVariableTable = (util as {} as {_extend: Function})._extend(
155155
[],
156156
this.messageTable
157157
);

src/agent/state/legacy-state.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class StateResolver {
138138
};
139139

140140
// TODO: Determine why _extend is used here
141-
this.resolvedVariableTable = ((util as {}) as {_extend: Function})._extend(
141+
this.resolvedVariableTable = (util as {} as {_extend: Function})._extend(
142142
[],
143143
this.messageTable
144144
);
@@ -148,7 +148,7 @@ class StateResolver {
148148

149149
// This constructor is only used in situations where the legacy vm
150150
// interface is used that has the `runInDebugContext` method.
151-
this.scopeType = ((vm as {}) as LegacyVm).runInDebugContext('ScopeType');
151+
this.scopeType = (vm as {} as LegacyVm).runInDebugContext('ScopeType');
152152
}
153153

154154
/**

src/agent/util/debug-assert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ const fakeAssert: FakeAssert = {
6262

6363
export function debugAssert(enableAssertions: boolean): FakeAssert {
6464
// The typecast is needed since the @types/node doesn't cover Node 10 yet
65-
return enableAssertions ? ((realAssert as {}) as FakeAssert) : fakeAssert;
65+
return enableAssertions ? (realAssert as {} as FakeAssert) : fakeAssert;
6666
}

0 commit comments

Comments
 (0)