Skip to content

Commit 5e985f7

Browse files
committed
Add tobikoPatch parameter for custom patches
1 parent cef303d commit 5e985f7

File tree

5 files changed

+106
-0
lines changed

5 files changed

+106
-0
lines changed

api/bases/test.openstack.org_tobikoes.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,20 @@ spec:
11921192
instances of test-operator related CRs exist. To run test-pods in parallel
11931193
set this option to true.
11941194
type: boolean
1195+
patch:
1196+
description: Optional patch to apply to the Tobiko repository.
1197+
properties:
1198+
refspec:
1199+
description: |-
1200+
Refspec specifies which change the remote repository should be
1201+
checked out to.
1202+
type: string
1203+
repository:
1204+
description: URL of the Tobiko repository that a patch will be
1205+
applied to.
1206+
format: uri
1207+
type: string
1208+
type: object
11951209
preventCreate:
11961210
default: false
11971211
description: Boolean specifying whether tobiko tests create new resources
@@ -1409,6 +1423,21 @@ spec:
14091423
description: Number of processes/workers used to run tobiko
14101424
tests - value 0 results in automatic decission
14111425
type: integer
1426+
patch:
1427+
description: Optional patch to apply to the Tobiko repository
1428+
for this step.
1429+
properties:
1430+
refspec:
1431+
description: |-
1432+
Refspec specifies which change the remote repository should be
1433+
checked out to.
1434+
type: string
1435+
repository:
1436+
description: URL of the Tobiko repository that a patch will
1437+
be applied to.
1438+
format: uri
1439+
type: string
1440+
type: object
14121441
preventCreate:
14131442
description: Boolean specifying whether tobiko tests create
14141443
new resources or re-use those previously created

api/v1beta1/tobiko_types.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ import (
2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
)
2424

25+
type PatchType struct {
26+
// +kubebuilder:validation:Optional
27+
// +kubebuilder:validation:Format=uri
28+
// URL of the Tobiko repository that a patch will be applied to.
29+
Repository string `json:"repository,omitempty"`
30+
31+
// +kubebuilder:validation:Optional
32+
// Refspec specifies which change the remote repository should be
33+
// checked out to.
34+
Refspec string `json:"refspec,omitempty"`
35+
}
36+
2537
// TobikoSpec defines the desired state of Tobiko
2638
type TobikoSpec struct {
2739
CommonOptions `json:",inline"`
@@ -69,6 +81,11 @@ type TobikoSpec struct {
6981
// Tobiko version
7082
Version string `json:"version"`
7183

84+
// +kubebuilder:validation:Optional
85+
// +operator-sdk:csv:customresourcedefinitions:type=spec
86+
// Optional patch to apply to the Tobiko repository.
87+
Patch PatchType `json:"patch"`
88+
7289
// +kubebuilder:validation:Optional
7390
// +operator-sdk:csv:customresourcedefinitions:type=spec
7491
// +kubebuilder:default:=""
@@ -155,6 +172,11 @@ type TobikoWorkflowSpec struct {
155172

156173
// +kubebuilder:validation:Optional
157174
// +operator-sdk:csv:customresourcedefinitions:type=spec
175+
// Optional patch to apply to the Tobiko repository for this step.
176+
Patch *PatchType `json:"patch,omitempty"`
177+
178+
// +kubebuilder:validation:Optional
179+
// +operator-sdk:csv:customresourcedefinitions:type=spec
158180
// tobiko.conf
159181
Config string `json:"config,omitempty"`
160182

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/test.openstack.org_tobikoes.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,20 @@ spec:
11921192
instances of test-operator related CRs exist. To run test-pods in parallel
11931193
set this option to true.
11941194
type: boolean
1195+
patch:
1196+
description: Optional patch to apply to the Tobiko repository.
1197+
properties:
1198+
refspec:
1199+
description: |-
1200+
Refspec specifies which change the remote repository should be
1201+
checked out to.
1202+
type: string
1203+
repository:
1204+
description: URL of the Tobiko repository that a patch will be
1205+
applied to.
1206+
format: uri
1207+
type: string
1208+
type: object
11951209
preventCreate:
11961210
default: false
11971211
description: Boolean specifying whether tobiko tests create new resources
@@ -1409,6 +1423,21 @@ spec:
14091423
description: Number of processes/workers used to run tobiko
14101424
tests - value 0 results in automatic decission
14111425
type: integer
1426+
patch:
1427+
description: Optional patch to apply to the Tobiko repository
1428+
for this step.
1429+
properties:
1430+
refspec:
1431+
description: |-
1432+
Refspec specifies which change the remote repository should be
1433+
checked out to.
1434+
type: string
1435+
repository:
1436+
description: URL of the Tobiko repository that a patch will
1437+
be applied to.
1438+
format: uri
1439+
type: string
1440+
type: object
14121441
preventCreate:
14131442
description: Boolean specifying whether tobiko tests create
14141443
new resources or re-use those previously created

controllers/tobiko_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,11 @@ func (r *TobikoReconciler) PrepareTobikoEnvVars(
389389
envVars["TOBIKO_DEBUG_MODE"] = env.SetValue(r.GetDefaultBool(instance.Spec.Debug))
390390
// Prepare env vars - end
391391

392+
if instance.Spec.Patch != (testv1beta1.PatchType{}) {
393+
envVars["TOBIKO_PATCH_REPOSITORY"] = env.SetValue(instance.Spec.Patch.Repository)
394+
envVars["TOBIKO_PATCH_REFSPEC"] = env.SetValue(instance.Spec.Patch.Refspec)
395+
}
396+
392397
// Prepare custom data
393398
customData := make(map[string]string)
394399
customData["tobiko.conf"] = instance.Spec.Config

0 commit comments

Comments
 (0)