Skip to content

Commit 86c1408

Browse files
committed
Pass token to Results API
1 parent fdc4fa0 commit 86c1408

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/components/utils/proxy.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { safeLoad } from 'js-yaml';
21
import { consoleFetchJSON } from '@openshift-console/dynamic-plugin-sdk';
2+
import { safeLoad } from 'js-yaml';
33

44
export const API_PROXY_URL = '/api/dev-console/proxy/internet';
55

6-
type ProxyRequest = {
6+
export type ProxyRequest = {
7+
allowAuthHeader?: boolean;
78
allowInsecure?: boolean;
89
method: string;
910
url: string;

src/components/utils/summary-api.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const getResultsSummary = async (
2424
url,
2525
method: 'GET',
2626
allowInsecure: true,
27+
allowAuthHeader: true,
2728
});
2829

2930
return sData;

src/components/utils/tekton-results.ts

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import {
3+
k8sGet,
34
K8sResourceCommon,
45
MatchExpression,
56
MatchLabels,
67
Selector,
7-
k8sGet,
88
} from '@openshift-console/dynamic-plugin-sdk';
99
import _ from 'lodash';
1010
import {
@@ -15,7 +15,11 @@ import {
1515
import { RouteModel, TektonResultModel } from '../../models';
1616
import { PipelineRunKind, TaskRunKind } from '../../types';
1717
import { K8sResourceKind } from '../../types/openshift';
18-
import { consoleProxyFetch, consoleProxyFetchJSON } from './proxy';
18+
import {
19+
consoleProxyFetch,
20+
consoleProxyFetchJSON,
21+
ProxyRequest,
22+
} from './proxy';
1923

2024
// REST API spec
2125
// https://github.com/tektoncd/results/blob/main/docs/api/rest-api-spec.md
@@ -63,15 +67,6 @@ export type TektonResultsOptions = {
6367
groupBy?: string;
6468
};
6569

66-
type ProxyRequest = {
67-
allowInsecure?: boolean;
68-
method: string;
69-
url: string;
70-
headers?: Record<string, string[]>;
71-
queryparams?: Record<string, string[]>;
72-
body?: string;
73-
};
74-
7570
const throw404 = () => {
7671
// eslint-disable-next-line no-throw-literal
7772
throw { code: 404 };
@@ -334,6 +329,7 @@ export const getFilteredRecord = async <R extends K8sResourceCommon>(
334329
url,
335330
method: 'GET',
336331
allowInsecure: true,
332+
allowAuthHeader: true,
337333
});
338334
if (options?.limit >= 0) {
339335
list = {
@@ -489,5 +485,10 @@ export const getTaskRunLog = async (taskRunPath: string): Promise<string> => {
489485
'/records/',
490486
'/logs/',
491487
)}`;
492-
return consoleProxyFetchLog({ url, method: 'GET', allowInsecure: true });
488+
return consoleProxyFetchLog({
489+
url,
490+
method: 'GET',
491+
allowInsecure: true,
492+
allowAuthHeader: true,
493+
});
493494
};

0 commit comments

Comments
 (0)