You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need either `/bin/bash -c` or `/bin/sh -ic` to make our supported
SCL-powered images to work properly. That's due to a hack to auto-enable
SCLs:
https://github.com/openshift/sti-base/blob/8d95148/Dockerfile#L23-L29
In CentOS and RHEL images, `/bin/sh` is a symlink to `/bin/bash`. In
that case, the ENV environment variable is only evaluated when the shell
is started in interactive mode, which happens when there's and attached
tty (not the case for post build hook) or when the `-i` argument is
passed explicitly.
Making the shell interactive with `-i` is ugly, but is the only solution
we know so far without requiring Bash.
Copy file name to clipboardexpand all lines: pkg/build/api/v1/types.go
+10-5
Original file line number
Diff line number
Diff line change
@@ -424,7 +424,7 @@ type SourceBuildStrategy struct {
424
424
// The above is a convenient form which is equivalent to:
425
425
//
426
426
// BuildPostCommitSpec{
427
-
// Command: []string{"/bin/sh", "-c"},
427
+
// Command: []string{"/bin/sh", "-ic"},
428
428
// Args: []string{"rake test --verbose"},
429
429
// }
430
430
//
@@ -469,19 +469,24 @@ type SourceBuildStrategy struct {
469
469
// the fields are specified, the hook is not executed.
470
470
typeBuildPostCommitSpecstruct {
471
471
// Command is the command to run. It may not be specified with Script.
472
-
// This might be needed if the image doesn't have "/bin/sh", or if you
472
+
// This might be needed if the image doesn't have `/bin/sh`, or if you
473
473
// do not want to use a shell. In all other cases, using Script might be
474
474
// more convenient.
475
475
Command []string`json:"command,omitempty" description:"command to be executed in a container running the build output image replacing the image's entrypoint"`
476
476
// Args is a list of arguments that are provided to either Command,
477
477
// Script or the Docker image's default entrypoint. The arguments are
478
478
// placed immediately after the command to be run.
479
479
Args []string`json:"args,omitempty" description:"arguments to command, script or the default image entrypoint"`
480
-
// Script is a shell script to be run with `/bin/sh -c`. It may not be
480
+
// Script is a shell script to be run with `/bin/sh -ic`. It may not be
481
481
// specified with Command. Use Script when a shell script is appropriate
482
482
// to execute the post build hook, for example for running unit tests
483
-
// with "rake test". If you need control over the image entrypoint, or
484
-
// if the image does not have "/bin/sh", use Command and/or Args.
483
+
// with `rake test`. If you need control over the image entrypoint, or
484
+
// if the image does not have `/bin/sh`, use Command and/or Args.
485
+
// The `-i` flag is needed to support CentOS and RHEL images that use
486
+
// Software Collections (SCL), in order to have the appropriate
487
+
// collections enabled in the shell. E.g., in the Ruby image, this is
488
+
// necessary to make `ruby`, `bundle` and other binaries available in
489
+
// the PATH.
485
490
Scriptstring`json:"script,omitempty" description:"shell script to be executed in a container running the build output image"`
Copy file name to clipboardexpand all lines: pkg/build/api/v1beta3/types.go
+10-5
Original file line number
Diff line number
Diff line change
@@ -411,7 +411,7 @@ type SourceBuildStrategy struct {
411
411
// The above is a convenient form which is equivalent to:
412
412
//
413
413
// BuildPostCommitSpec{
414
-
// Command: []string{"/bin/sh", "-c"},
414
+
// Command: []string{"/bin/sh", "-ic"},
415
415
// Args: []string{"rake test --verbose"},
416
416
// }
417
417
//
@@ -456,19 +456,24 @@ type SourceBuildStrategy struct {
456
456
// the fields are specified, the hook is not executed.
457
457
typeBuildPostCommitSpecstruct {
458
458
// Command is the command to run. It may not be specified with Script.
459
-
// This might be needed if the image doesn't have "/bin/sh", or if you
459
+
// This might be needed if the image doesn't have `/bin/sh`, or if you
460
460
// do not want to use a shell. In all other cases, using Script might be
461
461
// more convenient.
462
462
Command []string`json:"command,omitempty" description:"command to be executed in a container running the build output image replacing the image's entrypoint"`
463
463
// Args is a list of arguments that are provided to either Command,
464
464
// Script or the Docker image's default entrypoint. The arguments are
465
465
// placed immediately after the command to be run.
466
466
Args []string`json:"args,omitempty" description:"arguments to command, script or the default image entrypoint"`
467
-
// Script is a shell script to be run with `/bin/sh -c`. It may not be
467
+
// Script is a shell script to be run with `/bin/sh -ic`. It may not be
468
468
// specified with Command. Use Script when a shell script is appropriate
469
469
// to execute the post build hook, for example for running unit tests
470
-
// with "rake test". If you need control over the image entrypoint, or
471
-
// if the image does not have "/bin/sh", use Command and/or Args.
470
+
// with `rake test`. If you need control over the image entrypoint, or
471
+
// if the image does not have `/bin/sh`, use Command and/or Args.
472
+
// The `-i` flag is needed to support CentOS and RHEL images that use
473
+
// Software Collections (SCL), in order to have the appropriate
474
+
// collections enabled in the shell. E.g., in the Ruby image, this is
475
+
// necessary to make `ruby`, `bundle` and other binaries available in
476
+
// the PATH.
472
477
Scriptstring`json:"script,omitempty" description:"shell script to be executed in a container running the build output image"`
0 commit comments