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
1 change: 1 addition & 0 deletions docs/cmd/tkn_pipeline_logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Show logs for given Pipeline and PipelineRun:
-h, --help help for logs
-L, --last show logs for last PipelineRun
--limit int lists number of PipelineRuns (default 5)
--prefix prefix each log line with the log source (task name and step name) (default true)
-t, --timestamps show logs with timestamp
```

Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/tkn-pipeline-logs.1
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Show Pipeline logs
\fB\-\-limit\fP=5
lists number of PipelineRuns

.PP
\fB\-\-prefix\fP[=true]
prefix each log line with the log source (task name and step name)

.PP
\fB\-t\fP, \fB\-\-timestamps\fP[=false]
show logs with timestamp
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/pipeline/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Show logs for given Pipeline and PipelineRun:
c.Flags().BoolVarP(&opts.Follow, "follow", "f", false, "stream live logs")
c.Flags().BoolVarP(&opts.Timestamps, "timestamps", "t", false, "show logs with timestamp")
c.Flags().IntVarP(&opts.Limit, "limit", "", 5, "lists number of PipelineRuns")
c.Flags().BoolVarP(&opts.Prefixing, "prefix", "", true, "prefix each log line with the log source (task name and step name)")

return c
}
Expand Down
36 changes: 36 additions & 0 deletions pkg/cmd/pipeline/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,24 @@ func TestPipelineLog_v1beta1(t *testing.T) {
wantError: false,
want: "",
},
{
name: "Logs with prefix enabled (default)",
command: []string{"logs", pipelineName, "-n", ns, "-L"},
namespace: ns,
dynamic: dc3,
input: cs3,
wantError: false,
want: "",
},
{
name: "Logs with prefix disabled",
command: []string{"logs", pipelineName, "-n", ns, "--last", "--prefix=false"},
namespace: ns,
dynamic: dc3,
input: cs3,
wantError: false,
want: "",
},
}

for _, tp := range testParams {
Expand Down Expand Up @@ -502,6 +520,24 @@ func TestPipelineLog(t *testing.T) {
wantError: false,
want: "",
},
{
name: "Logs with prefix enabled (default)",
command: []string{"logs", pipelineName, "-n", ns, "-L"},
namespace: ns,
dynamic: dc3,
input: cs3,
wantError: false,
want: "",
},
{
name: "Logs with prefix disabled",
command: []string{"logs", pipelineName, "-n", ns, "--last", "--prefix=false"},
namespace: ns,
dynamic: dc3,
input: cs3,
wantError: false,
want: "",
},
}

for _, tp := range testParams {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/pipeline/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestPipelineInteractiveStartE2E(t *testing.T) {
})

t.Run("Validate pipeline logs, with follow mode (-f) and --last ", func(t *testing.T) {
res := tkn.Run(t, "pipeline", "logs", "--last", "-f")
res := tkn.Run(t, "pipeline", "logs", "--last", "-f", "--prefix=false")
expected := "\n\ntest-e2e\n\n"
helper.AssertOutput(t, expected, res.Stdout())
})
Expand Down
Loading