ソースを参照

GithubActions: remove WebhookToken field

note: secret will not be deleted for existing deployments
Anukul Sangwan 4 年 前
コミット
87c415c9e1

+ 6 - 22
internal/integrations/ci/actions/actions.go

@@ -32,12 +32,11 @@ type GithubActions struct {
 	GithubAppSecretPath  string
 	GithubInstallationID uint
 
-	WebhookToken string
-	PorterToken  string
-	BuildEnv     map[string]string
-	ProjectID    uint
-	ClusterID    uint
-	ReleaseName  string
+	PorterToken string
+	BuildEnv    map[string]string
+	ProjectID   uint
+	ClusterID   uint
+	ReleaseName string
 
 	GitBranch      string
 	DockerFilePath string
@@ -101,17 +100,8 @@ func (g *GithubActions) Cleanup() error {
 
 	g.defaultBranch = repo.GetDefaultBranch()
 
-	// delete the webhook token secret
-	err = g.deleteGithubSecret(client, g.getWebhookSecretName())
-
-	if err != nil {
-		return err
-	}
-
 	// delete the env secret
-	err = g.deleteGithubSecret(client, g.getBuildEnvSecretName())
-
-	if err != nil {
+	if err := g.deleteGithubSecret(client, g.getBuildEnvSecretName()); err != nil {
 		return err
 	}
 
@@ -304,12 +294,6 @@ func (g *GithubActions) createEnvSecret(client *github.Client) error {
 	return g.createGithubSecret(client, secretName, strings.Join(lines, "\n"))
 }
 
-func (g *GithubActions) getWebhookSecretName() string {
-	return fmt.Sprintf("WEBHOOK_%s", strings.Replace(
-		strings.ToUpper(g.ReleaseName), "-", "_", -1),
-	)
-}
-
 func (g *GithubActions) getBuildEnvSecretName() string {
 	return fmt.Sprintf("ENV_%s", strings.Replace(
 		strings.ToUpper(g.ReleaseName), "-", "_", -1),

+ 0 - 1
server/api/deploy_handler.go

@@ -381,7 +381,6 @@ func (app *App) HandleUninstallTemplate(w http.ResponseWriter, r *http.Request)
 					GitRepoOwner:           repoSplit[0],
 					Repo:                   *app.Repo,
 					GithubConf:             app.GithubProjectConf,
-					WebhookToken:           release.WebhookToken,
 					ProjectID:              uint(projID),
 					ReleaseName:            name,
 					GitBranch:              gitAction.GitBranch,

+ 0 - 1
server/api/git_action_handler.go

@@ -165,7 +165,6 @@ func (app *App) createGitActionFromForm(
 		GitRepoOwner:           repoSplit[0],
 		Repo:                   *app.Repo,
 		GithubConf:             app.GithubProjectConf,
-		WebhookToken:           release.WebhookToken,
 		ProjectID:              uint(projID),
 		ReleaseName:            name,
 		GitBranch:              gitAction.GitBranch,

+ 0 - 2
server/api/release_handler.go

@@ -1117,7 +1117,6 @@ func (app *App) HandleUpgradeRelease(w http.ResponseWriter, r *http.Request) {
 					GitRepoOwner:           repoSplit[0],
 					Repo:                   *app.Repo,
 					GithubConf:             app.GithubProjectConf,
-					WebhookToken:           release.WebhookToken,
 					ProjectID:              uint(projID),
 					ReleaseName:            name,
 					GitBranch:              gitAction.GitBranch,
@@ -1536,7 +1535,6 @@ func (app *App) HandleRollbackRelease(w http.ResponseWriter, r *http.Request) {
 					GitRepoOwner:           repoSplit[0],
 					Repo:                   *app.Repo,
 					GithubConf:             app.GithubProjectConf,
-					WebhookToken:           release.WebhookToken,
 					ProjectID:              uint(projID),
 					ReleaseName:            name,
 					GitBranch:              gitAction.GitBranch,