Files
41536738c8 refactor(cd): hard-fork - rename CRD API group argoproj.io -> deploy.hanzo.ai (#1)
* feat(api): hard-fork CRD API group argoproj.io -> deploy.hanzo.ai

Hanzo CD hard-fork, phase 1.1. Single source of truth is
pkg/apis/application/register.go's Group constant (Application/AppProject/
ApplicationSet all derive their FullName from it); every other Go call-site
that hardcoded the literal group string is updated to match: the 3 generated
informer GVRs, the app-of-apps nested-Application detector in types.go, the
resource-tree Application-kind cache populator, the 3 NotFound error
constructors in server/application, and the applicationset-controller's
leader-election Lease name/ID (kept in lockstep across Go source + RBAC
resourceNames, or leader election would get RBAC-denied on startup).

CRD YAMLs (application/appproject/applicationset) and every RBAC apiGroups
rule that actually governs our 3 CRDs are repointed to deploy.hanzo.ai, across
both manifests/base/* (namespaced Roles) and manifests/cluster-rbac/* (cluster
scope). Two adjacent things that share the "argoproj.io" string but are NOT
ours are deliberately left untouched: gitops-engine's health-check dispatch
for Argo Workflows' `Workflow` kind, and argocd-server-clusterrole's second
apiGroups block granting read on Argo Workflows' `workflows` resource — both
belong to a separate, unrelated Argoproj-family project we are not forking.

Also untouched, per explicit scope: annotation/label keys (argocd.argoproj.io/*)
and finalizers (*.argoproj.io) that track already-applied live resources, and
argocd-cm.yaml's resource.customizations.ignoreResourceUpdates keys (a narrow
app-of-apps diffing nicety, not build- or RBAC-relevant).

CGO_ENABLED=0 go build ./... verified green.

* ci: wire canonical hanzo.yml + cicd.yml (Hanzo CD image build)

Phase 1.3. Follows the same one-way pattern every hanzo/lux/zoo repo uses:
hanzo.yml declares the image (root Dockerfile -> ghcr.io/hanzoai/deploy) and a
fast go-build sanity test (the multi-stage Dockerfile build is the slow, real
gate); cicd.yml is the ~10-line trigger shim importing hanzoai/ci's reusable
build workflow on the arc pool, secrets from KMS only.

No `deploy:` block yet, matching the hanzoai/cms build-only-first-cutover
pattern: this repo's own live hanzo-cd namespace runs the whole Hanzo fleet's
GitOps, so the prod image/CRD swap is a deliberate separate action (see the
[HELD] universe PR), never an automatic rollout on merge. Every PR/push still
builds and pushes an immutable ghcr.io/hanzoai/deploy:sha-<7>-amd64 image.

* feat(ui): rebrand Argo CD -> Hanzo CD (title, favicon, logo, sidebar)

Phase 1.2. User-facing "Argo CD"/"ArgoCD" text replaced with "Hanzo CD"
across the login page, help modal, settings screens, version-info panel,
sync-options warning, fullscreen-logs title, app.tsx page titles, and
index.html's <title>/noscript text (dropped the now-wrong upstream CLI
doc link rather than invent a hanzo.ai URL that doesn't exist).

Logo/favicon assets replaced with the canonical Hanzo mark (never
hand-drawn, copied from ~/work/hanzo/logo/dist): the two real usages of
Argo's logo collapse onto one Hanzo glyph (mono + white variants) at the
same 5 call sites (login icon + footer, login.scss $logoPath/
$logoNegativePath, sidebar text-logo), preserving the existing CSS
invert() filters so both the light login panel and dark sidebar still
render correctly. Old argologo.svg/argo_o.svg/argo.png deleted (no
longer referenced). favicon-{16x16,32x32}.png added at
ui/src/assets/favicon/ (index.html's links to that path were previously
dead - the directory didn't exist in this checkout). package.json name
argo-cd-ui -> hanzo-cd-ui.

Left alone, deliberately: the two Kubernetes resource-kind icon sets
under ui/src/assets/images/resources/ (unrelated to branding), and
upstream doc/project links (argoproj.io, argo-cd.readthedocs.io) since
we have no equivalent hanzo.ai docs to point to yet - except the login
footer logo's outbound link, which now points to hanzo.ai instead of
argoproj.io (a Hanzo-branded mark linking to the upstream project it
was forked from read as an obvious leftover).

* feat(module): rename Go module github.com/argoproj/argo-cd/v3 -> github.com/hanzoai/deploy

Phase 2. No version suffix on the new path (org policy: never publish our
own Go modules above v1.x.x / with a v2+ suffix) — this fork starts a fresh
v0/v1 module identity rather than carrying the v3 the upstream fork point
had reached.

Mechanical, symmetric rewrite: 704 .go files (import statements only; two
disjoint substitutions applied specific-first so the nested gitops-engine
module path never double-matches), plus go.mod (module line, the
gitops-engine require+replace pair, version reset to v0.0.0-... since a
suffix-less path can't carry a v3 semver), gitops-engine/go.mod, Makefile
(ldflags PACKAGE + 2 TEST_MODULE filters), .golangci.yaml, .goreleaser.yaml,
.mockery.yaml (+ gitops-engine's), Procfile, the codegen/proto generation
scripts (hack/generate-proto.sh, update-codegen.sh, update-openapi.sh), and
20 .proto files' go_package options. Also one OpenTelemetry tracer name
string in gitops-engine/pkg/sync/sync_context.go (a cosmestic label, not an
import, but worth keeping consistent).

CGO_ENABLED=0 go build ./... verified green for both the root module and
the nested gitops-engine module; go vet clean on both; go mod tidy run
(network available) to reconcile go.sum, dependency set unchanged.

Left alone, deliberately: doc-only mentions (docs/snyk/*.html scan reports,
gitops-engine/README.md), a comment-only reference in
.github/workflows/release.yaml, and one Renovate bot config line — none are
build- or codegen-load-bearing. Also left alone: comments citing upstream
GitHub issue URLs (github.com/argoproj/argo-cd/issues/NNNNN) and a handful
of test fixtures using "https://github.com/argoproj/argo-cd.git" as a
representative example repo URL — both are accurate historical/test-data
references, not stale self-references.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-29 18:27:58 -07:00

697 lines
20 KiB
Go

package e2e
import (
"fmt"
"net"
"net/http"
"os"
"strings"
"testing"
"github.com/hanzoai/deploy/gitops-engine/pkg/health"
. "github.com/hanzoai/deploy/gitops-engine/pkg/sync/common"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
. "github.com/hanzoai/deploy/pkg/apis/application/v1alpha1"
"github.com/hanzoai/deploy/test/e2e/fixture"
. "github.com/hanzoai/deploy/test/e2e/fixture/app"
projectFixture "github.com/hanzoai/deploy/test/e2e/fixture/project"
"github.com/hanzoai/deploy/util/errors"
)
func TestHelmHooksAreCreated(t *testing.T) {
ctx := Given(t)
ctx.Path("hook").
When().
PatchFile("hook.yaml", `[{"op": "replace", "path": "/metadata/annotations", "value": {"helm.sh/hook": "pre-install"}}]`).
CreateApp().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
Expect(ResourceResultIs(ResourceResult{Version: "v1", Kind: "Pod", Namespace: ctx.DeploymentNamespace(), Name: "hook", Message: "pod/hook created", Images: []string{"quay.io/argoprojlabs/argocd-e2e-container:0.1"}, HookType: HookTypePreSync, Status: ResultCodeSynced, HookPhase: OperationSucceeded, SyncPhase: SyncPhasePreSync}))
}
// make sure we treat Helm weights as a sync wave
func TestHelmHookWeight(t *testing.T) {
Given(t).
Path("hook").
When().
// this create a weird hook, that runs during sync - but before the pod, and because it'll fail - the pod will never be created
PatchFile("hook.yaml", `[
{"op": "replace", "path": "/metadata/annotations", "value": {"argocd.argoproj.io/hook": "Sync", "helm.sh/hook-weight": "-1"}},
{"op": "replace", "path": "/spec/containers/0/command/0", "value": "false"}
]`).
CreateApp().
IgnoreErrors().
Sync().
Then().
Expect(OperationPhaseIs(OperationFailed)).
Expect(ResourceResultNumbering(1))
}
// make sure that execute the delete policy
func TestHelmHookDeletePolicy(t *testing.T) {
Given(t).
Path("hook").
When().
PatchFile("hook.yaml", `[{"op": "add", "path": "/metadata/annotations/helm.sh~1hook-delete-policy", "value": "hook-succeeded"}]`).
CreateApp().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(ResourceResultNumbering(2)).
Expect(NotPod(func(p corev1.Pod) bool { return p.Name == "hook" }))
}
func TestDeclarativeHelm(t *testing.T) {
Given(t).
Path("helm").
When().
Declarative("declarative-apps/app.yaml").
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestDeclarativeHelmInvalidValuesFile(t *testing.T) {
Given(t).
Path("helm").
When().
Declarative("declarative-apps/invalid-helm.yaml").
Then().
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeUnknown)).
Expect(Condition(ApplicationConditionComparisonError, "does-not-exist-values.yaml: no such file or directory"))
}
func TestHelmRepo(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
Given(t).
CustomCACertAdded().
HelmRepoAdded("custom-repo").
RepoURLType(fixture.RepoURLTypeHelm).
Chart("helm").
Revision("1.0.0").
When().
CreateApp().
Then().
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestHelmValues(t *testing.T) {
Given(t).
Path("helm").
When().
AddFile("foo.yml", "").
CreateApp().
AppSet("--values", "foo.yml").
Then().
And(func(app *Application) {
assert.Equal(t, []string{"foo.yml"}, app.Spec.GetSource().Helm.ValueFiles)
})
}
func TestHelmIgnoreMissingValueFiles(t *testing.T) {
Given(t).
Path("helm").
When().
Declarative("declarative-apps/invalid-helm.yaml").
Then().
And(func(app *Application) {
assert.Equal(t, []string{"does-not-exist-values.yaml"}, app.Spec.GetSource().Helm.ValueFiles)
assert.False(t, app.Spec.GetSource().Helm.IgnoreMissingValueFiles)
}).
When().
AppSet("--ignore-missing-value-files").
Then().
And(func(app *Application) {
assert.True(t, app.Spec.GetSource().Helm.IgnoreMissingValueFiles)
}).
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
When().
AppUnSet("--ignore-missing-value-files").
Then().
And(func(app *Application) {
assert.False(t, app.Spec.GetSource().Helm.IgnoreMissingValueFiles)
}).
When().
IgnoreErrors().
Sync().
Then().
Expect(ErrorRegex("Error: open .*does-not-exist-values.yaml: no such file or directory", ""))
}
// TestHelmGlobValueFiles verifies that a glob pattern in valueFiles expands to all matching
// files and that they are applied in lexical order (last file wins in helm merging).
// envs/*.yaml expands to envs/a.yaml then envs/b.yaml - b.yaml is last, so foo = "b-value".
func TestHelmGlobValueFiles(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
ctx := Given(t)
ctx.Path("helm-glob-values").
When().
CreateApp().
AppSet("--values", "envs/*.yaml").
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(_ *Application) {
val := errors.NewHandler(t).FailOnErr(fixture.Run(".", "kubectl", "-n", ctx.DeploymentNamespace(),
"get", "cm", "my-map", "-o", "jsonpath={.data.foo}")).(string)
assert.Equal(t, "b-value", val)
})
}
// TestHelmRecursiveGlobValueFiles verifies that the ** double-star pattern recursively
// matches files at any depth. envs/**/*.yaml expands (zero-segments first) to:
// envs/a.yaml, envs/b.yaml, envs/nested/c.yaml - c.yaml is last, so foo = "c-value".
func TestHelmRecursiveGlobValueFiles(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
ctx := Given(t)
ctx.Path("helm-glob-values").
When().
CreateApp().
AppSet("--values", "envs/**/*.yaml").
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(_ *Application) {
val := errors.NewHandler(t).FailOnErr(fixture.Run(".", "kubectl", "-n", ctx.DeploymentNamespace(),
"get", "cm", "my-map", "-o", "jsonpath={.data.foo}")).(string)
assert.Equal(t, "c-value", val)
})
}
// TestHelmGlobValueFilesNoMatch verifies that a glob pattern with no matching files
// surfaces as a comparison error on the application.
func TestHelmGlobValueFilesNoMatch(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
Given(t).
Path("helm-glob-values").
When().
CreateApp().
AppSet("--values", "nonexistent/*.yaml").
Then().
Expect(Condition(ApplicationConditionComparisonError, `values file glob "nonexistent/*.yaml" matched no files`))
}
// TestHelmGlobValueFilesIgnoreMissing verifies that a non-matching glob pattern is
// silently skipped when ignoreMissingValueFiles is set, and the app syncs successfully.
func TestHelmGlobValueFilesIgnoreMissing(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
Given(t).
Path("helm-glob-values").
When().
CreateApp().
AppSet("--values", "nonexistent/*.yaml", "--ignore-missing-value-files").
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestHelmValuesMultipleUnset(t *testing.T) {
Given(t).
Path("helm").
When().
AddFile("foo.yml", "").
AddFile("baz.yml", "").
CreateApp().
AppSet("--values", "foo.yml", "--values", "baz.yml").
Then().
And(func(app *Application) {
assert.NotNil(t, app.Spec.GetSource().Helm)
assert.Equal(t, []string{"foo.yml", "baz.yml"}, app.Spec.GetSource().Helm.ValueFiles)
}).
When().
AppUnSet("--values", "foo.yml").
Then().
And(func(app *Application) {
assert.NotNil(t, app.Spec.GetSource().Helm)
assert.Equal(t, []string{"baz.yml"}, app.Spec.GetSource().Helm.ValueFiles)
}).
When().
AppUnSet("--values", "baz.yml").
Then().
And(func(app *Application) {
assert.Nil(t, app.Spec.GetSource().Helm)
})
}
func TestHelmValuesLiteralFileLocal(t *testing.T) {
Given(t).
Path("helm").
When().
CreateApp().
AppSet("--values-literal-file", "testdata/helm/baz.yaml").
Then().
And(func(app *Application) {
data, err := os.ReadFile("testdata/helm/baz.yaml")
if err != nil {
panic(err)
}
assert.Equal(t, strings.TrimSuffix(string(data), "\n"), app.Spec.GetSource().Helm.ValuesString())
}).
When().
AppUnSet("--values-literal").
Then().
And(func(app *Application) {
assert.Nil(t, app.Spec.GetSource().Helm)
})
}
func TestHelmValuesLiteralFileRemote(t *testing.T) {
sentinel := "a: b"
lc := &net.ListenConfig{}
serve := func(c chan<- string) {
// listen on first available dynamic (unprivileged) port
listener, err := lc.Listen(t.Context(), "tcp", ":0")
if err != nil {
panic(err)
}
// send back the address so that it can be used
c <- listener.Addr().String()
http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
// return the sentinel text at root URL
fmt.Fprint(w, sentinel)
})
panic(http.Serve(listener, nil))
}
c := make(chan string, 1)
// run a local webserver to test data retrieval
go serve(c)
address := <-c
t.Logf("Listening at address: %s", address)
Given(t).
Path("helm").
When().
CreateApp().
AppSet("--values-literal-file", "http://"+address).
Then().
And(func(app *Application) {
assert.Equal(t, "a: b", app.Spec.GetSource().Helm.ValuesString())
}).
When().
AppUnSet("--values-literal").
Then().
And(func(app *Application) {
assert.Nil(t, app.Spec.GetSource().Helm)
})
}
func TestHelmCrdHook(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
Given(t).
Path("helm-crd").
When().
CreateApp().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
Expect(ResourceResultNumbering(2))
}
func TestHelmReleaseName(t *testing.T) {
Given(t).
Path("helm").
When().
CreateApp().
AppSet("--release-name", "foo").
Then().
And(func(app *Application) {
assert.Equal(t, "foo", app.Spec.GetSource().Helm.ReleaseName)
})
}
func TestHelmSet(t *testing.T) {
Given(t).
Path("helm").
When().
CreateApp().
AppSet("--helm-set", "foo=bar", "--helm-set", "foo=baz", "--helm-set", "app=$ARGOCD_APP_NAME").
Then().
And(func(app *Application) {
assert.Equal(t, []HelmParameter{{Name: "foo", Value: "baz"}, {Name: "app", Value: "$ARGOCD_APP_NAME"}}, app.Spec.GetSource().Helm.Parameters)
})
}
func TestHelmSetString(t *testing.T) {
Given(t).
Path("helm").
When().
CreateApp().
AppSet("--helm-set-string", "foo=bar", "--helm-set-string", "foo=baz", "--helm-set-string", "app=$ARGOCD_APP_NAME").
Then().
And(func(app *Application) {
assert.Equal(t, []HelmParameter{{Name: "foo", Value: "baz", ForceString: true}, {Name: "app", Value: "$ARGOCD_APP_NAME", ForceString: true}}, app.Spec.GetSource().Helm.Parameters)
})
}
func TestHelmSetFile(t *testing.T) {
Given(t).
Path("helm").
When().
CreateApp().
AppSet("--helm-set-file", "foo=bar.yaml", "--helm-set-file", "foo=baz.yaml").
Then().
And(func(app *Application) {
assert.Equal(t, []HelmFileParameter{{Name: "foo", Path: "baz.yaml"}}, app.Spec.GetSource().Helm.FileParameters)
})
}
// ensure we can use envsubst in "set" variables
func TestHelmSetEnv(t *testing.T) {
ctx := Given(t)
ctx.Path("helm-values").
When().
CreateApp().
AppSet("--helm-set", "foo=$ARGOCD_APP_NAME").
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(_ *Application) {
assert.Equal(t, ctx.GetName(), errors.NewHandler(t).FailOnErr(fixture.Run(".", "kubectl", "-n", ctx.DeploymentNamespace(), "get", "cm", "my-map", "-o", "jsonpath={.data.foo}")).(string))
})
}
func TestHelmSetStringEnv(t *testing.T) {
ctx := Given(t)
ctx.Path("helm-values").
When().
CreateApp().
AppSet("--helm-set-string", "foo=$ARGOCD_APP_NAME").
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(_ *Application) {
assert.Equal(t, ctx.GetName(), errors.NewHandler(t).FailOnErr(fixture.Run(".", "kubectl", "-n", ctx.DeploymentNamespace(), "get", "cm", "my-map", "-o", "jsonpath={.data.foo}")).(string))
})
}
// make sure kube-version gets passed down to resources
func TestKubeVersion(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
ctx := Given(t)
ctx.Path("helm-kube-version").
When().
CreateApp().
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(_ *Application) {
kubeVersion := errors.NewHandler(t).FailOnErr(fixture.Run(".", "kubectl", "-n", ctx.DeploymentNamespace(), "get", "cm", "my-map",
"-o", "jsonpath={.data.kubeVersion}")).(string)
// Capabilities.KubeVersion defaults to 1.9.0, we assume here you are running a later version
assert.LessOrEqual(t, fixture.GetVersions(t).ServerVersion.String(), kubeVersion)
}).
When().
// Make sure override works.
AppSet("--helm-kube-version", "999.999.999").
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(_ *Application) {
assert.Equal(t, "v999.999.999", errors.NewHandler(t).FailOnErr(fixture.Run(".", "kubectl", "-n", ctx.DeploymentNamespace(), "get", "cm", "my-map",
"-o", "jsonpath={.data.kubeVersion}")).(string))
})
}
// make sure api versions gets passed down to resources
func TestApiVersions(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
ctx := Given(t)
ctx.Path("helm-api-versions").
When().
CreateApp().
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(_ *Application) {
apiVersions := errors.NewHandler(t).FailOnErr(fixture.Run(".", "kubectl", "-n", ctx.DeploymentNamespace(), "get", "cm", "my-map",
"-o", "jsonpath={.data.apiVersions}")).(string)
// The v1 API shouldn't be going anywhere.
assert.Contains(t, apiVersions, "v1")
}).
When().
// Make sure override works.
AppSet("--helm-api-versions", "v1/MyTestResource").
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(_ *Application) {
apiVersions := errors.NewHandler(t).FailOnErr(fixture.Run(".", "kubectl", "-n", ctx.DeploymentNamespace(), "get", "cm", "my-map",
"-o", "jsonpath={.data.apiVersions}")).(string)
assert.Contains(t, apiVersions, "v1/MyTestResource")
})
}
func TestHelmNamespaceOverride(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
Given(t).
Path("helm-namespace").
When().
CreateApp().
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
When().
AppSet("--helm-namespace", "does-not-exist").
Then().
// The app should go out of sync, because the resource's target namespace changed.
Expect(SyncStatusIs(SyncStatusCodeOutOfSync))
}
func TestHelmValuesHiddenDirectory(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
Given(t).
Path(".hidden-helm").
When().
AddFile("foo.yaml", "").
CreateApp().
AppSet("--values", "foo.yaml").
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestHelmWithDependencies(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
ctx := Given(t).
CustomCACertAdded().
// these are slow tests
Timeout(30).
HelmPassCredentials()
ctx = ctx.HelmRepoAdded("custom-repo")
helmVer := ""
ctx.Path("helm-with-dependencies").
When().
CreateApp("--helm-version", helmVer).
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestHelmWithMultipleDependencies(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
Given(t).Path("helm-with-multiple-dependencies").
CustomCACertAdded().
// these are slow tests
Timeout(30).
HelmHTTPSCredentialsUserPassAdded().
HelmPassCredentials().
When().
CreateApp().
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestHelmDependenciesPermissionDenied(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
ctx := projectFixture.Given(t)
ctx.Name("argo-helm-project-denied").
Destination("*,*").
When().
Create().
AddSource(fixture.RepoURL(fixture.RepoURLTypeFile))
expectedErr := fmt.Sprintf("helm repos localhost:5000/myrepo are not permitted in project '%s'", ctx.GetName())
GivenWithSameState(ctx).
Project(ctx.GetName()).
Path("helm-oci-with-dependencies").
CustomCACertAdded().
HelmHTTPSCredentialsUserPassAdded().
HelmPassCredentials().
When().
IgnoreErrors().
CreateApp().
Then().
Expect(Error("", expectedErr))
expectedErr = fmt.Sprintf("helm repos https://localhost:9443/argo-e2e/testdata.git/helm-repo/local, https://localhost:9443/argo-e2e/testdata.git/helm-repo/local2 are not permitted in project '%s'", ctx.GetName())
GivenWithSameState(ctx).
Project(ctx.GetName()).
Path("helm-with-multiple-dependencies-permission-denied").
CustomCACertAdded().
HelmHTTPSCredentialsUserPassAdded().
HelmPassCredentials().
When().
IgnoreErrors().
CreateApp().
Then().
Expect(Error("", expectedErr))
}
func TestHelm3CRD(t *testing.T) {
fixture.SkipOnEnv(t, "HELM")
Given(t).
Path("helm3-crd").
When().
CreateApp().
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
Expect(ResourceSyncStatusIs("CustomResourceDefinition", "crontabs.stable.example.com", SyncStatusCodeSynced))
}
func TestHelmOCIRegistry(t *testing.T) {
Given(t).
PushChartToOCIRegistry("testdata/helm-values", "helm-values", "1.0.0").
HelmOCIRepoAdded("myrepo").
RepoURLType(fixture.RepoURLTypeHelmOCI).
Chart("helm-values").
Revision("1.0.0").
When().
CreateApp().
Then().
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestGitWithHelmOCIRegistryDependencies(t *testing.T) {
Given(t).
PushChartToOCIRegistry("testdata/helm-values", "helm-values", "1.0.0").
HelmOCIRepoAdded("myrepo").
Path("helm-oci-with-dependencies").
When().
CreateApp().
Then().
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestHelmOCIRegistryWithDependencies(t *testing.T) {
Given(t).
PushChartToOCIRegistry("testdata/helm-values", "helm-values", "1.0.0").
PushChartToOCIRegistry("testdata/helm-oci-with-dependencies", "helm-oci-with-dependencies", "1.0.0").
HelmOCIRepoAdded("myrepo").
RepoURLType(fixture.RepoURLTypeHelmOCI).
Chart("helm-oci-with-dependencies").
Revision("1.0.0").
When().
CreateApp().
Then().
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestTemplatesGitWithHelmOCIDependencies(t *testing.T) {
Given(t).
PushChartToOCIRegistry("testdata/helm-values", "helm-values", "1.0.0").
HelmoOCICredentialsWithoutUserPassAdded().
Path("helm-oci-with-dependencies").
When().
CreateApp().
Then().
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestTemplatesHelmOCIWithDependencies(t *testing.T) {
Given(t).
PushChartToOCIRegistry("testdata/helm-values", "helm-values", "1.0.0").
PushChartToOCIRegistry("testdata/helm-oci-with-dependencies", "helm-oci-with-dependencies", "1.0.0").
HelmoOCICredentialsWithoutUserPassAdded().
RepoURLType(fixture.RepoURLTypeHelmOCI).
Chart("helm-oci-with-dependencies").
Revision("1.0.0").
When().
CreateApp().
Then().
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestHelmOCIRegistryWithConstraintRevision(t *testing.T) {
Given(t).
PushChartToOCIRegistry("testdata/helm-values", "helm-values", "1.0.0").
HelmOCIRepoAdded("myrepo").
RepoURLType(fixture.RepoURLTypeHelmOCI).
Chart("helm-values").
Revision(">=1.0.0").
When().
CreateApp().
Then().
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}