mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-07 08:44:50 +00:00
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: crenshaw-dev <[email protected]>
64 lines
1.3 KiB
Go
64 lines
1.3 KiB
Go
package shared
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
|
|
|
|
"github.com/argoproj/argo-cd/v3/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
|
|
}
|