Hide Forgot
Description of problem: oc cmd doesn't work in jenkins build step 'OpenShift - Generic OC Invocation' Version-Release number of selected component (if applicable): jenkins quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:0cb6e590a504f26a5794e5104275d5cea1ca9d84fbc794eafe7965910563bdd6 openshift-client plugin 1.0.25 How reproducible: always Steps to Reproduce: 1.Create a freestyle item 2.Add build step: "OpenShift - Generic OC Invocation" Input value like below: Command to pass into the `oc` binary: 'get' Arguments associated with the above command: 'pod hello-openshift' Actual results: step 2: Job failed Started by user xiuwang Building in workspace /var/lib/jenkins/jobs/test/workspace Executing: oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=xiu --token=XXXXX get pod hello-openshift Error: unknown command "get pod hello-openshift" for "oc" Run 'oc --help' for usage. Client tool terminated with status: 1 Build step 'OpenShift - Generic OC Invocation' marked build as failure Expected results: Should get pod returned Additional info: Could get correct result in the jenkins server pod. sh-4.2$ oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=xiu get pod hello-openshift --token Ts-RV_r3aQ9U-HNn8Jfrz-5V7ZTfoqYYAHMSmV1V7C4 NAME READY STATUS RESTARTS AGE hello-openshift 1/1 Running 0 11m
Should be able to address this in time, but given the infrequency of freestyle jobs and client plugin we see (I might remember 1 github issue *ever*, very early on, and no support cases) Marking both priority and severity as low
OK this is different than what I thought. There is some difference in how `oc` works when launched via process string from Jenkins than it does when launched from the command line. Jenkins must be setting the args in the actual process fork in a way that is confusing `oc`. I can confirm that like XiuJuan manually running the command exactly as we pass it Jenkins, it works. Now, If you change "pod hello-openshift" to "pod/hello-openshift" in the "Arguments associated with the above command", with "get" in the "Command to pass into the `oc` binary", then it works from Jenkins with the freestyle build step. By the way, when you leverage the pipeline dsl form of this, the plugin constructs the command line as "pod/hello-openshift". Pretty sure that is a workaround for this issue. Now, I ran with -loglevel=10 on the jenkins run, and it wants to treat "pod <podname>" as the actual type, vs. type/name. Jenkins must someone group the name and type with a space in between as one arg from the oc/golang perspective. So ACTION PLAN: 1) XiuJuan - re-run where you change "pod hello-openshift" to "pod/hello-openshift" in the "Arguments associated with the above command", with "get" in the "Command to pass into the `oc` binary" and confirm it works for you too 2) if so, I'll use this bug to update the help text in the Jenkins UI, and that is all we do getting kube/cli fixes to deal with getting forked by Jenkins API is a lost cause
Gabe So ACTION PLAN: 1)re-run where you change "pod hello-openshift" to "pod/hello-openshift" in the "Arguments associated with the above command", with "get" in the "Command to pass into the `oc` binary" This works for me Thanks!
PR https://github.com/openshift/jenkins-client-plugin/pull/240 is up
plugin PR has merged Next steps: - cut a new version of the plugin - update the image
v1.0.27 of the client plugin has been generated with the new field help for the Jenkins UI panel for client plugin free style jobs image PR will get created when the version is available at the jenkins update center
ok new rpm has been cut in osbs/distgit via http://pkgs.devel.redhat.com/cgit/rpms/jenkins-2-plugins/commit/?h=rhaos-4.0-rhel-7&id=af50d53fa52ca60840c40f26af2c02a26963817e sending to QE to look out for the next ocp build with that to verify new help text is available
The help doc have updated with registry.svc.ci.openshift.org/ocp/4.0-2019-03-07-043538@sha256:3ae4400256748815121ffb2e09e341802abe0d90afbba8e7a41ad45efb9bd73c The arguments associated with the command provided. Note, if you are to operate on a specific type and instance of an API object, like `oc get pod `, you have to use the form `oc get pod/`. The space separator between type and instance ID is not supported. Mark this to verified. Thanks
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, 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/RHBA-2019:0758