-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RELTEC-12262: refactor webhooks endpoint to vcs webhooks, support
different vcs systems during user validation
- Loading branch information
Showing
230 changed files
with
89,023 additions
and
1,372 deletions.
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
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
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,44 @@ | ||
package inputvalidationerror | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"fmt" | ||
) | ||
|
||
type ErrorInt interface { | ||
Ctx() context.Context | ||
IsInputValidationError() bool | ||
} | ||
|
||
// this also implements the error interface | ||
|
||
type Error struct { | ||
ctx context.Context | ||
err error | ||
} | ||
|
||
func New(ctx context.Context, reason string) error { | ||
return &Error{ | ||
ctx: ctx, | ||
err: fmt.Errorf("input validation failed: %s", reason), | ||
} | ||
} | ||
|
||
func (e *Error) Error() string { | ||
return e.err.Error() | ||
} | ||
|
||
func (e *Error) Ctx() context.Context { | ||
return e.ctx | ||
} | ||
|
||
// the presence of this method makes the interface unique and thus recognizable by a simple type check | ||
|
||
func (e *Error) IsInputValidationError() bool { | ||
return true | ||
} | ||
|
||
func Is(err error) bool { | ||
return errors.As(err, new(*Error)) | ||
} |
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
package repository | ||
|
||
import "context" | ||
|
||
type VcsPlugin interface { | ||
SetCommitStatusInProgress(ctx context.Context, repoPath, repoName, commitID, url string, statusKey string) error | ||
|
||
SetCommitStatusSucceeded(ctx context.Context, repoPath, repoName, commitID, url string, statusKey string) error | ||
|
||
SetCommitStatusFailed(ctx context.Context, repoPath, repoName, commitID, url string, statusKey string) error | ||
|
||
CreatePullRequestComment(ctx context.Context, repoPath, repoName, pullRequestID, text string) error | ||
|
||
GetChangedFilesOnPullRequest(ctx context.Context, repoPath, repoName, pullRequestID, toRef string) ([]File, string, error) | ||
|
||
GetUser(ctx context.Context, username string) (string, error) | ||
} | ||
|
||
type CommitBuildStatus string | ||
|
||
const ( | ||
CommitBuildStatusSuccess CommitBuildStatus = "SUCCESSFUL" | ||
CommitBuildStatusInProgress CommitBuildStatus = "INPROGRESS" | ||
CommitBuildStatusFailed CommitBuildStatus = "FAILED" | ||
) | ||
|
||
type File struct { | ||
Path string | ||
Contents string | ||
} |
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
package service | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
) | ||
|
||
type VCSWebhooksHandler interface { | ||
HandleEvent(ctx context.Context, vcsKey string, r *http.Request) error | ||
} |
Oops, something went wrong.