From 80dded72501b59af6722caec690481685acb6e7d Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Wed, 18 Sep 2024 20:40:01 +0000 Subject: [PATCH] tests passing Signed-off-by: Austin Abro --- src/internal/bigbang/bigbang.go | 6 +++++- src/internal/bigbang/bigbang_test.go | 20 +++++++++---------- .../airgap-false/bb-gitrepository.yaml | 4 ++-- .../airgap-false/bb-helmrelease.yaml | 5 +---- .../airgap-true/bb-gitrepository.yaml | 4 ++-- .../airgap-true/bb-helmrelease.yaml | 4 +++- .../neuvector.yaml | 0 7 files changed, 23 insertions(+), 20 deletions(-) rename src/internal/bigbang/testdata/addBBManifests/{airgap-false => airgap-true}/neuvector.yaml (100%) diff --git a/src/internal/bigbang/bigbang.go b/src/internal/bigbang/bigbang.go index f340c6bc27..43adae6268 100644 --- a/src/internal/bigbang/bigbang.go +++ b/src/internal/bigbang/bigbang.go @@ -482,7 +482,11 @@ func createBBManifests(ctx context.Context, airgap bool, manifestDir string, val } if spec, ok := helmReleaseObj["spec"].(map[string]interface{}); ok { - spec["valuesFrom"] = hrValues + if len(hrValues) > 0 { + spec["valuesFrom"] = hrValues + } else { + delete(spec, "valuesFrom") + } } else { return v1alpha1.ZarfManifest{}, errors.New("unable to find spec in helmrelease.yaml") } diff --git a/src/internal/bigbang/bigbang_test.go b/src/internal/bigbang/bigbang_test.go index de230a0f80..a47d634c9f 100644 --- a/src/internal/bigbang/bigbang_test.go +++ b/src/internal/bigbang/bigbang_test.go @@ -171,28 +171,28 @@ func TestAddBigBangManifests(t *testing.T) { expectedFiles []string }{ { - name: "Airgap true", - airgap: true, + name: "Airgap false", + airgap: false, valuesFiles: []string{}, version: "2.35.0", repo: "https://repo1.dso.mil/big-bang/bigbang", expectedFiles: []string{ - filepath.Join("testdata", "addBBManifests", "airgap-true", "bb-gitrepository.yaml"), - filepath.Join("testdata", "addBBManifests", "airgap-true", "bb-zarf-credentials.yaml"), - filepath.Join("testdata", "addBBManifests", "airgap-true", "bb-helmrelease.yaml"), + filepath.Join("testdata", "addBBManifests", "airgap-false", "bb-gitrepository.yaml"), + filepath.Join("testdata", "addBBManifests", "airgap-false", "bb-helmrelease.yaml"), }, }, { - name: "Airgap false with values files and v2beta1 version", - airgap: false, + name: "Airgap true with values files and v2beta1 version", + airgap: true, valuesFiles: []string{ - filepath.Join("testdata", "addBBManifests", "airgap-false", "neuvector.yaml"), + filepath.Join("testdata", "addBBManifests", "airgap-true", "neuvector.yaml"), }, version: "2.0.0", repo: "https://repo1.dso.mil/big-bang/bigbang", expectedFiles: []string{ - filepath.Join("testdata", "addBBManifests", "airgap-false", "bb-gitrepository.yaml"), - filepath.Join("testdata", "addBBManifests", "airgap-false", "bb-helmrelease.yaml"), + filepath.Join("testdata", "addBBManifests", "airgap-true", "bb-gitrepository.yaml"), + filepath.Join("testdata", "addBBManifests", "airgap-true", "bb-helmrelease.yaml"), + filepath.Join("testdata", "addBBManifests", "airgap-true", "bb-zarf-credentials.yaml"), }, }, } diff --git a/src/internal/bigbang/testdata/addBBManifests/airgap-false/bb-gitrepository.yaml b/src/internal/bigbang/testdata/addBBManifests/airgap-false/bb-gitrepository.yaml index 6a6569683c..ab38d2995e 100644 --- a/src/internal/bigbang/testdata/addBBManifests/airgap-false/bb-gitrepository.yaml +++ b/src/internal/bigbang/testdata/addBBManifests/airgap-false/bb-gitrepository.yaml @@ -1,4 +1,4 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: bigbang @@ -11,4 +11,4 @@ spec: interval: 10m url: https://repo1.dso.mil/big-bang/bigbang.git ref: - tag: 2.0.0 + tag: 2.35.0 diff --git a/src/internal/bigbang/testdata/addBBManifests/airgap-false/bb-helmrelease.yaml b/src/internal/bigbang/testdata/addBBManifests/airgap-false/bb-helmrelease.yaml index a82e480243..1ff5d78056 100644 --- a/src/internal/bigbang/testdata/addBBManifests/airgap-false/bb-helmrelease.yaml +++ b/src/internal/bigbang/testdata/addBBManifests/airgap-false/bb-helmrelease.yaml @@ -1,4 +1,4 @@ -apiVersion: helm.toolkit.fluxcd.io/v2beta1 +apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: bigbang @@ -25,6 +25,3 @@ spec: remediation: remediateLastFailure: true retries: 5 - valuesFrom: - - kind: Secret - name: bb-secret diff --git a/src/internal/bigbang/testdata/addBBManifests/airgap-true/bb-gitrepository.yaml b/src/internal/bigbang/testdata/addBBManifests/airgap-true/bb-gitrepository.yaml index ab38d2995e..6a6569683c 100644 --- a/src/internal/bigbang/testdata/addBBManifests/airgap-true/bb-gitrepository.yaml +++ b/src/internal/bigbang/testdata/addBBManifests/airgap-true/bb-gitrepository.yaml @@ -1,4 +1,4 @@ -apiVersion: source.toolkit.fluxcd.io/v1 +apiVersion: source.toolkit.fluxcd.io/v1beta2 kind: GitRepository metadata: name: bigbang @@ -11,4 +11,4 @@ spec: interval: 10m url: https://repo1.dso.mil/big-bang/bigbang.git ref: - tag: 2.35.0 + tag: 2.0.0 diff --git a/src/internal/bigbang/testdata/addBBManifests/airgap-true/bb-helmrelease.yaml b/src/internal/bigbang/testdata/addBBManifests/airgap-true/bb-helmrelease.yaml index acddca32bc..8ef31845c3 100644 --- a/src/internal/bigbang/testdata/addBBManifests/airgap-true/bb-helmrelease.yaml +++ b/src/internal/bigbang/testdata/addBBManifests/airgap-true/bb-helmrelease.yaml @@ -1,4 +1,4 @@ -apiVersion: helm.toolkit.fluxcd.io/v2 +apiVersion: helm.toolkit.fluxcd.io/v2beta1 kind: HelmRelease metadata: name: bigbang @@ -28,3 +28,5 @@ spec: valuesFrom: - kind: Secret name: zarf-credentials + - kind: Secret + name: bb-secret diff --git a/src/internal/bigbang/testdata/addBBManifests/airgap-false/neuvector.yaml b/src/internal/bigbang/testdata/addBBManifests/airgap-true/neuvector.yaml similarity index 100% rename from src/internal/bigbang/testdata/addBBManifests/airgap-false/neuvector.yaml rename to src/internal/bigbang/testdata/addBBManifests/airgap-true/neuvector.yaml