This file contains hidden or 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
123 |
This file contains hidden or 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
// ServeHTTP implements http.Handler. | |
func (h *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |
// Path-based dispatch | |
h.routersMu.RLock() | |
keyedHandler, ok := h.routers[r.URL.Path] | |
h.routersMu.RUnlock() | |
if ok { | |
// Check if source still exists. | |
_, err := h.lister.GitHubSources(keyedHandler.namespace).Get(keyedHandler.name) |
This file contains hidden or 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
func (r *Reconciler) FinalizeKind(ctx context.Context, source *sourcesv1alpha1.GitHubSource) pkgreconciler.Event { | |
// If a webhook was created, try to delete it | |
if source.Status.WebhookIDKey != "" { | |
// Get access token | |
accessToken, err := r.secretFrom(ctx, source.Namespace, source.Spec.AccessToken.SecretKeyRef) | |
if apierrors.IsNotFound(err) { | |
source.Status.MarkNoSecrets("AccessTokenNotFound", "%s", err) | |
controller.GetEventRecorder(ctx).Eventf(source, corev1.EventTypeWarning, | |
"WebhookDeletionSkipped", "Could not delete webhook %q: %v", source.Status.WebhookIDKey, err) | |
// return EventTypeNormal to avoid finalize loop |
This file contains hidden or 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
func (r *Reconciler) ReconcileKind(ctx context.Context, source *sourcesv1alpha1.GitHubSource) pkgreconciler.Event { | |
source.Status.InitializeConditions() | |
accessToken, err := r.secretFrom(ctx, source.Namespace, source.Spec.AccessToken.SecretKeyRef) | |
if err != nil { | |
source.Status.MarkNoSecrets("AccessTokenNotFound", "%s", err) | |
return err | |
} | |
secretToken, err := r.secretFrom(ctx, source.Namespace, source.Spec.SecretToken.SecretKeyRef) | |
if err != nil { |
This file contains hidden or 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
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |
payload, err := h.Hook.Parse(r, ValidEvents...) | |
if err != nil { | |
if err == gh.ErrEventNotFound { | |
w.WriteHeader(http.StatusNotFound) | |
h.Logger.Info("Event not found") | |
return | |
} | |
w.WriteHeader(http.StatusBadRequest) | |
h.Logger.Errorf("Error processing request: %v", err) |
This file contains hidden or 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
// RegisterHandlerFor implements MTAdapter. | |
func (a *gitHubAdapter) RegisterHandlerFor(ctx context.Context, src *v1alpha1.GitHubSource) error { | |
secretCli := a.secrGetter.Secrets(src.Namespace) | |
secretToken, err := common.SecretFrom(ctx, secretCli, src.Spec.SecretToken.SecretKeyRef) | |
if err != nil { | |
return fmt.Errorf("reading token from Secret: %w", err) | |
} | |
logger := logging.FromContext(ctx) | |
ceSrc := v1alpha1.GitHubEventSource(src.Spec.OwnerAndRepository) |
This file contains hidden or 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
func (a *gitHubAdapter) Start(ctx context.Context) error { | |
// Start our multi-tenant server receiving GitHub events | |
server := &http.Server{ | |
ReadTimeout: 10 * time.Second, | |
ReadHeaderTimeout: 2 * time.Second, | |
Addr: fmt.Sprintf(":%d", a.port), | |
Handler: a.router, | |
} | |
done := make(chan bool, 1) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder