Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: trim space from git repo Url on create and update material #4787

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove trailing and leading spaces from url on create and update mate…
…rial
  • Loading branch information
Shivam-nagar23 committed Mar 13, 2024
commit df74dd1720c9d0ac1e8fbc975b8344a628b0cb32
4 changes: 3 additions & 1 deletion pkg/bean/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
bean3 "github.com/devtron-labs/devtron/pkg/deployment/trigger/devtronApps/bean"
"github.com/devtron-labs/devtron/pkg/pipeline/bean"
"github.com/devtron-labs/devtron/pkg/pipeline/repository"
"github.com/devtron-labs/devtron/pkg/util"
"strings"
"time"
)
Expand Down Expand Up @@ -82,11 +83,12 @@ type GitMaterial struct {
FilterPattern []string `json:"filterPattern"`
}

// UpdateSanitisedGitRepoUrl will remove all trailing slashes from git repository url
// UpdateSanitisedGitRepoUrl will remove all trailing slashes , leading and trailing spaces from git repository url
func (m *GitMaterial) UpdateSanitisedGitRepoUrl() {
for strings.HasSuffix(m.Url, "/") {
m.Url = strings.TrimSuffix(m.Url, "/")
}
m.Url = util.RemoveTrailingAndLeadingSpaces(m.Url)
}

type CiMaterial struct {
Expand Down
3 changes: 1 addition & 2 deletions pkg/pipeline/CiService.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/devtron-labs/devtron/pkg/infraConfig"
"github.com/devtron-labs/devtron/pkg/pipeline/adapter"
"github.com/devtron-labs/devtron/pkg/pipeline/infraProviders"
util4 "github.com/devtron-labs/devtron/pkg/util"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -405,7 +404,7 @@ func (impl *CiServiceImpl) buildWfRequestForCiPipeline(pipeline *pipelineConfig.
}
commitHashForPipelineId := commitHashes[ciMaterial.Id]
ciProjectDetail := pipelineConfigBean.CiProjectDetails{
GitRepository: util4.RemoveTrailingAndLeadingSpaces(ciMaterial.GitMaterial.Url),
GitRepository: ciMaterial.GitMaterial.Url,
MaterialName: ciMaterial.GitMaterial.Name,
CheckoutPath: ciMaterial.GitMaterial.CheckoutPath,
FetchSubmodules: ciMaterial.GitMaterial.FetchSubmodules,
Expand Down
Loading