mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
fix: set sh
as default shell for containers (#853)
* fix: set default shell for containers to sh This matches GitHub Actions behaviour where, runners use bash since it's guaranteed to exist there while containers use sh for compatibility * tests: fixup for default shell
This commit is contained in:
parent
9f5df5e527
commit
f09a90bf80
8 changed files with 76 additions and 3 deletions
|
@ -183,6 +183,7 @@ func (sc *StepContext) setupEnv(ctx context.Context) (ExpressionEvaluator, error
|
|||
return evaluator, nil
|
||||
}
|
||||
|
||||
// nolint:gocyclo
|
||||
func (sc *StepContext) setupShellCommand() common.Executor {
|
||||
rc := sc.RunContext
|
||||
step := sc.Step
|
||||
|
@ -237,6 +238,11 @@ func (sc *StepContext) setupShellCommand() common.Executor {
|
|||
if step.Shell == "" {
|
||||
step.Shell = rc.Run.Workflow.Defaults.Run.Shell
|
||||
}
|
||||
if rc.Run.Job().Container() != nil {
|
||||
if rc.Run.Job().Container().Image != "" && step.Shell == "" {
|
||||
step.Shell = "sh"
|
||||
}
|
||||
}
|
||||
scCmd := step.ShellCommand()
|
||||
|
||||
var finalCMD []string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue