Skip to content

Commit 1e3fcd2

Browse files
committed
Migrate frontend builds to use shared Dockerfile
https://issues.redhat.com/browse/COST-5927
1 parent ddb986e commit 1e3fcd2

File tree

5 files changed

+132
-125
lines changed

5 files changed

+132
-125
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "build-tools"]
2+
path = build-tools
3+
url = https://github.com/RedHatInsights/insights-frontend-builder-common.git

.tekton/koku-frontend-pull-request.yaml

+1-62
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
- name: image-expires-after
3232
value: 5d
3333
- name: dockerfile
34-
value: Dockerfile
34+
value: build-tools/Dockerfile
3535
- name: path-context
3636
value: .
3737
pipelineSpec:
@@ -210,66 +210,6 @@ spec:
210210
workspace: git-auth
211211
- name: netrc
212212
workspace: netrc
213-
- name: parse-build-deploy-script
214-
params:
215-
- name: path-context
216-
value: $(params.path-context)
217-
taskRef:
218-
resolver: git
219-
params:
220-
- name: url
221-
value: https://github.com/RedHatInsights/konflux-consoledot-frontend-build
222-
- name: revision
223-
value: c0ff4861d5aa77584f51576b65f2eb9e12e1ded8
224-
- name: pathInRepo
225-
value: tasks/parse-build-deploy-script/parse-build-deploy-script.yaml
226-
workspaces:
227-
- name: source
228-
workspace: workspace
229-
runAfter:
230-
- clone-repository
231-
- name: create-frontend-dockerfile
232-
taskRef:
233-
resolver: git
234-
params:
235-
- name: url
236-
value: https://github.com/RedHatInsights/konflux-consoledot-frontend-build
237-
- name: revision
238-
value: a6838b71b88dc1e84f11764c9734e4880096585d # replace with the latest commit from https://github.com/RedHatInsights/konflux-consoledot-frontend-build/commits
239-
- name: pathInRepo
240-
value: tasks/create-frontend-dockerfile/create-frontend-dockerfile.yaml
241-
workspaces:
242-
- name: source
243-
workspace: workspace
244-
params:
245-
- name: path-context
246-
value: $(params.path-context)
247-
- name: component
248-
value: $(tasks.parse-build-deploy-script.results.component)
249-
- name: image
250-
value: $(tasks.parse-build-deploy-script.results.image)
251-
- name: node-build-version
252-
value: $(tasks.parse-build-deploy-script.results.node-build-version)
253-
- name: quay-expire-time
254-
value: $(tasks.parse-build-deploy-script.results.quay-expire-time)
255-
- name: npm-build-script
256-
value: $(tasks.parse-build-deploy-script.results.npm-build-script)
257-
- name: yarn-build-script
258-
value: $(tasks.parse-build-deploy-script.results.yarn-build-script)
259-
- name: route-path
260-
value: $(tasks.parse-build-deploy-script.results.route-path)
261-
- name: beta-route-path
262-
value: $(tasks.parse-build-deploy-script.results.beta-route-path)
263-
- name: preview-route-path
264-
value: $(tasks.parse-build-deploy-script.results.preview-route-path)
265-
- name: ci-root
266-
value: $(tasks.parse-build-deploy-script.results.ci-root)
267-
- name: server-name
268-
value: $(tasks.parse-build-deploy-script.results.server-name)
269-
- name: dist-folder
270-
value: $(tasks.parse-build-deploy-script.results.dist-folder)
271-
runAfter:
272-
- parse-build-deploy-script
273213
- name: build-container
274214
params:
275215
- name: IMAGE
@@ -293,7 +233,6 @@ spec:
293233
value: $(params.build-args-file)
294234
runAfter:
295235
- prefetch-dependencies
296-
- create-frontend-dockerfile
297236
taskRef:
298237
params:
299238
- name: name

.tekton/koku-frontend-push.yaml

