Skip to content

[release-4.17] OCPBUGS-55924: Fetching taskRuns in PLR details page using PLR UID also #15029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release-4.17
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ const TaskRuns: React.FC<TaskRunsProps> = ({ obj }) => {
</Helmet>
<TaskRunsListPage
showTitle={false}
selector={{ matchLabels: { 'tekton.dev/pipelineRun': obj.metadata.name } }}
selector={{
matchLabels: {
'tekton.dev/pipelineRun': obj.metadata.name,
'tekton.dev/pipelineRunUID': obj.metadata?.uid,
},
}}
showPipelineColumn={false}
namespace={obj.metadata.namespace}
hideBadge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@ export const useTaskRuns = (
pipelineRunName?: string,
taskName?: string,
cacheKey?: string,
pipelineRunUid?: string,
): [TaskRunKind[], boolean, unknown, GetNextPage] => {
const selector: Selector = React.useMemo(() => {
if (pipelineRunName && pipelineRunUid) {
return {
matchLabels: {
[TektonResourceLabel.pipelinerun]: pipelineRunName,
[TektonResourceLabel.pipelineRunUid]: pipelineRunUid,
},
};
}
if (pipelineRunName) {
return { matchLabels: { [TektonResourceLabel.pipelinerun]: pipelineRunName } };
}
if (taskName) {
return { matchLabels: { [TektonResourceLabel.pipelineTask]: taskName } };
}
return undefined;
}, [taskName, pipelineRunName]);
}, [taskName, pipelineRunName, pipelineRunUid]);
const [taskRuns, loaded, error, getNextPage] = useTaskRuns2(
namespace,
selector && {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export enum TektonTaskLabel {
export enum TektonResourceLabel {
pipeline = 'tekton.dev/pipeline',
pipelinerun = 'tekton.dev/pipelineRun',
pipelineRunUid = 'tekton.dev/pipelineRunUID',
taskrun = 'tekton.dev/taskRun',
pipelineTask = 'tekton.dev/pipelineTask',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ const TaskRunsListPage: React.FC<
const ns = namespace || params?.ns;
const badge = usePipelineTechPreviewBadge(ns);
const trForPlr = props.selector && props.selector?.matchLabels?.['tekton.dev/pipelineRun'];
const [taskRuns, taskRunsLoaded, taskRunsLoadError, getNextPage] = useTaskRuns(ns, trForPlr);
const trForPlrUid = props.selector && props.selector?.matchLabels?.['tekton.dev/pipelineRunUID'];
const [taskRuns, taskRunsLoaded, taskRunsLoadError, getNextPage] = useTaskRuns(
ns,
trForPlr,
undefined,
undefined,
trForPlrUid,
);

const taskRunsResource = {
[referenceForModel(TaskRunModel)]: {
Expand Down