Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #223 from fluxcd/reject-git-source
Browse files Browse the repository at this point in the history
Reject git source if URL and path are missing
  • Loading branch information
stefanprodan authored Jan 20, 2020
2 parents 1f11551 + 8328139 commit ddd8ed7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions pkg/chartsync/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,25 @@ func (c sourceRef) forHelmRelease(hr *v1.HelmRelease) bool {
if hr == nil || hr.Spec.GitChartSource == nil {
return false
}

// reject git source if URL and path are missing
if hr.Spec.GitURL == "" || hr.Spec.Path == "" {
return false
}

return c.mirror == mirrorName(hr) && c.remote == hr.Spec.GitURL && c.ref == hr.Spec.Ref
}

func NewGitChartSync(logger log.Logger,
lister lister.HelmReleaseLister, cfg GitConfig, queue ReleaseQueue) *GitChartSync {

return &GitChartSync{
logger: logger,
config: cfg,

lister: lister,

logger: logger,
config: cfg,
lister: lister,
mirrors: git.NewMirrors(),
releaseSourcesByID: make(map[string]sourceRef),

releaseQueue: queue,
releaseQueue: queue,
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (r *Release) Sync(client helm.Client, hr *v1.HelmRelease) (rHr *v1.HelmRele
// to the chart, and record the revision.
var chartPath, revision string
switch {
case hr.Spec.GitChartSource != nil:
case hr.Spec.GitChartSource != nil && hr.Spec.GitURL != "" && hr.Spec.Path != "":
var export *git.Export
var err error

Expand Down

0 comments on commit ddd8ed7

Please sign in to comment.