+1-62
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spec:
2828
- name: output-image
2929
value: quay.io/redhat-user-workloads/cost-mgmt-dev-tenant/koku-frontend:{{revision}}
3030
- name: dockerfile
31-
value: Dockerfile
31+
value: build-tools/Dockerfile
3232
- name: path-context
3333
value: .
3434
pipelineSpec:
@@ -207,66 +207,6 @@ spec:
207207
workspace: git-auth
208208
- name: netrc
209209
workspace: netrc
210-
- name: parse-build-deploy-script
211-
params:
212-
- name: path-context
213-
value: $(params.path-context)
214-
taskRef:
215-
resolver: git
216-
params:
217-
- name: url
218-
value: https://github.com/RedHatInsights/konflux-consoledot-frontend-build
219-
- name: revision
220-
value: c0ff4861d5aa77584f51576b65f2eb9e12e1ded8
221-
- name: pathInRepo
222-
value: tasks/parse-build-deploy-script/parse-build-deploy-script.yaml
223-
workspaces:
224-
- name: source
225-
workspace: workspace
226-
runAfter:
227-
- clone-repository
228-
- name: create-frontend-dockerfile
229-
taskRef:
230-
resolver: git
231-
params:
232-
- name: url
233-
value: https://github.com/RedHatInsights/konflux-consoledot-frontend-build
234-
- name: revision
235-
value: a6838b71b88dc1e84f11764c9734e4880096585d # replace with the latest commit from https://github.com/RedHatInsights/konflux-consoledot-frontend-build/commits
236-
- name: pathInRepo
237-
value: tasks/create-frontend-dockerfile/create-frontend-dockerfile.yaml
238-
workspaces:
239-
- name: source
240-
workspace: workspace
241-
params:
242-
- name: path-context
243-
value: $(params.path-context)
244-
- name: component
245-
value: $(tasks.parse-build-deploy-script.results.component)
246-
- name: image
247-
value: $(tasks.parse-build-deploy-script.results.image)
248-
- name: node-build-version
249-
value: $(tasks.parse-build-deploy-script.results.node-build-version)
250-
- name: quay-expire-time
251-
value: $(tasks.parse-build-deploy-script.results.quay-expire-time)
252-
- name: npm-build-script
253-
value: $(tasks.parse-build-deploy-script.results.npm-build-script)
254-
- name: yarn-build-script
255-
value: $(tasks.parse-build-deploy-script.results.yarn-build-script)
256-
- name: route-path
257-
value: $(tasks.parse-build-deploy-script.results.route-path)
258-
- name: beta-route-path
259-
value: $(tasks.parse-build-deploy-script.results.beta-route-path)
260-
- name: preview-route-path
261-
value: $(tasks.parse-build-deploy-script.results.preview-route-path)
262-
- name: ci-root
263-
value: $(tasks.parse-build-deploy-script.results.ci-root)
264-
- name: server-name
265-
value: $(tasks.parse-build-deploy-script.results.server-name)
266-
- name: dist-folder
267-
value: $(tasks.parse-build-deploy-script.results.dist-folder)
268-
runAfter:
269-
- parse-build-deploy-script
270210
- name: build-container
271211
params:
272212
- name: IMAGE
@@ -290,7 +230,6 @@ spec:
290230
value: $(params.build-args-file)
291231
runAfter:
292232
- prefetch-dependencies
293-
- create-frontend-dockerfile
294233
taskRef:
295234
params:
296235
- name: name

build-tools

Submodule build-tools added at 3fad2bd

src/store/metrics/selectors.ts

