Skip to content

Commit 567cfe0

Browse files
committed
feat(stoneintg-1165): resolve pipelineruns from scenario
Support referencing pipelineruns from integrationtestscenario resolver field. Uses Tekton's ResolutionRequest CR to grab remote data then creates PipelineRun in the cluster Signed-off-by: Ryan Cole <[email protected]>
1 parent f8f63c0 commit 567cfe0

26 files changed

+1302
-35
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ download-crds: ## Vendoring doesn't fetch CRDs yaml files due pruning of depende
117117

118118
.PHONY: test
119119
test: manifests generate fmt vet envtest download-crds ## Run tests.
120-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
120+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -p 1 -c -coverprofile cover.out
121121

122122
##@ Build
123123

config/crd/bases/appstudio.redhat.com_integrationtestscenarios.yaml

+49-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.16.1
6+
controller-gen.kubebuilder.io/version: v0.14.0
77
name: integrationtestscenarios.appstudio.redhat.com
88
spec:
99
group: appstudio.redhat.com
@@ -158,8 +158,16 @@ spec:
158158
properties:
159159
conditions:
160160
items:
161-
description: Condition contains details for one aspect of the current
162-
state of this API Resource.
161+
description: "Condition contains details for one aspect of the current
162+
state of this API Resource.\n---\nThis struct is intended for
163+
direct use as an array at the field path .status.conditions. For
164+
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
165+
observations of a foo's current state.\n\t // Known .status.conditions.type
166+
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
167+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
168+
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
169+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
170+
\ // other fields\n\t}"
163171
properties:
164172
lastTransitionTime:
165173
description: |-
@@ -200,7 +208,12 @@ spec:
200208
- Unknown
201209
type: string
202210
type:
203-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
211+
description: |-
212+
type of condition in CamelCase or in foo.example.com/CamelCase.
213+
---
214+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
215+
useful (see .node.status.conditions), the ability to deconflict is important.
216+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
204217
maxLength: 316
205218
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
206219
type: string
@@ -388,8 +401,16 @@ spec:
388401
properties:
389402
conditions:
390403
items:
391-
description: Condition contains details for one aspect of the current
392-
state of this API Resource.
404+
description: "Condition contains details for one aspect of the current
405+
state of this API Resource.\n---\nThis struct is intended for
406+
direct use as an array at the field path .status.conditions. For
407+
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
408+
observations of a foo's current state.\n\t // Known .status.conditions.type
409+
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
410+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
411+
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
412+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
413+
\ // other fields\n\t}"
393414
properties:
394415
lastTransitionTime:
395416
description: |-
@@ -430,7 +451,12 @@ spec:
430451
- Unknown
431452
type: string
432453
type:
433-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
454+
description: |-
455+
type of condition in CamelCase or in foo.example.com/CamelCase.
456+
---
457+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
458+
useful (see .node.status.conditions), the ability to deconflict is important.
459+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
434460
maxLength: 316
435461
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
436462
type: string
@@ -560,8 +586,16 @@ spec:
560586
properties:
561587
conditions:
562588
items:
563-
description: Condition contains details for one aspect of the current
564-
state of this API Resource.
589+
description: "Condition contains details for one aspect of the current
590+
state of this API Resource.\n---\nThis struct is intended for
591+
direct use as an array at the field path .status.conditions. For
592+
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
593+
observations of a foo's current state.\n\t // Known .status.conditions.type
594+
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
595+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
596+
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
597+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
598+
\ // other fields\n\t}"
565599
properties:
566600
lastTransitionTime:
567601
description: |-
@@ -602,7 +636,12 @@ spec:
602636
- Unknown
603637
type: string
604638
type:
605-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
639+
description: |-
640+
type of condition in CamelCase or in foo.example.com/CamelCase.
641+
---
642+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
643+
useful (see .node.status.conditions), the ability to deconflict is important.
644+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
606645
maxLength: 316
607646
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
608647
type: string

config/rbac/role.yaml

+93-8
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ rules:
1616
- appstudio.redhat.com
1717
resources:
1818
- applications
19-
- integrationtestscenarios
20-
- releases
21-
- snapshots
2219
verbs:
2320
- create
2421
- delete
@@ -31,8 +28,6 @@ rules:
3128
- appstudio.redhat.com
3229
resources:
3330
- applications/finalizers
34-
- components/finalizers
35-
- snapshots/finalizers
3631
verbs:
3732
- update
3833
- apiGroups:
@@ -51,28 +46,118 @@ rules:
5146
- patch
5247
- update
5348
- watch
49+
- apiGroups:
50+
- appstudio.redhat.com
51+
resources:
52+
- components/finalizers
53+
verbs:
54+
- update
5455
- apiGroups:
5556
- appstudio.redhat.com
5657
resources:
5758
- components/status
59+
verbs:
60+
- get
61+
- patch
62+
- update
63+
- apiGroups:
64+
- appstudio.redhat.com
65+
resources:
66+
- environments
67+
verbs:
68+
- get
69+
- list
70+
- watch
71+
- apiGroups:
72+
- appstudio.redhat.com
73+
resources:
5874
- environments/status
75+
verbs:
76+
- get
77+
- patch
78+
- update
79+
- apiGroups:
80+
- appstudio.redhat.com
81+
resources:
82+
- integrationtestscenarios
83+
verbs:
84+
- create
85+
- delete
86+
- get
87+
- list
88+
- patch
89+
- update
90+
- watch
91+
- apiGroups:
92+
- appstudio.redhat.com
93+
resources:
5994
- integrationtestscenarios/status
95+
verbs:
96+
- get
97+
- patch
98+
- update
99+
- apiGroups:
100+
- appstudio.redhat.com
101+
resources:
102+
- releaseplans
103+
verbs:
104+
- get
105+
- list
106+
- watch
107+
- apiGroups:
108+
- appstudio.redhat.com
109+
resources:
60110
- releaseplans/status
111+
verbs:
112+
- get
113+
- patch
114+
- update
115+
- apiGroups:
116+
- appstudio.redhat.com
117+
resources:
118+
- releases
119+
verbs:
120+
- create
121+
- delete
122+
- get
123+
- list
124+
- patch
125+
- update
126+
- watch
127+
- apiGroups:
128+
- appstudio.redhat.com
129+
resources:
61130
- releases/status
62-
- snapshots/status
63131
verbs:
64132
- get
65133
- patch
66134
- update
67135
- apiGroups:
68136
- appstudio.redhat.com
69137
resources:
70-
- environments
71-
- releaseplans
138+
- snapshots
72139
verbs:
140+
- create
141+
- delete
73142
- get
74143
- list
144+
- patch
145+
- update
75146
- watch
147+
- apiGroups:
148+
- appstudio.redhat.com
149+
resources:
150+
- snapshots/finalizers
151+
verbs:
152+
- update
153+
- apiGroups:
154+
- appstudio.redhat.com
155+
resources:
156+
- snapshots/status
157+
verbs:
158+
- get
159+
- patch
160+
- update
76161
- apiGroups:
77162
- pipelinesascode.tekton.dev
78163
resources:

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ require (
9898
github.com/prometheus/statsd_exporter v0.26.1 // indirect
9999
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect
100100
github.com/stoewer/go-strcase v1.3.0 // indirect
101+
github.com/tektoncd/resolution v0.0.0-20220901133656-d680719abeaf // indirect
101102
go.opencensus.io v0.24.0 // indirect
102103
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
103104
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect

0 commit comments

Comments
 (0)