Skip to content

Commit

Permalink
Fix AppSet Webhook for gitlab merge requests
Browse files Browse the repository at this point in the history
Signed-off-by: Syst3m1An0maly <[email protected]>
  • Loading branch information
Syst3m1cAn0maly committed Jul 3, 2023
1 parent 0c5cf1c commit 511c5d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions applicationset/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"net/http"
"net/url"
"regexp"
"strconv"
"strings"

"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -226,7 +225,7 @@ func getPRGeneratorInfo(payload interface{}) *prGeneratorInfo {
}

info.Gitlab = &prGeneratorGitlabInfo{
Project: strconv.FormatInt(payload.ObjectAttributes.TargetProjectID, 10),
Project: payload.Project.PathWithNamespace,
APIHostname: urlObj.Hostname(),
}
default:
Expand Down
6 changes: 3 additions & 3 deletions applicationset/webhook/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestWebhookHandler(t *testing.T) {
fakeAppWithGitGenerator("git-github", namespace, "https://github.com/org/repo"),
fakeAppWithGitGenerator("git-gitlab", namespace, "https://gitlab/group/name"),
fakeAppWithGithubPullRequestGenerator("pull-request-github", namespace, "Codertocat", "Hello-World"),
fakeAppWithGitlabPullRequestGenerator("pull-request-gitlab", namespace, "100500"),
fakeAppWithGitlabPullRequestGenerator("pull-request-gitlab", namespace, "group/name"),
fakeAppWithPluginGenerator("plugin", namespace),
fakeAppWithMatrixAndGitGenerator("matrix-git-github", namespace, "https://github.com/org/repo"),
fakeAppWithMatrixAndPullRequestGenerator("matrix-pull-request-github", namespace, "Codertocat", "Hello-World"),
Expand Down Expand Up @@ -296,7 +296,7 @@ func fakeAppWithGitGenerator(name, namespace, repo string) *v1alpha1.Application
}
}

func fakeAppWithGitlabPullRequestGenerator(name, namespace, projectId string) *v1alpha1.ApplicationSet {
func fakeAppWithGitlabPullRequestGenerator(name, namespace, projectNameWithNamespace string) *v1alpha1.ApplicationSet {
return &v1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand All @@ -307,7 +307,7 @@ func fakeAppWithGitlabPullRequestGenerator(name, namespace, projectId string) *v
{
PullRequest: &v1alpha1.PullRequestGenerator{
GitLab: &v1alpha1.PullRequestGeneratorGitLab{
Project: projectId,
Project: projectNameWithNamespace,
},
},
},
Expand Down

0 comments on commit 511c5d9

Please sign in to comment.