From b2bd6ded7980a1650b6d46b49966023789c21067 Mon Sep 17 00:00:00 2001 From: Hannes Gustafsson Date: Mon, 28 Oct 2024 15:38:02 +0000 Subject: [PATCH] Remove dead code --- internal/pkg/githubapi/clients.go | 6 ------ internal/pkg/githubapi/github.go | 23 ----------------------- 2 files changed, 29 deletions(-) diff --git a/internal/pkg/githubapi/clients.go b/internal/pkg/githubapi/clients.go index a0bb9cbd..33f2ea30 100644 --- a/internal/pkg/githubapi/clients.go +++ b/internal/pkg/githubapi/clients.go @@ -132,7 +132,6 @@ func createGithubGraphQlClient(githubOauthToken string, githubGraphqlAltURL stri } func createGhAppClientPair(ctx context.Context, githubAppId int64, owner string, ghAppPKeyPathEnvVarName string) GhClientPair { - // var ghClientPair *GhClientPair var githubRestAltURL string var githubGraphqlAltURL string githubAppPrivateKeyPath := getCrucialEnv(ghAppPKeyPathEnvVarName) @@ -151,8 +150,6 @@ func createGhAppClientPair(ctx context.Context, githubAppId int64, owner string, log.Errorf("Couldn't find installation for app ID %v and repo owner %s", githubAppId, owner) } - // ghClientPair.v3Client := createGithubAppRestClient(githubAppPrivateKeyPath, githubAppId, githubAppInstallationId, githubRestAltURL, ctx) - // ghClientPair.v4Client := createGithubAppGraphQlClient(githubAppPrivateKeyPath, githubAppId, githubAppInstallationId, githubGraphqlAltURL, githubRestAltURL, ctx) return GhClientPair{ v3Client: createGithubAppRestClient(githubAppPrivateKeyPath, githubAppId, githubAppInstallationId, githubRestAltURL, ctx), v4Client: createGithubAppGraphQlClient(githubAppPrivateKeyPath, githubAppId, githubAppInstallationId, githubGraphqlAltURL, githubRestAltURL, ctx), @@ -160,7 +157,6 @@ func createGhAppClientPair(ctx context.Context, githubAppId int64, owner string, } func createGhTokenClientPair(ctx context.Context, ghOauthToken string) GhClientPair { - // var ghClientPair *GhClientPair var githubRestAltURL string var githubGraphqlAltURL string githubHost := getEnv("GITHUB_HOST", "") @@ -173,8 +169,6 @@ func createGhTokenClientPair(ctx context.Context, ghOauthToken string) GhClientP log.Debugf("Using public Github API endpoint") } - // ghClientPair.v3Client := createGithubRestClient(ghOauthToken, githubRestAltURL, ctx) - // ghClientPair.v4Client := createGithubGraphQlClient(ghOauthToken, githubGraphqlAltURL) return GhClientPair{ v3Client: createGithubRestClient(ghOauthToken, githubRestAltURL, ctx), v4Client: createGithubGraphQlClient(ghOauthToken, githubGraphqlAltURL), diff --git a/internal/pkg/githubapi/github.go b/internal/pkg/githubapi/github.go index 5cb41596..1306ce97 100644 --- a/internal/pkg/githubapi/github.go +++ b/internal/pkg/githubapi/github.go @@ -75,11 +75,6 @@ func (pm prMetadata) serialize() (string, error) { if err != nil { return "", err } - // var compressedPmJson []byte - // _, err = lz4.CompressBlock(pmJson, compressedPmJson, nil) - // if err != nil { - // return "", err - // } return base64.StdEncoding.EncodeToString(pmJson), nil } @@ -625,7 +620,6 @@ func handleMergedPrEvent(ghPrClientDetails GhPrClientDetails, prApproverGithubCl // configBranch = default branch as the PR is closed at this and its branch deleted. // If we'l ever want to generate this plan on an unmerged PR the PR branch (ghPrClientDetails.Ref) should be used promotions, _ := GeneratePromotionPlan(ghPrClientDetails, config, defaultBranch) - // log.Infof("%+v", promotions) if !config.DryRunMode { for _, promotion := range promotions { // TODO this whole part shouldn't be in main, but I need to refactor some circular dep's @@ -791,10 +785,6 @@ func (pm *prMetadata) DeSerialize(s string) error { if err != nil { return err } - // _, err = lz4.UncompressBlock(decoded, unCompressedPmJson) - // if err != nil { - // return err - // } err = json.Unmarshal(decoded, pm) return err } @@ -1226,19 +1216,6 @@ func createPrObject(ghPrClientDetails GhPrClientDetails, newBranchRef string, ne ghPrClientDetails.PrLogger.Debugf(" %s was set as assignee on PR", assignee) } - // reviewers := github.ReviewersRequest{ - // Reviewers: []string{"SA-k8s-pr-approver-bot"}, // TODO remove hardcoding - // } - // - // _, resp, err = ghPrClientDetails.Ghclient.PullRequests.RequestReviewers(ghPrClientDetails.Ctx, ghPrClientDetails.Owner, ghPrClientDetails.Repo, *pull.Number, reviewers) - // prom.InstrumentGhCall(resp) - // if err != nil { - // ghPrClientDetails.PrLogger.Errorf("Could not set reviewer on pr: err=%s\n%v\n", err, resp) - // return pull, err - // } else { - // ghPrClientDetails.PrLogger.Debugf("PR reviewer set.\n%+v", reviewers) - // } - return pull, nil // TODO }