Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git: fix reference json serialization #50

Merged
merged 2 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions api/v1alpha1/gitrepository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ type GitRepositorySpec struct {
// +required
Interval metav1.Duration `json:"interval"`

// The timeout for remote git operations like cloning.
// +kubebuilder:validation:Default=20s
// The timeout for remote git operations like cloning, default to 20s.
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

Expand All @@ -61,20 +60,19 @@ type GitRepositorySpec struct {
type GitRepositoryRef struct {
// The git branch to checkout, defaults to master.
// +optional
Branch string `json:"branch"`
Branch string `json:"branch,omitempty"`

// The git tag to checkout, takes precedence over branch.
// +optional
Tag string `json:"tag"`
Tag string `json:"tag,omitempty"`

// The git tag semver expression, takes precedence over tag.
// +optional
SemVer string `json:"semver"`
SemVer string `json:"semver,omitempty"`

// The git commit sha to checkout, if specified tag filters will be
// ignored.
// The git commit sha to checkout, if specified tag filters will be ignored.
// +optional
Commit string `json:"commit"`
Commit string `json:"commit,omitempty"`
}

// GitRepositoryVerification defines the OpenPGP signature verification process.
Expand Down
3 changes: 2 additions & 1 deletion config/crd/bases/source.fluxcd.io_gitrepositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ spec:
type: string
type: object
timeout:
description: The timeout for remote git operations like cloning.
description: The timeout for remote git operations like cloning, default
to 20s.
type: string
url:
description: The repository URL, can be a HTTP or SSH address.
Expand Down
9 changes: 8 additions & 1 deletion controllers/helmchart_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,15 @@ var _ = Describe("HelmChartReconciler", func() {
return k8sClient.Get(context.Background(), key, c)
}).ShouldNot(Succeed())

exists := func(path string) bool {
// wait for tmp sync on macOS
time.Sleep(time.Second)
_, err := os.Stat(path)
return err == nil
}

By("Expecting GC on delete")
Eventually(storage.ArtifactExist(*got.Status.Artifact), timeout, interval).ShouldNot(BeTrue())
Eventually(exists(got.Status.Artifact.Path), timeout, interval).ShouldNot(BeTrue())
})

It("Filters versions", func() {
Expand Down
9 changes: 8 additions & 1 deletion controllers/helmrepository_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,15 @@ var _ = Describe("HelmRepositoryReconciler", func() {
return k8sClient.Get(context.Background(), key, r)
}).ShouldNot(Succeed())

exists := func(path string) bool {
// wait for tmp sync on macOS
time.Sleep(time.Second)
_, err := os.Stat(path)
return err == nil
}

By("Expecting GC after delete")
Eventually(storage.ArtifactExist(*got.Status.Artifact), timeout, interval).ShouldNot(BeTrue())
Eventually(exists(got.Status.Artifact.Path), timeout, interval).ShouldNot(BeTrue())
})

It("Authenticates when basic auth credentials are provided", func() {
Expand Down
14 changes: 6 additions & 8 deletions docs/spec/v1alpha1/gitrepositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ type GitRepositorySpec struct {
// The interval at which to check for repository updates.
Interval metav1.Duration `json:"interval"`

// The timeout for remote git operations like cloning.
// +kubebuilder:validation:Default=20s
// The timeout for remote git operations like cloning, default to 20s.
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

Expand All @@ -50,20 +49,19 @@ Git repository reference:
type GitRepositoryRef struct {
// The git branch to checkout, defaults to master.
// +optional
Branch string `json:"branch"`
Branch string `json:"branch,omitempty"`

// The git tag to checkout, takes precedence over branch.
// +optional
Tag string `json:"tag"`
Tag string `json:"tag,omitempty"`

// The git tag semver expression, takes precedence over tag.
// +optional
SemVer string `json:"semver"`
SemVer string `json:"semver,omitempty"`

// The git commit sha to checkout, if specified branch and tag filters will
// ignored.
// The git commit sha to checkout, if specified tag filters will be ignored.
// +optional
Commit string `json:"commit"`
Commit string `json:"commit,omitempty"`
}
```

Expand Down