-
Notifications
You must be signed in to change notification settings - Fork 132
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
feat: introduce new bot-framework library #5236
Open
chingor13
wants to merge
27
commits into
main
Choose a base branch
from
no-probot
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
a455073
prototype probot less gcf-utils
chingor13 22a6509
error handling
chingor13 efaebe9
pubsub and errors
chingor13 fdf643c
test: mock task enqueuer
chingor13 28091b6
refactor: rename to bot-framework
chingor13 0587bb6
ci: test on node 18
chingor13 78be503
chore: fix license headers
chingor13 db28dcc
chore: fix lint
chingor13 76a384f
test: rewrite error handling tests
chingor13 d555fda
chore: fix copyright years
chingor13 7a0ba0f
test: add load tests
chingor13 5aed06c
context logger and octokit
chingor13 daea452
context logger/octokit
chingor13 29402ca
test: task retry tests
chingor13 610f084
test: add test for payload cache
chingor13 e5171f0
save payload in cache
chingor13 a0fade8
sign payload outside of task enqueuer
chingor13 2a4de70
move task caller options to cloud task enqueuer
chingor13 1273263
port bot-request test
chingor13 11f5ddb
port logging tests
chingor13 bb9e724
test: port error logging tests
chingor13 71f2d3c
test: port server tests
chingor13 cdaae23
chore: fix header years
chingor13 9e0fba6
chore: remove unnecessary import
chingor13 b397b81
Merge branch 'main' into no-probot
chingor13 675a03b
separate GCPBootstrapper from Bootstrapper
chingor13 b40768d
add environment-secret-loader
chingor13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"exclude": [".mocharc.js", "build/test"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
build/ | ||
coverage/ | ||
node_modules/ | ||
.env | ||
*.pem | ||
Dockerfile | ||
.dockerignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
**/node_modules | ||
**/coverage | ||
test/fixtures | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "./node_modules/gts", | ||
"root": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
build | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2023 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. | ||
const config = { | ||
"enable-source-maps": true, | ||
"throw-deprecation": true, | ||
"timeout": 10000 | ||
} | ||
if (process.env.MOCHA_THROW_DEPRECATION === 'false') { | ||
delete config['throw-deprecation']; | ||
} | ||
if (process.env.MOCHA_REPORTER) { | ||
config.reporter = process.env.MOCHA_REPORTER; | ||
} | ||
if (process.env.MOCHA_REPORTER_OUTPUT) { | ||
config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; | ||
} | ||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
**/node_modules | ||
**/coverage | ||
test/fixtures | ||
build/ | ||
docs/ | ||
protos/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2023 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 | ||
// | ||
// https://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. | ||
|
||
module.exports = { | ||
...require('gts/.prettierrc.json') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2021 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. | ||
|
||
# Use a multi-stage docker build to limit production dependencies. | ||
|
||
# Use the official lightweight Node.js 14 image. | ||
# https://hub.docker.com/_/node | ||
FROM node:18-slim AS BUILD | ||
|
||
# Create and change to the app directory. | ||
WORKDIR /usr/src/app | ||
|
||
# Copy application dependency manifests to the container image. | ||
# A wildcard is used to ensure copying both package.json AND package-lock.json (when available). | ||
# Copying this first prevents re-running npm install on every code change. | ||
COPY package*.json ./ | ||
|
||
# Install build dependencies. | ||
RUN npm ci | ||
|
||
# Now copy all the code so we can compile | ||
COPY . ./ | ||
|
||
RUN npm run compile | ||
|
||
FROM node:18-slim | ||
|
||
# Create and change to the app directory. | ||
WORKDIR /usr/src/app | ||
|
||
COPY package*.json ./ | ||
COPY --from=BUILD /usr/src/app/build build | ||
RUN npm ci --only=production | ||
|
||
ENV NODE_ENV "production" | ||
|
||
# Run the web service on container startup. | ||
CMD [ "npm", "--no-update-notifier", "run", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# foo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imagine I want to write a new bot.* Please describe the list of services provided by this library and why I would want to use them.
|
||
|
||
Instructions are provided in [googleapis/repo-automation-bots](https://github.com/googleapis/repo-automation-bots/blob/main/README.md) for deploying and testing your bots. | ||
|
||
This bot uses nock for mocking requests to GitHub, and snap-shot-it for capturing responses; This allows updates to the API surface to be treated as a visual diff, rather than tediously asserting against each field. | ||
|
||
## Running tests: | ||
|
||
`npm test` | ||
|
||
## Contributing | ||
|
||
If you have suggestions for how foo could be improved, or want to report a bug, open an issue! We'd love all and any contributions. | ||
|
||
For more, check out the Contributing Guide. | ||
|
||
License | ||
Apache 2.0 © 2021 Google LLC. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2021 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. | ||
|
||
steps: | ||
- name: gcr.io/cloud-builders/docker | ||
id: 'build-docker' | ||
waitFor: ['-'] | ||
dir: 'packages/' | ||
args: | ||
- 'build' | ||
- '-t' | ||
- 'gcr.io/$PROJECT_ID/' | ||
- '.' | ||
|
||
# TODO: create container test | ||
# TODO: create unit & integration tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2021 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. | ||
|
||
steps: | ||
- name: gcr.io/cloud-builders/npm | ||
id: "build" | ||
waitFor: ["-"] | ||
entrypoint: bash | ||
args: | ||
- "-e" | ||
- "./scripts/build-function.sh" | ||
- "$_DIRECTORY" | ||
|
||
- name: gcr.io/cloud-builders/gcloud | ||
id: "publish-function" | ||
waitFor: ["build"] | ||
entrypoint: bash | ||
args: | ||
- "-e" | ||
- "./scripts/publish-function.sh" | ||
- "$_DIRECTORY" | ||
- "$PROJECT_ID" | ||
- "$_BUCKET" | ||
- "$_KEY_LOCATION" | ||
- "$_KEY_RING" | ||
- "$_FUNCTION_REGION" | ||
- "nodejs12" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was for local testing and can be removed later.