Skip to content

Conversation

pasha-codefresh
Copy link
Member

@pasha-codefresh pasha-codefresh commented Oct 7, 2021

Closes: #7198

Signed-off-by: pashavictorovich <pavel@codefresh.io>
Signed-off-by: pashavictorovich <pavel@codefresh.io>
Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one comment in app_project_types.go.

Do we really need changes in util/argo/argo.go, util/argo/cluster.go, util/db/cluster.go. Probably we can just revert them or I'm missing something?

@@ -354,7 +354,7 @@ func (proj AppProject) IsSourcePermitted(src ApplicationSource) bool {
// IsDestinationPermitted validates if the provided application's destination is one of the allowed destinations for the project
func (proj AppProject) IsDestinationPermitted(dst ApplicationDestination) bool {
for _, item := range proj.Spec.Destinations {
if globMatch(item.Server, dst.Server) && globMatch(item.Namespace, dst.Namespace) {
if (globMatch(item.Server, dst.Server) || globMatch(item.Server, dst.Name)) && globMatch(item.Namespace, dst.Namespace) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cluster name should be compared with the name in the destination. I think this should work:

Suggested change
if (globMatch(item.Server, dst.Server) || globMatch(item.Server, dst.Name)) && globMatch(item.Namespace, dst.Namespace) {
if (globMatch(item.Server, dst.Server) || globMatch(item.Name, dst.Name)) && globMatch(item.Namespace, dst.Namespace) {

Signed-off-by: pashavictorovich <pavel@codefresh.io>
Signed-off-by: pashavictorovich <pavel@codefresh.io>
@codecov
Copy link

codecov bot commented Oct 10, 2021

Codecov Report

Merging #7394 (6978a8f) into master (b073621) will increase coverage by 0.09%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7394      +/-   ##
==========================================
+ Coverage   41.24%   41.33%   +0.09%     
==========================================
  Files         161      161              
  Lines       21525    21583      +58     
==========================================
+ Hits         8878     8922      +44     
- Misses      11384    11400      +16     
+ Partials     1263     1261       -2     
Impacted Files Coverage Δ
controller/appcontroller.go 53.30% <ø> (ø)
controller/state.go 68.02% <0.00%> (ø)
controller/sync.go 62.93% <0.00%> (ø)
pkg/apis/application/v1alpha1/app_project_types.go 52.10% <75.00%> (+0.50%) ⬆️
util/env/env.go 61.53% <0.00%> (-22.68%) ⬇️
server/application/application.go 32.29% <0.00%> (-0.04%) ⬇️
util/settings/settings.go 46.77% <0.00%> (ø)
util/git/client.go 44.74% <0.00%> (+0.18%) ⬆️
controller/metrics/metrics.go 79.86% <0.00%> (+3.43%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b073621...6978a8f. Read the comment docs.

Signed-off-by: pashavictorovich <pavel@codefresh.io>
Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexmt alexmt merged commit ddc9f56 into argoproj:master Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project destination using cluster name does not work
2 participants