Skip to content

Commit 78f4b64

Browse files
committed
add kcp api files; various golang source checks
1 parent 508a03c commit 78f4b64

8 files changed

+454
-6
lines changed

.github/workflows/go-ci.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,57 @@ on:
33
pull_request:
44
branches: [ main ]
55
jobs:
6+
go:
7+
name: Check sources
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Install Go
11+
uses: actions/setup-go@v3
12+
with:
13+
go-version: 1.17.x
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
- name: Install kcp tooling
17+
run: |
18+
git clone https://github.com/kcp-dev/kcp ~/kcp
19+
cd ~/kcp
20+
WHAT=./cmd/kubectl-kcp make install
21+
- name: Check go mod status
22+
run: |
23+
go mod tidy
24+
if [[ ! -z $(git status -s) ]]
25+
then
26+
echo "Go mod state is not clean:"
27+
git --no-pager diff
28+
exit 1
29+
fi
30+
- name: Check format
31+
run: |
32+
make fmt
33+
if [[ ! -z $(git status -s) ]]
34+
then
35+
echo "not all golang files properly gofmt'ed:"
36+
git --no-pager diff
37+
exit 1
38+
fi
39+
- name: Check generated
40+
run: |
41+
make generate
42+
if [[ ! -z $(git status -s) ]]
43+
then
44+
echo "generated sources are not up to date:"
45+
git --no-pager diff
46+
exit 1
47+
fi
48+
- name: Check kcp
49+
run: |
50+
CONTROL_PLANE=kcp make generate
51+
if [[ ! -z $(git status -s) ]]
52+
then
53+
echo "generated kcp sources are not up to date:"
54+
git --no-pager diff
55+
exit 1
56+
fi
657
unit:
758
name: Golang Unit tests
859
runs-on: ubuntu-latest

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ else
77
GOBIN=$(shell go env GOBIN)
88
endif
99

10+
# CONTROL_PLANE defines the type of cluster that will be used. Possible values are kubernetes (default) and kcp.
11+
CONTROL_PLANE ?= kubernetes
12+
1013
# options for generating crds with controller-gen
1114
CONTROLLER_GEN="${GOBIN}/controller-gen"
1215
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
@@ -43,6 +46,9 @@ generate-deepcopy-client:
4346
generate-crds:
4447
hack/install-controller-gen.sh
4548
"$(CONTROLLER_GEN)" "$(CRD_OPTIONS)" rbac:roleName=manager-role webhook paths=./pkg/apis/jvmbuildservice/v1alpha1 output:crd:artifacts:config=deploy/crds/base
49+
ifeq ($(CONTROL_PLANE), kcp)
50+
hack/generate-kcp-api.sh
51+
endif
4652

