Skip to content
Merged
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
4 changes: 3 additions & 1 deletion packages/components/src/components/Log/Log.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2025 The Tekton Authors
Copyright 2019-2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -422,6 +422,8 @@ export class LogContainer extends Component {
loadLog = async () => {
// In development mode this request is duplicated due to usage of StrictMode component wrapper
// It highlights a potential problem but only affects local dev and not production mode
this.cancelled = false;

const { fetchLogs, forcePolling, intl, stepStatus, pollingInterval } =
this.props;
if (!fetchLogs) {
Expand Down
5 changes: 3 additions & 2 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ export function getLogsRetriever({
return ({ stepName, stepStatus, taskRun }) =>
fetchLogs({
stepName,
stream: isLogStreamingEnabled,
stepStatus,
stream: isLogStreamingEnabled,
taskRun
}).catch(() => {
onFallback(true);
Expand All @@ -165,7 +165,8 @@ export function getLogsRetriever({
});
}

return fetchLogs;
return ({ stepName, stepStatus, taskRun }) =>
fetchLogs({ stepName, stepStatus, stream: isLogStreamingEnabled, taskRun });
}

// K8s label documentation comes from here:
Expand Down
13 changes: 13 additions & 0 deletions src/utils/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,19 @@ describe('getLogsRetriever', () => {
});
});

it('should handle default logs retriever with streaming enabled', () => {
vi.spyOn(API, 'getPodLog').mockImplementation(() => {});
const logsRetriever = getLogsRetriever({ isLogStreamingEnabled: true });
expect(logsRetriever).toBeDefined();
logsRetriever({ stepName, stepStatus, taskRun });
expect(API.getPodLog).toHaveBeenCalledWith({
container: stepName,
name: podName,
namespace,
stream: true
});
});

it('should handle default logs retriever with external fallback enabled', async () => {
const externalLogsURL = 'fake_externalLogsURL';
vi.spyOn(API, 'getPodLog').mockImplementation(() => {});
Expand Down
Loading