You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/05/16 04:05:07 UTC

(incubator-devlake) 01/02: feat(webhook): add display_title in payload

This is an automated email from the ASF dual-hosted git repository.

lynwee pushed a commit to branch dev-multi-env
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 65670c4bd2073a33842c29752d0940298e95ee13
Author: d4x1 <15...@qq.com>
AuthorDate: Thu May 16 11:47:36 2024 +0800

    feat(webhook): add display_title in payload
---
 backend/plugins/webhook/api/deployments.go | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/backend/plugins/webhook/api/deployments.go b/backend/plugins/webhook/api/deployments.go
index 64b9e91e5..f39814c82 100644
--- a/backend/plugins/webhook/api/deployments.go
+++ b/backend/plugins/webhook/api/deployments.go
@@ -36,7 +36,8 @@ import (
 )
 
 type WebhookDeployTaskRequest struct {
-	PipelineId string `mapstructure:"pipeline_id"`
+	DisplayTitle string `mapstructure:"display_title"`
+	PipelineId   string `mapstructure:"pipeline_id"`
 	// RepoUrl should be unique string, fill url or other unique data
 	RepoId string `mapstructure:"repo_id"`
 	Result string `mapstructure:"result"`
@@ -58,11 +59,12 @@ type WebhookDeployTaskRequest struct {
 }
 
 type DeploymentCommit struct {
-	RepoUrl   string `mapstructure:"repo_url" validate:"required"`
-	Name      string `mapstructure:"name"`
-	RefName   string `mapstructure:"ref_name"`
-	CommitSha string `mapstructure:"commit_sha" validate:"required"`
-	CommitMsg string `mapstructure:"commit_msg"`
+	DisplayTitle string `mapstructure:"display_title"`
+	RepoUrl      string `mapstructure:"repo_url" validate:"required"`
+	Name         string `mapstructure:"name"`
+	RefName      string `mapstructure:"ref_name"`
+	CommitSha    string `mapstructure:"commit_sha" validate:"required"`
+	CommitMsg    string `mapstructure:"commit_msg"`
 }
 
 // PostDeploymentCicdTask
@@ -158,6 +160,7 @@ func PostDeploymentCicdTask(input *plugin.ApiResourceInput) (*plugin.ApiResource
 			CicdDeploymentId: pipelineId,
 			CicdScopeId:      scopeId,
 			Name:             name,
+			DisplayTitle:     request.DisplayTitle,
 			Result:           request.Result,
 			Status:           devops.STATUS_DONE,
 			OriginalResult:   request.Result,
@@ -207,6 +210,7 @@ func PostDeploymentCicdTask(input *plugin.ApiResourceInput) (*plugin.ApiResource
 				//QueuedDurationSec: queuedDuration,
 				RepoId:              request.RepoId,
 				Name:                fmt.Sprintf(`deployment for %s`, commit.CommitSha),
+				DisplayTitle:        commit.DisplayTitle,
 				RepoUrl:             commit.RepoUrl,
 				Environment:         request.Environment,
 				OriginalEnvironment: request.Environment,