Merge pull request #26003 from bachp/gitlab-runner-update

Gitlab runner update
This commit is contained in:
Franz Pletz 2017-05-24 12:50:32 +02:00 committed by GitHub
commit d69c2968a2
4 changed files with 32 additions and 18 deletions

View File

@ -32,6 +32,8 @@ buildGoPackage rec {
sha256 = "0gz6byjnnfn9acy40hcbyzdql4199xn0yvjx2cfjjjzd9kryjrxp";
};
patches = [ ./fix-shell-path.patch ];
buildInputs = [ go-bindata ];
preBuild = ''

View File

@ -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)

View File

@ -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)

View File

@ -1,16 +1,16 @@
{ lib, buildGoPackage, fetchFromGitLab, fetchurl, go-bindata }:
let
version = "1.11.2";
version = "1.11.4";
# Gitlab runner embeds some docker images these are prebuilt for arm and x86_64
docker_x86_64 = fetchurl {
url = "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v${version}/docker/prebuilt-x86_64.tar.xz";
sha256 = "08lacd2p7915y7yjnwkj2k0b0x4qj9kc53p7qgvmq8kdi31xnh4z";
sha256 = "1ijkzn8jkzx1dzxhkf17987ligyf758xzas6ysix5b781jnkdm8z";
};
docker_arm = fetchurl {
url = "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v${version}/docker/prebuilt-arm.tar.xz";
sha256 = "0lzvx3jfy8493q8zkbs7kgm5a3jgsi3f2x25jwg4lx7agcwwsygw";
sha256 = "0sq2nndnkzqv2yjljg08xwa3ppddn6vqcivhfh43zwwmansvb9ha";
};
in
buildGoPackage rec {
@ -29,10 +29,10 @@ buildGoPackage rec {
owner = "gitlab-org";
repo = "gitlab-ci-multi-runner";
rev = "v${version}";
sha256 = "1sjvlb5981ykc8hr4kp1ibh9jw2wdjjp9zs2nqs9lpsav4nda5fr";
sha256 = "1pm88546cijmrrcvvrajp2g6rsrzxhy83cwwwky8jjkl5w4hhmz4";
};
patches = [ ./v1-fix-shell-path.patch ];
patches = [ ./fix-shell-path.patch ];
buildInputs = [ go-bindata ];