Bug 1415062 - post-commit with Shell script and args will print some irrelevant lines in build log on console terminal
Summary: post-commit with Shell script and args will print some irrelevant lines in bu...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OKD
Classification: Red Hat
Component: Build
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Corey Daley
QA Contact: Wang Haoran
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-20 06:44 UTC by XiaochuanWang
Modified: 2017-02-06 14:34 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-06 14:34:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description XiaochuanWang 2017-01-20 06:44:12 UTC
Description of problem:
Set Post-Commit Hooks by script with args from web console and start build, build log contains some irrelevant lines.

Version-Release number of selected component (if applicable):
v1.5.0-alpha.1+68d4d0a-322-dirty

How reproducible:
Always

Steps to Reproduce:
1. # oc new-project xiaocwan-t
# oc new-app https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-stibuild.json
2. # Edit bc on web console
click "Show advanced options" and find "Post-Commit Hooks"
set Shell Script with Arguments
    Script -> echo "this is a script"
    1 arguments: hello -> click Add 
3. Save and start build#2 and check log in web terminal again


Actual results:
Build#2 log contains below output
  ---> Cleaning up unused ruby gems ...
  Running post commit hook ...
  sh: cannot set terminal process group (-1): Inappropriate ioctl for device
  sh: no job control in this shell
  this is a script
  Pushing image x.x.x.x:5000/xiaocwan-t/origin-ruby-sample:latest ...
  ...
Then the build is completed.

Expected results:
Seems these 2 lines has no reason to display:
  sh: cannot set terminal process group (-1): Inappropriate ioctl for device
  sh: no job control in this shell

Additional info:
test command with args will not reproduced, output is below
"""
Running post commit hook ... 
hello
"""
BC config for Post-Commit Hooks:
Command: echo 
Args:    hello

Comment 1 Corey Daley 2017-01-25 19:30:11 UTC
According to a comment in the code (located here: https://github.com/openshift/origin/blob/master/pkg/build/builder/common.go#L124)

"// The `-i` flag is needed to support CentOS and RHEL images
// that use Software Collections (SCL), in order to have the
// appropriate collections enabled in the shell. E.g., in the
// Ruby image, this is necessary to make `ruby`, `bundle` and
// other binaries available in the PATH."

So, the first example that you showed that shows the extra lines of output is the equivalent of:

docker run centos /bin/sh -ic echo "this is a test" /bin/sh hello

And the second example that does NOT show the extra lines is the equivalent of:

docker run centos echo hello

If you run those commands on your workstation you will get the same lines output.  Which seems to make this a docker issue that is possibly fixed in docker 1.2 from what I have read.

Closing as not a bug.

Comment 2 Ben Parees 2017-01-25 19:33:13 UTC
Moving to ON_QA so test cases (if applicable) can be updated.

Comment 3 XiaochuanWang 2017-02-06 06:42:50 UTC
This is caused by an old existed docker issue: https://github.com/docker/docker/issues/18

'docker run centos /bin/sh -ic echo "this is a test" /bin/sh hello' will get the message
'docker run centos echo hello' will not get the message

Case will be updated to use other image or ignore it for this scenario. So close it as not a bug.


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