argoapplication

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplicationsToString

func ApplicationsToString(apps []ArgoResource) string

ApplicationsToString converts a slice of ArgoResource to a YAML string

func ConvertAppSetsToAppsInBothBranches

func ConvertAppSetsToAppsInBothBranches(
	argocd *argocd.ArgoCDInstallation,
	baseApps *ArgoSelection,
	targetApps *ArgoSelection,
	baseBranch *git.Branch,
	targetBranch *git.Branch,
	repo string,
	tempFolder string,
	redirectRevisions []string,
	debug bool,
	failOnDuplicateGeneratedApplications bool,
	appSelectionOptions ApplicationSelectionOptions,
) (*ArgoSelection, *ArgoSelection, time.Duration, error)

func GetApplicationStatus added in v0.1.22

func GetApplicationStatus(argocd *argocd.ArgoCDInstallation, app ArgoResource) (reconciled bool, isMarkedForRefresh bool, argoErrMessage error, internalError error, err error)

GetApplicationStatus returns the error status of an application

func GetApplicationsForBranches

func GetApplicationsForBranches(
	argocdNamespace string,
	baseBranch *git.Branch,
	targetBranch *git.Branch,
	appSelectionOptions ApplicationSelectionOptions,
	repo string,
	redirectRevisions []string,
) (*ArgoSelection, *ArgoSelection, error)

GetApplicationsForBranches gets applications for both base and target branches

Types

type AppSetConversionResult added in v0.1.20

type AppSetConversionResult struct {
	// contains filtered or unexported fields
}

type ApplicationKind

type ApplicationKind int

ApplicationKind represents the type of Argo CD application

const (
	Application ApplicationKind = iota
	ApplicationSet
)

func (ApplicationKind) ShortName

func (k ApplicationKind) ShortName() string

ShortName returns the string representation of ApplicationKind

type ApplicationSelectionOptions added in v0.1.20

type ApplicationSelectionOptions struct {
	FileRegex                  *regexp.Regexp
	Selector                   []app_selector.Selector
	FilesChanged               []string
	IgnoreInvalidWatchPattern  bool
	WatchIfNoWatchPatternFound bool
}

func (ApplicationSelectionOptions) LogRules added in v0.1.20

func (appSelectionOptions ApplicationSelectionOptions) LogRules()

type ArgoResource

type ArgoResource struct {
	Yaml     *unstructured.Unstructured
	Kind     ApplicationKind
	Id       string // The ID is the name of the k8s resource
	Name     string // The name is the original name of the Application
	FileName string
	Branch   git.BranchType
}

ArgoResource represents an Argo CD Application or ApplicationSet

func FromResourceToApplication

func FromResourceToApplication(
	k8sResources []fileparsing.Resource,
) []ArgoResource

FromResourceToApplication converts K8sResources to ArgoResources with filtering

func NewArgoResource added in v0.1.11

func NewArgoResource(yaml *unstructured.Unstructured, kind ApplicationKind, id string, name string, fileName string, branch git.BranchType) *ArgoResource

NewArgoResource creates a new ArgoResource

func PatchApplication

func PatchApplication(
	argocdNamespace string,
	app ArgoResource,
	branch *git.Branch,
	repo string,
	redirectRevisions []string,
) (*ArgoResource, error)

PatchApplication patches a single ArgoResource

func UniqueIds

func UniqueIds(apps []ArgoResource, branch *git.Branch) []ArgoResource

UniqueIds ensures all applications have unique IDs by adding suffixes to duplicates

func (*ArgoResource) AsString

func (a *ArgoResource) AsString() (string, error)

AsString returns the YAML representation of the resource

func (*ArgoResource) Filter

func (a *ArgoResource) Filter(
	appSelectionOptions ApplicationSelectionOptions,
) bool

Filter checks if the application matches the given selectors and watches the given files

func (*ArgoResource) GetLongName

func (a *ArgoResource) GetLongName() string

func (*ArgoResource) GetRenderMode added in v0.2.5

func (a *ArgoResource) GetRenderMode() RenderMode

GetRenderMode returns the render mode for the application based on annotations

func (*ArgoResource) RedirectGenerators

func (a *ArgoResource) RedirectGenerators(repo, branch string, redirectRevisions []string) error

RedirectGenerators updates the git generator targetRevision to point to the specified branch

func (*ArgoResource) RedirectSourceHydrator added in v0.1.26

func (a *ArgoResource) RedirectSourceHydrator(repo, branch string, redirectRevisions []string) error

RedirectSourceHydrator converts sourceHydrator applications to regular applications. It moves spec.sourceHydrator.drySource to spec.source and removes the sourceHydrator field. This allows argocd-diff-preview to render manifests from the dry source directly. See: https://argo-cd.readthedocs.io/en/stable/user-guide/source-hydrator/

func (*ArgoResource) RedirectSources

func (a *ArgoResource) RedirectSources(repo, branch string, redirectRevisions []string) error

RedirectSources updates the source/sources targetRevision to point to the specified branch

func (*ArgoResource) RemoveArgoCDFinalizers added in v0.1.8

func (a *ArgoResource) RemoveArgoCDFinalizers() error

RemoveArgoCDFinalizers removes Argo CD finalizers that can block deleting preview applications

func (*ArgoResource) RemoveSyncPolicy

func (a *ArgoResource) RemoveSyncPolicy() error

RemoveSyncPolicy removes the syncPolicy from the resource

func (*ArgoResource) SetDestinationServerToLocal added in v0.1.20

func (a *ArgoResource) SetDestinationServerToLocal() error

SetDestinationServerToLocal updates the destination to point to the in-cluster service

func (*ArgoResource) SetHelmReleaseNameIfUnset added in v0.2.5

func (a *ArgoResource) SetHelmReleaseNameIfUnset() error

SetHelmReleaseNameIfUnset ensures Helm chart sources use a stable releaseName.

Argo CD defaults Helm releaseName to Application metadata.name when unset. argocd-diff-preview prefixes Application names at render time to isolate base and target runs, which can leak into chart resource names and create false-positive diffs when names are truncated. Setting releaseName to the original app name keeps Helm naming stable across branches.

This only applies to Application resources and only for Helm chart sources (source.chart or sources[].chart). Existing releaseName values are preserved.

func (*ArgoResource) SetNamespace

func (a *ArgoResource) SetNamespace(namespace string)

SetNamespace sets the namespace of the resource

func (*ArgoResource) SetProjectToDefault

func (a *ArgoResource) SetProjectToDefault() error

SetProjectToDefault sets the project to "default"

func (*ArgoResource) WriteToFolder added in v0.1.13

func (a *ArgoResource) WriteToFolder(folder string) (string, error)

Write to file and return filename

type ArgoSelection added in v0.1.20

type ArgoSelection struct {
	SelectedApps []ArgoResource
	SkippedApps  []ArgoResource
}

func ApplicationSelection added in v0.1.20

func ApplicationSelection(
	apps []ArgoResource,
	appSelectionOptions ApplicationSelectionOptions,
) *ArgoSelection

type RenderMode added in v0.2.5

type RenderMode string

RenderMode controls whether an application should be rendered

const (
	// RenderAlways means the application is always rendered, even if identical between branches
	RenderAlways RenderMode = "always"
	// RenderNever means the application is never rendered (same as ignore: true)
	RenderNever RenderMode = "never"
	// RenderChanged means the application is only rendered if it changed between branches (default)
	RenderChanged RenderMode = "changed"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL