Files
argo-cd/util/notification/expression/shared/appdetail.go
Matthieu MOREL 9f1e2e8453 chore: enable gocritic linter (#18633)
* chore: enable gocritic linter

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update settings.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update app.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update grpcproxy.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update grpcproxy.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update util.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update server.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update app_management_ns_test.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update app_management_test.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update path_traversal.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update sessionmanager.go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update .golangci.yaml

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-06-13 15:10:00 -04:00

64 lines
1.3 KiB
Go

package shared
import (
"time"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v2/reposerver/apiclient"
)
type CommitMetadata struct {
// Commit message
Message string
// Commit author
Author string
// Commit creation date
Date time.Time
// Associated tags
Tags []string
}
type AppDetail struct {
// AppDetail Type
Type string
// Helm details
Helm *CustomHelmAppSpec
// Kustomize details
Kustomize *apiclient.KustomizeAppSpec
// Directory details
Directory *apiclient.DirectoryAppSpec
}
type CustomHelmAppSpec struct {
HelmAppSpec apiclient.HelmAppSpec
HelmParameterOverrides []v1alpha1.HelmParameter
}
func (has CustomHelmAppSpec) GetParameterValueByName(name string) string {
// Check in overrides first
for i := range has.HelmParameterOverrides {
if has.HelmParameterOverrides[i].Name == name {
return has.HelmParameterOverrides[i].Value
}
}
for i := range has.HelmAppSpec.Parameters {
if has.HelmAppSpec.Parameters[i].Name == name {
return has.HelmAppSpec.Parameters[i].Value
}
}
return ""
}
func (has CustomHelmAppSpec) GetFileParameterPathByName(name string) string {
var path string
for i := range has.HelmAppSpec.FileParameters {
if has.HelmAppSpec.FileParameters[i].Name == name {
path = has.HelmAppSpec.FileParameters[i].Path
break
}
}
return path
}