4753
generate: generate-crds generate-deepcopy-client
4854

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is generated from CRDs by ./hack/generate-kcp-api.sh script.
2+
# Please do not modify!
3+
4+
apiVersion: apis.kcp.dev/v1alpha1
5+
kind: APIExport
6+
metadata:
7+
name: has
8+
spec:
9+
latestResourceSchemas:
10+
- v202207261831.artifactbuilds.jvmbuildservice.io
11+
- v202207261831.dependencybuilds.jvmbuildservice.io
Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
# This file is generated from CRDs by ./hack/generate-kcp-api.sh script.
2+
# Please do not modify!
3+
4+
apiVersion: apis.kcp.dev/v1alpha1
5+
kind: APIResourceSchema
6+
metadata:
7+
creationTimestamp: null
8+
name: v202207261831.artifactbuilds.jvmbuildservice.io
9+
spec:
10+
group: jvmbuildservice.io
11+
names:
12+
kind: ArtifactBuild
13+
listKind: ArtifactBuildList
14+
plural: artifactbuilds
15+
singular: artifactbuild
16+
scope: Namespaced
17+
versions:
18+
- additionalPrinterColumns:
19+
- jsonPath: .spec.gav
20+
name: GAV
21+
type: string
22+
- jsonPath: .status.state
23+
name: State
24+
type: string
25+
name: v1alpha1
26+
schema:
27+
description: ArtifactBuild TODO provide godoc description
28+
properties:
29+
apiVersion:
30+
description: 'APIVersion defines the versioned schema of this representation
31+
of an object. Servers should convert recognized schemas to the latest
32+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
33+
type: string
34+
kind:
35+
description: 'Kind is a string value representing the REST resource this
36+
object represents. Servers may infer this from the endpoint the client
37+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
38+
type: string
39+
metadata:
40+
type: object
41+
spec:
42+
properties:
43+
gav:
44+
description: GAV is the groupID:artifactID:version tuple seen in maven
45+
pom.xml files
46+
type: string
47+
type: object
48+
status:
49+
properties:
50+
message:
51+
type: string
52+
scm:
53+
properties:
54+
path:
55+
type: string
56+
scmType:
57+
type: string
58+
scmURL:
59+
type: string
60+
tag:
61+
type: string
62+
type: object
63+
state:
64+
description: 'TODO: conditions?'
65+
type: string
66+
type: object
67+
required:
68+
- spec
69+
type: object
70+
served: true
71+
storage: true
72+
subresources:
73+
status: {}
74+
75+
---
76+
apiVersion: apis.kcp.dev/v1alpha1
77+
kind: APIResourceSchema
78+
metadata:
79+
creationTimestamp: null
80+
name: v202207261831.dependencybuilds.jvmbuildservice.io
81+
spec:
82+
group: jvmbuildservice.io
83+
names:
84+
kind: DependencyBuild
85+
listKind: DependencyBuildList
86+
plural: dependencybuilds
87+
singular: dependencybuild
88+
scope: Namespaced
89+
versions:
90+
- additionalPrinterColumns:
91+
- jsonPath: .spec.scm.scmURL
92+
name: URL
93+
type: string
94+
- jsonPath: .spec.scm.tag
95+
name: Tag
96+
type: string
97+
- jsonPath: .status.state
98+
name: State
99+
type: string
100+
- jsonPath: .status.message
101+
name: Message
102+
type: string
103+
name: v1alpha1
104+
schema:
105+
description: DependencyBuild TODO provide godoc description
106+
properties:
107+
apiVersion:
108+
description: 'APIVersion defines the versioned schema of this representation
109+
of an object. Servers should convert recognized schemas to the latest
110+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
111+
type: string
112+
kind:
113+
description: 'Kind is a string value representing the REST resource this
114+
object represents. Servers may infer this from the endpoint the client
115+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
116+
type: string
117+
metadata:
118+
type: object
119+
spec:
120+
properties:
121+
scm:
122+
properties:
123+
path:
124+
type: string
125+
scmType:
126+
type: string
127+
scmURL:
128+
type: string
129+
tag:
130+
type: string
131+
type: object
132+
version:
133+
type: string
134+
type: object
135+
status:
136+
properties:
137+
conditions:
138+
description: 'Conditions for capturing generic status NOTE: inspecting
139+
the fabric8 Status class, it looked analogous to k8s Condition, and
140+
then I took the liberty of making it an array, given best practices
141+
in the k8s/ocp ecosystems'
142+
items:
143+
description: "Condition contains details for one aspect of the current
144+
state of this API Resource. --- This struct is intended for direct
145+
use as an array at the field path .status.conditions. For example,
146+
type FooStatus struct{ // Represents the observations of a foo's
147+
current state. // Known .status.conditions.type are: \"Available\",
148+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type //
149+
+patchStrategy=merge // +listType=map // +listMapKey=type
150+
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
151+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
152+
\n // other fields }"
153+
properties:
154+
lastTransitionTime:
155+
description: lastTransitionTime is the last time the condition
156+
transitioned from one status to another. This should be when
157+
the underlying condition changed. If that is not known, then
158+
using the time when the API field changed is acceptable.
159+
format: date-time
160+
type: string
161+
message:
162+
description: message is a human readable message indicating details
163+
about the transition. This may be an empty string.
164+
maxLength: 32768
165+
type: string
166+
observedGeneration:
167+
description: observedGeneration represents the .metadata.generation
168+
that the condition was set based upon. For instance, if .metadata.generation
169+
is currently 12, but the .status.conditions[x].observedGeneration
170+
is 9, the condition is out of date with respect to the current
171+
state of the instance.
172+
format: int64
173+
minimum: 0
174+
type: integer
175+
reason:
176+
description: reason contains a programmatic identifier indicating
177+
the reason for the condition's last transition. Producers of
178+
specific condition types may define expected values and meanings
179+
for this field, and whether the values are considered a guaranteed
180+
API. The value should be a CamelCase string. This field may
181+
not be empty.
182+
maxLength: 1024
183+
minLength: 1
184+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
185+
type: string
186+
status:
187+
description: status of the condition, one of True, False, Unknown.
188+
enum:
189+
- "True"
190+
- "False"
191+
- Unknown
192+
type: string
193+
type:
194+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
195+
--- Many .condition.type values are consistent across resources
196+
like Available, but because arbitrary conditions can be useful
197+
(see .node.status.conditions), the ability to deconflict is
198+
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
199+
maxLength: 316
200+
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])$
201+
type: string
202+
required:
203+
- lastTransitionTime
204+
- message
205+
- reason
206+
- status
207+
- type
208+
type: object
209+
type: array
210+
contaminates:
211+
items:
212+
type: string
213+
type: array
214+
currentBuildRecipe:
215+
description: BuildRecipe the current build recipe. If build is done
216+
then this recipe was used to get to the current state
217+
properties:
218+
commandLine:
219+
items:
220+
type: string
221+
type: array
222+
enforceVersion:
223+
type: string
224+
gradle:
225+
type: boolean
226+
ignoredArtifacts:
227+
items:
228+
type: string
229+
type: array
230+
image:
231+
type: string
232+
maven:
233+
type: boolean
234+
task:
235+
description: deprecated task string
236+
type: string
237+
type: object
238+
failedBuildRecipes:
239+
description: FailedBuildRecipes recipes that resulted in a failure if
240+
the current state is failed this may include the current BuildRecipe
241+
items:
242+
properties:
243+
commandLine:
244+
items:
245+
type: string
246+
type: array
247+
enforceVersion:
248+
type: string
249+
gradle:
250+
type: boolean
251+
ignoredArtifacts:
252+
items:
253+
type: string
254+
type: array
255+
image:
256+
type: string
257+
maven:
258+
type: boolean
259+
task:
260+
description: deprecated task string
261+
type: string
262+
type: object
263+
type: array
264+
lastCompletedBuildTaskRun:
265+
type: string
266+
message:
267+
type: string
268+
potentialBuildRecipes:
269+
description: PotentialBuildRecipes additional recipes to try if the
270+
current recipe fails
271+
items:
272+
properties:
273+
commandLine:
274+
items:
275+
type: string
276+
type: array
277+
enforceVersion:
278+
type: string
279+
gradle:
280+
type: boolean
281+
ignoredArtifacts:
282+
items:
283+
type: string
284+
type: array
285+
image:
286+
type: string
287+
maven:
288+
type: boolean
289+
task:
290+
description: deprecated task string
291+
type: string
292+
type: object
293+
type: array
294+
state:
295+
type: string
296+
type: object
297+
required:
298+
- spec
299+
type: object
300+
served: true
301+
storage: true
302+
subresources:
303+
status: {}
304+
305+
---

0 commit comments

Comments
 (0)