Skip to content

Commit 395ac92

Browse files
Merge pull request #13654 from vikram-raj/ocpbugs-30551
OCPBUGS-30551: Switch to service to get the PLR and TR logs from the Tekton results summary API
2 parents 03cecd0 + ed0acbb commit 395ac92

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

  • frontend/packages/pipelines-plugin/src/components/pipelineruns/utils

frontend/packages/pipelines-plugin/src/components/pipelineruns/utils/tekton-results.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
MatchLabels,
66
Selector,
77
} from '@console/dynamic-plugin-sdk/src';
8-
import { RouteModel } from '@console/internal/models';
98
import { k8sGet } from '@console/internal/module/k8s';
109
import { ALL_NAMESPACES_KEY } from '@console/shared/src/constants';
1110
import { consoleProxyFetch, consoleProxyFetchJSON } from '@console/shared/src/utils/proxy';
@@ -205,22 +204,7 @@ export const clearCache = () => {
205204
};
206205
const InFlightStore: { [key: string]: boolean } = {};
207206

208-
// const getTRUrlPrefix = (): string => URL_PREFIX;
209-
210207
export const getTRURLHost = async () => {
211-
const tektonResult = await k8sGet(TektonResultModel, 'result');
212-
const targetNamespace = tektonResult?.spec?.targetNamespace;
213-
const route = await k8sGet(RouteModel, 'tekton-results-api-service', targetNamespace);
214-
return route?.spec.host;
215-
};
216-
217-
export const createTektonResultsUrl = async (
218-
namespace: string,
219-
dataType?: DataType,
220-
filter?: string,
221-
options?: TektonResultsOptions,
222-
nextPageToken?: string,
223-
): Promise<string> => {
224208
const tektonResult = await k8sGet(TektonResultModel, 'result');
225209
const targetNamespace = tektonResult?.spec?.targetNamespace;
226210
const serverPort = tektonResult?.spec?.server_port ?? '8080';
@@ -233,6 +217,17 @@ export const createTektonResultsUrl = async (
233217
} else {
234218
tektonResultsAPI = `tekton-results-api-service.openshift-pipelines.svc.cluster.local:${serverPort}`;
235219
}
220+
return tektonResultsAPI;
221+
};
222+
223+
export const createTektonResultsUrl = async (
224+
namespace: string,
225+
dataType?: DataType,
226+
filter?: string,
227+
options?: TektonResultsOptions,
228+
nextPageToken?: string,
229+
): Promise<string> => {
230+
const tektonResultsAPI = await getTRURLHost();
236231
const namespaceToSearch = namespace && namespace !== ALL_NAMESPACES_KEY ? namespace : '-';
237232
const url = `https://${tektonResultsAPI}/apis/results.tekton.dev/v1alpha2/parents/${namespaceToSearch}/results/-/records?${new URLSearchParams(
238233
{

0 commit comments

Comments
 (0)