+126-1
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,138 @@ export const metrics = (state: RootState): MetricHash => {
2323
if (metricsPayload === null) {
2424
return {};
2525
}
26-
return metricsPayload.data.reduce((acc, curr) => {
26+
27+
metricsPayload.data = [
28+
{
29+
source_type: 'OCP',
30+
metric: 'cluster_core_cost_per_hour',
31+
label_metric: 'Cluster',
32+
label_measurement: 'Count',
33+
label_measurement_unit: 'core-hour',
34+
default_cost_type: 'Infrastructure',
35+
},
36+
{
37+
source_type: 'OCP',
38+
metric: 'vm_cost_per_month',
39+
label_metric: 'Virtual Machine',
40+
label_measurement: 'Count',
41+
label_measurement_unit: 'vm-month',
42+
default_cost_type: 'Infrastructure',
43+
},
44+
{
45+
source_type: 'OpenShift Container Platform',
46+
metric: 'cpu_core_usage_per_hour',
47+
label_metric: 'CPU',
48+
label_measurement: 'Usage',
49+
label_measurement_unit: 'core-hours',
50+
default_cost_type: 'Supplementary',
51+
},
52+
{
53+
source_type: 'OpenShift Container Platform',
54+
metric: 'cpu_core_request_per_hour',
55+
label_metric: 'CPU',
56+
label_measurement: 'Request',
57+
label_measurement_unit: 'core-hours',
58+
default_cost_type: 'Supplementary',
59+
},
60+
{
61+
source_type: 'OpenShift Container Platform',
62+
metric: 'cpu_core_effective_usage_per_hour',
63+
label_metric: 'CPU',
64+
label_measurement: 'Effective-usage',
65+
label_measurement_unit: 'core-hours',
66+
default_cost_type: 'Supplementary',
67+
},
68+
{
69+
source_type: 'OpenShift Container Platform',
70+
metric: 'memory_gb_usage_per_hour',
71+
label_metric: 'Memory',
72+
label_measurement: 'Usage',
73+
label_measurement_unit: 'GiB-hours',
74+
default_cost_type: 'Supplementary',
75+
},
76+
{
77+
source_type: 'OpenShift Container Platform',
78+
metric: 'memory_gb_request_per_hour',
79+
label_metric: 'Memory',
80+
label_measurement: 'Request',
81+
label_measurement_unit: 'GiB-hours',
82+
default_cost_type: 'Supplementary',
83+
},
84+
{
85+
source_type: 'OpenShift Container Platform',
86+
metric: 'memory_gb_effective_usage_per_hour',
87+
label_metric: 'Memory',
88+
label_measurement: 'Effective-usage',
89+
label_measurement_unit: 'GiB-hours',
90+
default_cost_type: 'Supplementary',
91+
},
92+
{
93+
source_type: 'OpenShift Container Platform',
94+
metric: 'storage_gb_usage_per_month',
95+
label_metric: 'Storage',
96+
label_measurement: 'Usage',
97+
label_measurement_unit: 'GiB-month',
98+
default_cost_type: 'Supplementary',
99+
},
100+
{
101+
source_type: 'OpenShift Container Platform',
102+
metric: 'storage_gb_request_per_month',
103+
label_metric: 'Storage',
104+
label_measurement: 'Request',
105+
label_measurement_unit: 'GiB-month',
106+
default_cost_type: 'Supplementary',
107+
},
108+
{
109+
source_type: 'OpenShift Container Platform',
110+
metric: 'node_core_cost_per_hour',
111+
label_metric: 'Node',
112+
label_measurement: 'Count',
113+
label_measurement_unit: 'core-hour',
114+
default_cost_type: 'Infrastructure',
115+
},
116+
{
117+
source_type: 'OpenShift Container Platform',
118+
metric: 'node_cost_per_month',
119+
label_metric: 'Node',
120+
label_measurement: 'Count',
121+
label_measurement_unit: 'node-month',
122+
default_cost_type: 'Infrastructure',
123+
},
124+
{
125+
source_type: 'OpenShift Container Platform',
126+
metric: 'node_core_cost_per_month',
127+
label_metric: 'Node',
128+
label_measurement: 'Count',
129+
label_measurement_unit: 'core-month',
130+
default_cost_type: 'Infrastructure',
131+
},
132+
{
133+
source_type: 'OpenShift Container Platform',
134+
metric: 'cluster_cost_per_month',
135+
label_metric: 'Cluster',
136+
label_measurement: 'Count',
137+
label_measurement_unit: 'cluster-month',
138+
default_cost_type: 'Infrastructure',
139+
},
140+
{
141+
source_type: 'OpenShift Container Platform',
142+
metric: 'pvc_cost_per_month',
143+
label_metric: 'Persistent volume claims',
144+
label_measurement: 'Count',
145+
label_measurement_unit: 'pvc-month',
146+
default_cost_type: 'Infrastructure',
147+
},
148+
] as any;
149+
150+
const test = metricsPayload.data.reduce((acc, curr) => {
27151
const prev = acc[curr.label_metric] ? { ...acc[curr.label_metric] } : {};
28152
return {
29153
...acc,
30154
[curr.label_metric]: { ...prev, [curr.metric]: curr },
31155
};
32156
}, {});
157+
return test;
33158
};
34159

35160
export const maxRate = (state: RootState): number => {

0 commit comments

Comments
 (0)