Bug 1973643 - oc logs doesn't work with piepeline builds
Summary: oc logs doesn't work with piepeline builds
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.8
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.9.0
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks: 1974267
TreeView+ depends on / blocked
 
Reported: 2021-06-18 11:43 UTC by Maciej Szulik
Modified: 2021-10-18 17:35 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Missing client setup in logs command. Consequence: oc logs doesn't work with pipeline builds. Fix: Properly setup client in logs command. Result: oc logs works with pipeline builds.
Clone Of:
Environment:
Last Closed: 2021-10-18 17:35:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 863 0 None open Bug 1973643: make oc logs work with BuildConfig's JenkinsPipeline strategy 2021-06-18 11:45:33 UTC
Red Hat Product Errata RHSA-2021:3759 0 None None None 2021-10-18 17:35:45 UTC

Description Maciej Szulik 2021-06-18 11:43:19 UTC
Description of problem:
oc logs doesn't work against BuildConfig with JenkinsPipelineStrategy defined. 


How reproducible:
Always


Steps to Reproduce:
1. create BuildConfig with JenkinsPipelineStrategy
2. oc logs bc/<name>


Actual results:
Command fails with:

$ oc logs -f bc/jenkins-verifyservice-pipeline
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x34e930d]

goroutine 1 [running]:
github.com/openshift/oc/pkg/cli/logs.(*LogsOptions).RunLog(0xc000699380, 0x0, 0x3fb0338)
	/go/src/github.com/openshift/oc/pkg/cli/logs/logs.go:127 +0x6ed
github.com/openshift/oc/pkg/cli/logs.NewCmdLogs.func1(0xc000a12000, 0xc0003382a0, 0x1, 0x2)
	/go/src/github.com/openshift/oc/pkg/cli/logs/logs.go:86 +0x156
github.com/spf13/cobra.(*Command).execute(0xc000a12000, 0xc000338280, 0x2, 0x2, 0xc000a12000, 0xc000338280)
	/go/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:856 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000f4c80, 0x2, 0xc0000f4c80, 0x2)
	/go/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/go/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:897
main.main()
	/go/src/github.com/openshift/oc/cmd/oc/oc.go:93 +0x645

Comment 2 zhou ying 2021-06-21 05:39:51 UTC
can't reproduce the error with oc4.9:

[root@localhost home]# oc version --client
Client Version: 4.8.0-202106130124.p0.git.1077b05.assembly.stream-1077b05


[root@localhost roottest]# oc logs -f bc/sample-pipeline
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x34e930d]

goroutine 1 [running]:
github.com/openshift/oc/pkg/cli/logs.(*LogsOptions).RunLog(0xc000ab18e0, 0x0, 0x3fb0338)
	/builddir/build/BUILD/openshift-clients-4.8.0/__gopath/src/github.com/openshift/oc/pkg/cli/logs/logs.go:127 +0x6ed
github.com/openshift/oc/pkg/cli/logs.NewCmdLogs.func1(0xc000878000, 0xc000869080, 0x1, 0x2)
	/builddir/build/BUILD/openshift-clients-4.8.0/__gopath/src/github.com/openshift/oc/pkg/cli/logs/logs.go:86 +0x156
github.com/spf13/cobra.(*Command).execute(0xc000878000, 0xc000869060, 0x2, 0x2, 0xc000878000, 0xc000869060)
	/builddir/build/BUILD/openshift-clients-4.8.0/__gopath/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:856 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc000893400, 0x2, 0xc000893400, 0x2)
	/builddir/build/BUILD/openshift-clients-4.8.0/__gopath/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/builddir/build/BUILD/openshift-clients-4.8.0/__gopath/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:897
main.main()
	/builddir/build/BUILD/openshift-clients-4.8.0/__gopath/src/github.com/openshift/oc/cmd/oc/oc.go:93 +0x645



[root@localhost home]# ./oc version --client
Client Version: 4.9.0-0.nightly-2021-06-20-015701
[root@localhost home]# ./oc  logs -f bc/sample-pipeline
error: the pipeline strategy build  does not yet contain the log URL; wait a few moments, then try again

Comment 5 errata-xmlrpc 2021-10-18 17:35:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:3759


Note You need to log in before you can comment on or make changes to this bug.