-
Notifications
You must be signed in to change notification settings - Fork 100
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
Use octokit github client #146
Conversation
backend/lib/config/gardener.js
Outdated
repository: 'journal-dev', | ||
webhookSecret: '776562686f6f6b536563726574', | ||
authentication: { | ||
token: '746f6b656e' |
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.
776562686f6f6b536563726574 === hexEncode('webhookSecret')
746f6b656e === hexEncode('token')
-> these are just dummy values used for unit tests, correct?
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.
If have changed it to:
webhookSecret: hexEncode('webhookSecret'),
authentication: {
token: hexEncode('token')
@@ -1,6 +1,7 @@ | |||
port: 3030 | |||
logLevel: info | |||
logFormat: text | |||
apiServerUrl: https://minikube:8443 |
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.
is this still used? as we have the same value in backend/lib/config/gardener.js
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.
I have changed it in backend/lib/config/gardener.js to
apiServerUrl: 'https://apiserver:8443',
single webhook file should be sufficient Added first journal acceptance test Some more github acceptance test Handle error for load issue comments acceptance test for github comments update dependencies More tests for octokit Add `es6-error` license Allow github and oidc ca in configmap Remove trailing slash in githubUrl use for loop instead of lodash forEach to await inner inner async call before flush emitter remove defaults for org and repo only do a time safe equal comparison fetch shoots parallel
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.
lgtm
Intended improvements
Changes in detail
Wrapper around the octokit client library. Adds PageStream class which creates a Readable stream based on pageable github resources. It adds reduce and thru methods to the streams. They allow interception / transform the chunk or to concat all data. Both return a Promise if the stream ended or failed. It also read authentiction from config.
This module exposes those functions needed for issues and comments in our case. They make use of the PageStream for pageable resources.
Implements the github webhook route and does JSON body parsing with signature validation using the body-parser verify hook. It handles the github webhook events and updates the cache for issues and comments. In case of an reopended issues it reloads all comments and updates the cache in the background. All webhooks return synchronous.
This module exposes higher level functions for handling issues and comments. All function starting with load return an empty Promise and do a cache update. The functions starting with get return a stream with a reduce method. This allows to e.g write to the cache.
This module now returns a function to create the cache instead of the cache object. This is needed for testing. The event registration is now done by the EventEmitter class.
Extracted some functions to make it more modular. In case of journalNsp all comments for each issue are fetch sequentially in order to handle errors individually.
Render ca file content in JSON format for oidc and github ca.
Which issue(s) this PR fixes:
Fixes #145
Release note:
configmap.yaml example: