Skip to content

Commit

Permalink
Switch to service from external result route endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vikram-raj committed Feb 22, 2024
1 parent 803df88 commit d3bf9c0
Showing 1 changed file with 12 additions and 4 deletions.
Expand Up @@ -220,11 +220,19 @@ export const createTektonResultsUrl = async (
options?: TektonResultsOptions,
nextPageToken?: string,
): Promise<string> => {
const tektonResultUrl = await getTRURLHost();
if (!tektonResultUrl) {
throw new Error('route.spec.host is undefined');
const tektonResult = await k8sGet(TektonResultModel, 'result');
const targetNamespace = tektonResult?.spec?.targetNamespace;
const serverPort = tektonResult?.spec?.server_port ?? '8080';
const tlsHostname = tektonResult?.spec?.tls_hostname_override;
let tektonResultsAPI;
if (tlsHostname) {
tektonResultsAPI = `${tlsHostname}:${serverPort}`;
} else if (targetNamespace && serverPort) {
tektonResultsAPI = `tekton-results-api-service.${targetNamespace}.svc.cluster.local:${serverPort}`;
} else {
tektonResultsAPI = `tekton-results-api-service.openshift-pipelines.svc.cluster.local:${serverPort}`;
}
const url = `https://${tektonResultUrl}/apis/results.tekton.dev/v1alpha2/parents/${namespace}/results/-/records?${new URLSearchParams(
const url = `https://${tektonResultsAPI}/apis/results.tekton.dev/v1alpha2/parents/${namespace}/results/-/records?${new URLSearchParams(
{
// default sort should always be by `create_time desc`
// order_by: 'create_time desc', not supported yet
Expand Down

0 comments on commit d3bf9c0

Please sign in to comment.