Skip to content

Commit

Permalink
different file if zarf.yaml already exists
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
  • Loading branch information
AustinAbro321 committed Sep 18, 2024
1 parent aaaf288 commit 6ec763a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
4 changes: 2 additions & 2 deletions examples/bb-generate/manifests/helmrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ spec:
- kind: Secret
name: zarf-credentials
- kind: Secret
name: bb-usr-vals-0-ingress
name: bb-ingress-vals
- kind: ConfigMap
name: kyverno-config
- kind: ConfigMap
name: loki-config
- kind: Secret
name: bb-usr-vals-0-ingress
name: bb-neuvector-vals
2 changes: 1 addition & 1 deletion examples/bb-generate/values-files/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: bb-usr-vals-0-ingress
name: bb-ingress-vals
namespace: bigbang
stringData:
values.yaml: |
Expand Down
2 changes: 1 addition & 1 deletion examples/bb-generate/values-files/loki.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ApiVersion: v1
apiVersion: v1
kind: ConfigMap
metadata:
name: loki-config
Expand Down
2 changes: 1 addition & 1 deletion examples/bb-generate/values-files/neuvector.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: bb-usr-vals-0-ingress
name: bb-neuvector-vals
namespace: bigbang
stringData:
values.yaml: |
Expand Down
15 changes: 8 additions & 7 deletions examples/bb-generate/zarf.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# zarf dev generate big-bang 2.35.0 --values-files=values-files/ingress.yaml,values-files/kyverno.yaml,values-files/loki.yaml,values-files/neuvector.yaml
apiVersion: zarf.dev/v1alpha1
kind: ZarfPackageConfig
metadata:
Expand Down Expand Up @@ -67,18 +68,18 @@ components:
- registry1.dso.mil/ironbank/opensource/grafana/tempo-query:2.5.0
repos:
- https://repo1.dso.mil/big-bang/bigbang@2.35.0
- https://repo1.dso.mil/big-bang/product/packages/kiali.git@1.89.0-bb.0
- https://repo1.dso.mil/big-bang/product/packages/kyverno.git@3.2.6-bb.0
- https://repo1.dso.mil/big-bang/product/packages/metrics-server.git@3.12.1-bb.4
- https://repo1.dso.mil/big-bang/product/packages/promtail.git@6.16.2-bb.3
- https://repo1.dso.mil/big-bang/product/packages/monitoring.git@62.1.0-bb.0
- https://repo1.dso.mil/big-bang/product/packages/neuvector.git@2.7.8-bb.1
- https://repo1.dso.mil/big-bang/product/packages/grafana.git@8.4.6-bb.1
- https://repo1.dso.mil/big-bang/product/packages/istio-operator.git@1.22.4-bb.0
- https://repo1.dso.mil/big-bang/product/packages/istio-controlplane.git@1.22.4-bb.1
- https://repo1.dso.mil/big-bang/product/packages/istio-operator.git@1.22.4-bb.0
- https://repo1.dso.mil/big-bang/product/packages/kiali.git@1.89.0-bb.0
- https://repo1.dso.mil/big-bang/product/packages/kyverno-policies.git@3.2.5-bb.3
- https://repo1.dso.mil/big-bang/product/packages/kyverno-reporter.git@2.24.1-bb.0
- https://repo1.dso.mil/big-bang/product/packages/kyverno.git@3.2.6-bb.0
- https://repo1.dso.mil/big-bang/product/packages/loki.git@6.10.0-bb.0
- https://repo1.dso.mil/big-bang/product/packages/metrics-server.git@3.12.1-bb.4
- https://repo1.dso.mil/big-bang/product/packages/monitoring.git@62.1.0-bb.0
- https://repo1.dso.mil/big-bang/product/packages/neuvector.git@2.7.8-bb.1
- https://repo1.dso.mil/big-bang/product/packages/promtail.git@6.16.2-bb.3
- https://repo1.dso.mil/big-bang/product/packages/tempo.git@1.10.3-bb.0
actions:
onDeploy:
Expand Down
10 changes: 9 additions & 1 deletion src/internal/bigbang/bigbang.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"path"
"path/filepath"
"slices"
"sort"
"strings"

Expand Down Expand Up @@ -187,6 +188,7 @@ func Create(ctx context.Context, baseDir string, version string, valuesFileManif
for _, gitRepo := range gitRepos {
bbComponent.Repos = append(bbComponent.Repos, gitRepo)
}
slices.Sort(bbComponent.Repos)
}

// Sort so the dependencies are always the same between runs
Expand Down Expand Up @@ -291,7 +293,13 @@ func Create(ctx context.Context, baseDir string, version string, valuesFileManif

pkg.Components = append(pkg.Components, bbComponent)

err = utils.WriteYaml(filepath.Join(baseDir, "zarf.yaml"), pkg, helpers.ReadWriteUser)
outputName := "zarf.yaml"
if !helpers.InvalidPath(filepath.Join(baseDir, outputName)) {
outputName = fmt.Sprintf("bigbang-%s", outputName)
message.Warnf("zarf.yaml already exists, writing to %s", outputName)
}

err = utils.WriteYaml(filepath.Join(baseDir, outputName), pkg, helpers.ReadWriteUser)
if err != nil {
return err
}
Expand Down

0 comments on commit 6ec763a

Please sign in to comment.