This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 1876b43c7 Update deployment commit id (#7479)
1876b43c7 is described below
commit 1876b43c7cf7edf251acfaacb5a087b0b65bfe0b
Author: Lynwee <[email protected]>
AuthorDate: Fri May 17 11:12:43 2024 +0800
Update deployment commit id (#7479)
* fix(apikey): abort request if api key doesn't match
* feat(webhook): update deployment commit id
---
backend/plugins/webhook/api/deployments.go | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/backend/plugins/webhook/api/deployments.go
b/backend/plugins/webhook/api/deployments.go
index 47ff8e9b9..f49591bb3 100644
--- a/backend/plugins/webhook/api/deployments.go
+++ b/backend/plugins/webhook/api/deployments.go
@@ -69,9 +69,9 @@ type DeploymentCommit struct {
CommitMsg string `mapstructure:"commit_msg"`
}
-func generateDeploymentCommitId(connectionId uint64, repoUrl string, commitSha
string) string {
+func GenerateDeploymentCommitId(connectionId uint64, pipelineId string,
repoUrl string, commitSha string) string {
urlHash16 := fmt.Sprintf("%x", md5.Sum([]byte(repoUrl)))[:16]
- return fmt.Sprintf("%s:%d:%s:%s", "webhook", connectionId, urlHash16,
commitSha)
+ return fmt.Sprintf("%s:%d:%s:%s:%s", "webhook", connectionId,
pipelineId, urlHash16, commitSha)
}
func CreateDeploymentAndDeploymentCommits(connection
*models.WebhookConnection, request *WebhookDeployTaskRequest, tx
dal.Transaction, logger log.Logger) errors.Error {
@@ -122,7 +122,7 @@ func CreateDeploymentAndDeploymentCommits(connection
*models.WebhookConnection,
// create a deployment_commit record
deploymentCommit := &devops.CicdDeploymentCommit{
DomainEntity: domainlayer.DomainEntity{
- Id: generateDeploymentCommitId(connection.ID,
request.RepoUrl, request.CommitSha),
+ Id: GenerateDeploymentCommitId(connection.ID,
request.PipelineId, request.RepoUrl, request.CommitSha),
},
CicdDeploymentId: request.PipelineId,
CicdScopeId: scopeId,
@@ -157,7 +157,7 @@ func CreateDeploymentAndDeploymentCommits(connection
*models.WebhookConnection,
// create a deployment_commit record
deploymentCommit := &devops.CicdDeploymentCommit{
DomainEntity: domainlayer.DomainEntity{
- Id:
generateDeploymentCommitId(connection.ID, commit.RepoUrl, commit.CommitSha),
+ Id:
GenerateDeploymentCommitId(connection.ID, request.PipelineId, commit.RepoUrl,
commit.CommitSha),
},
CicdDeploymentId: request.PipelineId,
CicdScopeId: scopeId,