diff --git a/config/crd/bases/styra.bankdata.dk_libraries.yaml b/config/crd/bases/styra.bankdata.dk_libraries.yaml
index f6018f6d..f8281cce 100644
--- a/config/crd/bases/styra.bankdata.dk_libraries.yaml
+++ b/config/crd/bases/styra.bankdata.dk_libraries.yaml
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.19.0
+ controller-gen.kubebuilder.io/version: v0.20.0
name: libraries.styra.bankdata.dk
spec:
group: styra.bankdata.dk
diff --git a/config/crd/bases/styra.bankdata.dk_systems.yaml b/config/crd/bases/styra.bankdata.dk_systems.yaml
index cb621b93..555ad550 100644
--- a/config/crd/bases/styra.bankdata.dk_systems.yaml
+++ b/config/crd/bases/styra.bankdata.dk_systems.yaml
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
- controller-gen.kubebuilder.io/version: v0.19.0
+ controller-gen.kubebuilder.io/version: v0.20.0
name: systems.styra.bankdata.dk
spec:
group: styra.bankdata.dk
diff --git a/docs/apis/styra/v1alpha1.md b/docs/apis/styra/v1alpha1.md
index 1f0e8fb7..85b5cee0 100644
--- a/docs/apis/styra/v1alpha1.md
+++ b/docs/apis/styra/v1alpha1.md
@@ -458,5 +458,5 @@ GitRepo
Generated with gen-crd-api-reference-docs
-on git commit 4901ef1.
+on git commit 237726c.
diff --git a/docs/apis/styra/v1beta1.md b/docs/apis/styra/v1beta1.md
index 84a95cd0..9831ff7d 100644
--- a/docs/apis/styra/v1beta1.md
+++ b/docs/apis/styra/v1beta1.md
@@ -1424,5 +1424,5 @@ System.
Generated with gen-crd-api-reference-docs
-on git commit 4901ef1.
+on git commit 237726c.
diff --git a/internal/controller/styra/system_controller.go b/internal/controller/styra/system_controller.go
index 4af6c963..4518b163 100644
--- a/internal/controller/styra/system_controller.go
+++ b/internal/controller/styra/system_controller.go
@@ -854,8 +854,7 @@ func (r *SystemReconciler) reconcileSystemSource(
}
if system.Spec.SourceControl.Origin.Commit != "" {
gitConfig.Commit = system.Spec.SourceControl.Origin.Commit
- }
- if system.Spec.SourceControl.Origin.Reference != "" {
+ } else if system.Spec.SourceControl.Origin.Reference != "" {
gitConfig.Reference = system.Spec.SourceControl.Origin.Reference
}
if system.Spec.SourceControl.Origin.Path != "" {
diff --git a/test/integration/controller/system_controller_test.go b/test/integration/controller/system_controller_test.go
index fc8bf798..7313c567 100644
--- a/test/integration/controller/system_controller_test.go
+++ b/test/integration/controller/system_controller_test.go
@@ -2537,6 +2537,7 @@ var _ = ginkgo.Describe("SystemReconciler.ReconcileOCPSystem", ginkgo.Label("int
sourceControl := styrav1beta1.SourceControl{
Origin: styrav1beta1.GitRepo{
URL: "https://github.com/test/repo.git",
+ Commit: "0123456789abcdef",
Reference: "refs/heads/master",
Path: "policy",
},
@@ -2595,7 +2596,7 @@ var _ = ginkgo.Describe("SystemReconciler.ReconcileOCPSystem", ginkgo.Label("int
Name: "default-ocp-system",
Git: &ocp.GitConfig{
Repo: "https://github.com/test/repo.git",
- Reference: "refs/heads/master",
+ Commit: "0123456789abcdef",
Path: "policy",
CredentialID: expectedGitCredentialsID,
IncludedFiles: []string{"*.rego"},
@@ -2653,7 +2654,7 @@ var _ = ginkgo.Describe("SystemReconciler.ReconcileOCPSystem", ginkgo.Label("int
Name: "default-ocp-system",
Git: &ocp.GitConfig{
Repo: "https://github.com/test/repo.git",
- Reference: "refs/heads/master",
+ Commit: "0123456789abcdef",
Path: "policy",
CredentialID: expectedGitCredentialsID,
IncludedFiles: []string{"*.rego"},
@@ -2705,7 +2706,7 @@ var _ = ginkgo.Describe("SystemReconciler.ReconcileOCPSystem", ginkgo.Label("int
Name: "default-ocp-system",
Git: &ocp.GitConfig{
Repo: "https://github.com/test/repo.git",
- Reference: "refs/heads/master",
+ Commit: "0123456789abcdef",
Path: "policy",
CredentialID: expectedGitCredentialsID,
IncludedFiles: []string{"*.rego"},