Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions 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"
"strings"
"time"
)

Expand Down Expand Up @@ -81,6 +82,13 @@ type GitMaterial struct {
FilterPattern []string `json:"filterPattern"`
}

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

type CiMaterial struct {
Source *SourceTypeConfig `json:"source,omitempty" validate:"dive,required"` //branch for ci
Path string `json:"path,omitempty"` // defaults to root of git repo
Expand Down
2 changes: 2 additions & 0 deletions pkg/pipeline/CiCdPipelineOrchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ func (impl CiCdPipelineOrchestratorImpl) CreateMaterials(createMaterialRequest *
}
var materials []*bean.GitMaterial
for _, inputMaterial := range createMaterialRequest.Material {
inputMaterial.UpdateSanitisedGitRepoUrl()
m, err := impl.createMaterial(inputMaterial, createMaterialRequest.AppId, createMaterialRequest.UserId)
inputMaterial.Id = m.Id
if err != nil {
Expand Down Expand Up @@ -1481,6 +1482,7 @@ func (impl CiCdPipelineOrchestratorImpl) updateMaterial(updateMaterialDTO *bean.
impl.logger.Errorw("validation err", "err", err)
return nil, validationErr
}
updateMaterialDTO.Material.UpdateSanitisedGitRepoUrl()
currentMaterial.Url = updateMaterialDTO.Material.Url
basePath := path.Base(updateMaterialDTO.Material.Url)
basePath = strings.TrimSuffix(basePath, ".git")
Expand Down