Skip to content

Commit

Permalink
Proper webhook installation detection (#20240)
Browse files Browse the repository at this point in the history
* Proper webhook installed detection

* fix webhook detection

* debug: enable webhook on newly enabled prebuilds

* Add a comment about the arbitrary last 50 events

* Remove unused `GetConfigurationWebhookActivityStatus`

* update fn comment

* Delete superflous log

* fix debugging webhooks

* remove unused webhook-hooks

* Revert "debug: enable webhook on newly enabled prebuilds"

This reverts commit 5cfebd8.
  • Loading branch information
filiptronicek authored Sep 25, 2024
1 parent c83c8e3 commit d1e314b
Show file tree
Hide file tree
Showing 24 changed files with 427 additions and 2,696 deletions.
19 changes: 1 addition & 18 deletions components/dashboard/src/data/prebuilds/prebuild-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
*/

import { useMutation, useQuery } from "@tanstack/react-query";
import { configurationClient, prebuildClient, stream } from "../../service/public-api";
import { prebuildClient, stream } from "../../service/public-api";
import { Prebuild, PrebuildPhase_Phase } from "@gitpod/public-api/lib/gitpod/v1/prebuild_pb";
import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
import { PlainMessage, toPlainMessage } from "@bufbuild/protobuf";
import { GetConfigurationWebhookActivityStatusResponse } from "@gitpod/public-api/lib/gitpod/v1/configuration_pb";

export function usePrebuildQuery(prebuildId: string) {
return useQuery<Prebuild, Error>(
Expand Down Expand Up @@ -77,18 +75,3 @@ export function useTriggerPrebuildMutation(configurationId?: string, gitRef?: st
},
});
}

export function useWebhookActivityStatusQuery(configurationId: string) {
return useQuery<PlainMessage<GetConfigurationWebhookActivityStatusResponse>, Error>(
["webhookActivityStatus", configurationId],
async () => {
const resp = await configurationClient.getConfigurationWebhookActivityStatus({ configurationId });
return toPlainMessage(resp);
},
{
retry: false,
staleTime: 1000 * 60, // 1 minute
cacheTime: 1000 * 60 * 15, // 15 minutes
},
);
}
4 changes: 4 additions & 0 deletions components/gitpod-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,10 @@ export interface Repository {
// The direct parent of this fork
parent: Repository;
};
/**
* Optional date when the repository was last pushed to.
*/
pushedAt?: string;
}

export interface RepositoryInfo {
Expand Down
20 changes: 0 additions & 20 deletions components/public-api/gitpod/v1/configuration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ service ConfigurationService {

// Deletes a configuration.
rpc DeleteConfiguration(DeleteConfigurationRequest) returns (DeleteConfigurationResponse) {}

// GetConfigurationWebhookActivityStatus returns the observed status of installed prebuild webhooks on the configuration
rpc GetConfigurationWebhookActivityStatus(GetConfigurationWebhookActivityStatusRequest) returns (GetConfigurationWebhookActivityStatusResponse) {}
}

message CreateConfigurationRequest {
Expand Down Expand Up @@ -150,20 +147,3 @@ message DeleteConfigurationRequest {
}

message DeleteConfigurationResponse {}

message GetConfigurationWebhookActivityStatusRequest {
string configuration_id = 1;
}

message GetConfigurationWebhookActivityStatusResponse {
message WebhookEvent {
string commit = 1;
google.protobuf.Timestamp creation_time = 2;
}

// is_webhook_active determines whether the webhook is active or not for the configuration.
bool is_webhook_active = 1;

// latest_webhook_event is the latest event that was observed by the webhook. Only set if is_webhook_active is true.
WebhookEvent latest_webhook_event = 2;
}
461 changes: 112 additions & 349 deletions components/public-api/go/v1/configuration.pb.go

Large diffs are not rendered by default.

38 changes: 0 additions & 38 deletions components/public-api/go/v1/configuration_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 5 additions & 30 deletions components/public-api/go/v1/v1connect/configuration.connect.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d1e314b

Please sign in to comment.