Skip to content

Commit 4a460bb

Browse files
committed
add buildpacks native build
1 parent e7fdc0b commit 4a460bb

File tree

2 files changed

+122
-2
lines changed

2 files changed

+122
-2
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{{- if eq .Values.buildstrategy "buildpacks" }}
2+
{{- $name := printf "%s-%s-%s" .Values.app .Values.pipeline .Values.id -}}
3+
apiVersion: batch/v1
4+
kind: Job
5+
metadata:
6+
generation: 1
7+
labels:
8+
batch.kubernetes.io/job-name: {{ $name }}
9+
buildstrategy: buildpacks
10+
kuberoapp: {{ .Values.app }}
11+
kuberopipeline: {{ .Values.pipeline }}
12+
job-name: {{ $name }}
13+
name: {{ $name }}
14+
spec:
15+
backoffLimit: 1
16+
completionMode: NonIndexed
17+
completions: 1
18+
manualSelector: false
19+
parallelism: 1
20+
podReplacementPolicy: TerminatingOrFailed
21+
suspend: false
22+
template:
23+
metadata:
24+
creationTimestamp: null
25+
labels:
26+
batch.kubernetes.io/job-name: {{ $name }}
27+
buildstrategy: {{ .Values.buildstrategy }}
28+
kuberoapp: {{ .Values.app }}
29+
kuberopipeline: {{ .Values.pipeline }}
30+
job-name: {{ $name }}
31+
spec:
32+
automountServiceAccountToken: true
33+
securityContext:
34+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
35+
containers:
36+
- env:
37+
- name: REPOSITORY
38+
value: {{ .Values.repository.image }}
39+
- name: TAG
40+
value: {{ .Values.repository.tag | default "latest"}}
41+
- name: APP
42+
value: {{ .Values.app }}
43+
command:
44+
- sh
45+
- -c
46+
- 'kubectl patch kuberoapps $APP --type=merge -p "{\"spec\":{\"image\":{\"repository\":
47+
\"$REPOSITORY\",\"tag\": \"$TAG\"}}}"'
48+
image: bitnami/kubectl:latest
49+
imagePullPolicy: Always
50+
name: deploy
51+
resources: {}
52+
terminationMessagePath: /dev/termination-log
53+
terminationMessagePolicy: File
54+
initContainers:
55+
- name: fetch
56+
env:
57+
- name: GIT_REPOSITORY
58+
value: {{ .Values.git.url }}
59+
- name: GIT_REF
60+
value: {{ .Values.git.ref }}
61+
- name: KUBERO_BUILDPACK_DEFAULT_RUN_CMD
62+
value: "exit 0"
63+
- name: KUBERO_BUILDPACK_DEFAULT_BUILD_CMD
64+
value: "exit 0"
65+
image: {{ .Values.nixpack.fetcher }}
66+
imagePullPolicy: Always
67+
resources: {}
68+
securityContext:
69+
readOnlyRootFilesystem: false
70+
terminationMessagePath: /dev/termination-log
71+
terminationMessagePolicy: File
72+
volumeMounts:
73+
- mountPath: /home/kubero/.ssh-mounted
74+
name: deployment-keys
75+
readOnly: true
76+
- mountPath: /app
77+
name: app-storage
78+
workingDir: /app
79+
- name: build
80+
args:
81+
- '-app=.'
82+
- {{ .Values.repository.image }}:{{ .Values.repository.tag | default "latest"}}
83+
command: ['/cnb/lifecycle/creator']
84+
#command: ['/cnb/lifecycle/creator', '-app=.', 'kubero-local-dev-0037732.loca.lt/example/exampled:latest']
85+
#command: ['/cnb/lifecycle/creator', '-app=.', '-buildpacks=/cnb/buildpacks', '-platform=/platform', '-run-image=ghcr.io/kubero-dev/run:v1.4.0', '-uid=1000', '-gid=1000', 'kubero-local-dev-0037732.loca.lt/example/exampled:latest']
86+
#command: ['tail', '-f', '/dev/null']
87+
image: gcr.io/paketo-buildpacks/builder:base
88+
imagePullPolicy: Always
89+
resources: {}
90+
securityContext:
91+
privileged: true
92+
terminationMessagePath: /dev/termination-log
93+
terminationMessagePolicy: File
94+
volumeMounts:
95+
- mountPath: /app
96+
name: app-storage
97+
readOnly: false
98+
- mountPath: /home/cnb/.docker
99+
name: docker-config
100+
readOnly: true
101+
workingDir: /app
102+
restartPolicy: Never
103+
schedulerName: default-scheduler
104+
securityContext: {}
105+
serviceAccount: {{ .Values.app }}-kuberoapp
106+
serviceAccountName: {{ .Values.app }}-kuberoapp
107+
terminationGracePeriodSeconds: 30
108+
volumes:
109+
- name: deployment-keys
110+
secret:
111+
defaultMode: 0666
112+
secretName: deployment-keys
113+
- emptyDir: {}
114+
name: app-storage
115+
- name: pull-secret
116+
secret:
117+
defaultMode: 384
118+
secretName: kubero-pull-secret
119+
ttlSecondsAfterFinished: 31536000
120+
{{- end }}

helm-charts/kuberobuild/templates/job-buildpack.yaml renamed to helm-charts/kuberobuild/templates/job-kpack.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{{- if eq .Values.buildstrategy "buildpacks" }}
1+
{{- if eq .Values.buildstrategy "kpack" }}
22
{{- $name := printf "%s-%s-%s" .Values.app .Values.pipeline .Values.id -}}
33
apiVersion: batch/v1
44
kind: Job
55
metadata:
66
labels:
77
batch.kubernetes.io/job-name: {{ $name }}
8-
buildstrategy: buildpacks
8+
buildstrategy: kpack
99
kuberoapp: {{ .Values.app }}
1010
kuberopipeline: {{ .Values.pipeline }}
1111
job-name: {{ $name }}

0 commit comments

Comments
 (0)