diff options
author | Pascal Bach <pascal.bach@nextrem.ch> | 2017-05-23 22:34:22 +0200 |
---|---|---|
committer | Pascal Bach <pascal.bach@nextrem.ch> | 2017-05-23 22:34:22 +0200 |
commit | 335865b9437cc5b382ac0498fb1e688569ff77b6 (patch) | |
tree | b2719b45d1be692f56f9fad7c5fab38dcdd21650 /pkgs/development | |
parent | 86e714095c4446466fafa47f1a546d0da4410530 (diff) | |
download | nixlib-335865b9437cc5b382ac0498fb1e688569ff77b6.tar nixlib-335865b9437cc5b382ac0498fb1e688569ff77b6.tar.gz nixlib-335865b9437cc5b382ac0498fb1e688569ff77b6.tar.bz2 nixlib-335865b9437cc5b382ac0498fb1e688569ff77b6.tar.lz nixlib-335865b9437cc5b382ac0498fb1e688569ff77b6.tar.xz nixlib-335865b9437cc5b382ac0498fb1e688569ff77b6.tar.zst nixlib-335865b9437cc5b382ac0498fb1e688569ff77b6.zip |
gitlab-runner, gitlab-runner_1_11: change path fix patch to work on non NixOS
It now tries to find the shell via path first and then falls back to the original behavior.
Diffstat (limited to 'pkgs/development')
4 files changed, 27 insertions, 15 deletions
diff --git a/pkgs/development/tools/continuous-integration/gitlab-runner/default.nix b/pkgs/development/tools/continuous-integration/gitlab-runner/default.nix index 5b2ddf1f1028..a87ea5ae5c70 100644 --- a/pkgs/development/tools/continuous-integration/gitlab-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/gitlab-runner/default.nix @@ -32,7 +32,7 @@ buildGoPackage rec { sha256 = "0gz6byjnnfn9acy40hcbyzdql4199xn0yvjx2cfjjjzd9kryjrxp"; }; - patches = [ ./v1-fix-shell-path.patch ]; + patches = [ ./fix-shell-path.patch ]; buildInputs = [ go-bindata ]; diff --git a/pkgs/development/tools/continuous-integration/gitlab-runner/fix-shell-path.patch b/pkgs/development/tools/continuous-integration/gitlab-runner/fix-shell-path.patch new file mode 100644 index 000000000000..8f71f9ed630c --- /dev/null +++ b/pkgs/development/tools/continuous-integration/gitlab-runner/fix-shell-path.patch @@ -0,0 +1,25 @@ +diff --git a/shells/bash.go b/shells/bash.go +index 839b7781..2b478e1e 100644 +--- a/shells/bash.go ++++ b/shells/bash.go +@@ -7,6 +7,7 @@ import ( + "gitlab.com/gitlab-org/gitlab-ci-multi-runner/common" + "gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers" + "io" ++ "os/exec" + "path" + "runtime" + "strconv" +@@ -208,7 +209,11 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (script *commo + if info.User != "" { + script.Command = "su" + if runtime.GOOS == "linux" { +- script.Arguments = append(script.Arguments, "-s", "/bin/"+b.Shell) ++ shellPath, err := exec.LookPath(b.Shell) ++ if err != nil { ++ shellPath = "/bin/"+b.Shell ++ } ++ script.Arguments = append(script.Arguments, "-s", shellPath) + } + script.Arguments = append(script.Arguments, info.User) + script.Arguments = append(script.Arguments, "-c", shellCommand) \ No newline at end of file diff --git a/pkgs/development/tools/continuous-integration/gitlab-runner/v1-fix-shell-path.patch b/pkgs/development/tools/continuous-integration/gitlab-runner/v1-fix-shell-path.patch deleted file mode 100644 index 612c9a51f281..000000000000 --- a/pkgs/development/tools/continuous-integration/gitlab-runner/v1-fix-shell-path.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/shells/bash.go b/shells/bash.go -index c9c8b68..c97dbb5 100644 ---- a/shells/bash.go -+++ b/shells/bash.go -@@ -208,7 +208,7 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (script *commo - if info.User != "" { - script.Command = "su" - if runtime.GOOS == "linux" { -- script.Arguments = append(script.Arguments, "-s", "/bin/"+b.Shell) -+ script.Arguments = append(script.Arguments, "-s", "/run/current-system/sw/bin/"+b.Shell) - } - script.Arguments = append(script.Arguments, info.User) - script.Arguments = append(script.Arguments, "-c", shellCommand) diff --git a/pkgs/development/tools/continuous-integration/gitlab-runner/v1.nix b/pkgs/development/tools/continuous-integration/gitlab-runner/v1.nix index 1ef0d41f3640..d51a32705923 100644 --- a/pkgs/development/tools/continuous-integration/gitlab-runner/v1.nix +++ b/pkgs/development/tools/continuous-integration/gitlab-runner/v1.nix @@ -32,7 +32,7 @@ buildGoPackage rec { sha256 = "1pm88546cijmrrcvvrajp2g6rsrzxhy83cwwwky8jjkl5w4hhmz4"; }; - patches = [ ./v1-fix-shell-path.patch ]; + patches = [ ./fix-shell-path.patch ]; buildInputs = [ go-bindata ]; |