Skip to content

Commit

Permalink
Merge branch 'main' into renovate/all-minor-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 authored Aug 8, 2023
2 parents a76b356 + ca6546b commit 85a676b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/zarf-agent/manifests/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ webhooks:
apiVersions:
- "v1beta1"
- "v1beta2"
- "v1"
resources:
- "gitrepositories"
admissionReviewVersions:
Expand Down
18 changes: 16 additions & 2 deletions src/extensions/bigbang/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/Masterminds/semver/v3"
"github.com/defenseunicorns/zarf/src/types/extensions"
fluxHelmCtrl "github.com/fluxcd/helm-controller/api/v2beta1"
fluxSrcCtrl "github.com/fluxcd/source-controller/api/v1beta2"
fluxSrcCtrl "github.com/fluxcd/source-controller/api/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -88,10 +88,24 @@ func manifestZarfCredentials(version string) corev1.Secret {

// manifestGitRepo generates a GitRepository object for the Big Bang umbrella repo.
func manifestGitRepo(cfg *extensions.BigBang) fluxSrcCtrl.GitRepository {
apiVersion := "source.toolkit.fluxcd.io/v1beta2"

// Set apiVersion to v1 on BB v2.7.0 or higher falling back to v1beta2 as needed
semverVersion, _ := semver.NewVersion(cfg.Version)
if semverVersion != nil {
c, _ := semver.NewConstraint(">= 2.7.0")
if c != nil {
updateFlux, _ := c.Validate(semverVersion)
if updateFlux && !cfg.SkipFlux {
apiVersion = "source.toolkit.fluxcd.io/v1"
}
}
}

return fluxSrcCtrl.GitRepository{
TypeMeta: metav1.TypeMeta{
Kind: fluxSrcCtrl.GitRepositoryKind,
APIVersion: "source.toolkit.fluxcd.io/v1beta2",
APIVersion: apiVersion,
},
ObjectMeta: metav1.ObjectMeta{
Name: bb,
Expand Down

0 comments on commit 85a676b

Please sign in to comment.