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

feat(KONFLUX-782): a GitHub App to react to PR comments #1

Merged
merged 267 commits into from
Jan 25, 2024
Merged

Conversation

dheerajodha
Copy link
Member

No description provided.

bluekeyes and others added 30 commits July 22, 2019 11:11
In certain platforms, setting application secrets is easier with
environment variables. Add a new function that can use environment
variables to override configuration values loaded from other places,
like a file.
This introduces two new mechanisms for customizing responses:

  * Clients can configure a response callback to send custom responses
    for all events.
  * Individual handlers may call SetResponder() to send custom responses
    in specific situations.

While there should be little need to customize responses, I believe some
combination of these two options will satisfy most use cases. Note that
introducing the new callback changes the signature of NewEventDispatcher
and some other types; most applications are not using these directly.

On the other hand, I chose to introduce SetResponder() to avoid breaking
the EventHandler interface, even though it is more idiomatic to either
provide the handler with access to the request and response writer or
allow it to return more information.
When a payload fails validation, due to missing headers, an invalid
signature, or other reasons, create a ValidationError so that error
handlers can identify this case. Modify the default handler to return a
400 error in this case instead of a 500 or 202 response.
We occasionally see a nil pointer exception that suggests the "next"
RoundTripper in the client middleware chain is nil. In reviewing the
middleware code, I noticed that the use of append() at client creation
time could modify the global slice associated with the creator instance
without a lock. This is definitely a race condition, and could be the
cause of the observed exception (but I have no direct evidence.)

Change the application function to take individual slices and iterate
over them directly, rather than creating a single slice.
As of 1.0.0, this library includes a breaking API change and appears to
require that we adopt modules to be compatible with the go-github
imports.
If the delegate RoundTripper returns an error and no response, do not
try to access the response headers.
Allow code other than the default dispatcher to initialize a request
context for use with Set/GetResponder.
Introduce a configurable scheduler option for NewEventDispatcher and add
two asynchronous schedulers, one that is unlimited and one that uses a
bounded queue and a fixed number of workers.

For many applications, switching to asynchronous handling will be as
easy as adding this new option when creating the event dispatcher. Other
applications will need to provide a custom ContextDeriver to copy values
from the request context into the detached handler context.

As a result of error handling code introduced as part of this change,
go-githubapp now requires at least Go 1.13.
* centralize all http.Client creation

* set the timeout from the clientCreator

* add the configuration method

* add example and readme

* lint

* Update client_creator.go
These provide more insight into the queued asynchronous scheduler.
These are non-default because they require a metrics registry, but the
default handlers are now implemented by passing a nil registry to the
metric version.

Note that this contains an API break in the AsyncErrorCallback type, but
I don't expect there to be many (any?) custom implementations.
svc-excavator-bot and others added 17 commits October 20, 2023 12:19
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit ensures that the GH App also processes the prow jobs
which fails on setting up the infrastructure. We surface this failure
back to the PR to let the users know that the latest job failed before
it could even execute the e2e-tests.

Signed-off-by: Dheeraj<[email protected]>
* Introduce a struct FailedTestCasesReport, to easily diffrentiate the job
  failures during cluster bootstrapping phase, and E2E tests execution phase.
* Make the code more modular by moving some LOCs into separate functions.
* Better logging to make debugging easier.

Signed-off-by: Dheeraj<[email protected]>
* handle jobs that failed during cluster creation and display the info
  back to the user.
* add a new Failure/Error message for each failed test case displayed to the
  PR's comment.

Singed-off-by: Dheeraj<[email protected]>
* With this change, if a prow job fails during bootstrapping Konflux to cluser
  then the GitHub app display last few lines of the error log, to the comment.
* This will provide more info to the users about what went wrong.

Signed-off-by: Dheeraj<[email protected]>
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

example/issue_comment.go Dismissed Show dismissed Hide dismissed
oauth2/handler.go Dismissed Show dismissed Hide dismissed
@dheerajodha dheerajodha force-pushed the develop branch 5 times, most recently from f4ecd8a to dbfcce3 Compare January 25, 2024 15:41
@dheerajodha
Copy link
Member Author

I've tested this PR and can confirm that this GH App successfully updates the PR comments when the Prow job:

  • Failed while creating the cluster
  • Failed while installing Konflux on the cluster
  • Failed while running the E2E tests on the cluster

@psturc psturc merged commit 6240013 into main Jan 25, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.