2017-03-23 22:45:23 +01:00
|
|
|
{ lib, buildGoPackage, fetchFromGitLab, fetchurl, go-bindata }:
|
|
|
|
|
|
|
|
let
|
2017-07-05 17:20:12 +02:00
|
|
|
version = "1.11.5";
|
2017-03-23 22:45:23 +01:00
|
|
|
# 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";
|
2017-07-05 17:20:12 +02:00
|
|
|
sha256 = "0qy3xrq574c1lhkqw1zrkcn32w0ky3f4fppzdjhb5zwqvnaz7kx0";
|
2017-03-23 22:45:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
docker_arm = fetchurl {
|
|
|
|
url = "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v${version}/docker/prebuilt-arm.tar.xz";
|
2017-07-05 17:20:12 +02:00
|
|
|
sha256 = "12clc28yc157s2kaa8239p0g086vq062jfjh2m1bxqmaypw9pyla";
|
2017-03-23 22:45:23 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
buildGoPackage rec {
|
|
|
|
inherit version;
|
|
|
|
name = "gitlab-runner-${version}";
|
|
|
|
goPackagePath = "gitlab.com/gitlab-org/gitlab-ci-multi-runner";
|
|
|
|
commonPackagePath = "${goPackagePath}/common";
|
|
|
|
buildFlagsArray = ''
|
|
|
|
-ldflags=
|
|
|
|
-X ${commonPackagePath}.NAME=gitlab-runner
|
|
|
|
-X ${commonPackagePath}.VERSION=${version}
|
|
|
|
-X ${commonPackagePath}.REVISION=v${version}
|
|
|
|
'';
|
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "gitlab-org";
|
|
|
|
repo = "gitlab-ci-multi-runner";
|
|
|
|
rev = "v${version}";
|
2017-07-05 17:20:12 +02:00
|
|
|
sha256 = "1xgx8jbgcc3ga7dkjxa2i8nj4afsdavzpfrgpdzma03jkcq1g2sv";
|
2017-03-23 22:45:23 +01:00
|
|
|
};
|
|
|
|
|
2017-05-23 22:34:22 +02:00
|
|
|
patches = [ ./fix-shell-path.patch ];
|
2017-05-11 23:16:31 +02:00
|
|
|
|
2017-03-23 22:45:23 +01:00
|
|
|
buildInputs = [ go-bindata ];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
(
|
|
|
|
# go-bindata names the assets after the filename thus we create a symlink with the name we want
|
|
|
|
cd go/src/${goPackagePath}
|
|
|
|
ln -sf ${docker_x86_64} prebuilt-x86_64.tar.xz
|
|
|
|
ln -sf ${docker_arm} prebuilt-arm.tar.xz
|
|
|
|
go-bindata \
|
|
|
|
-pkg docker \
|
|
|
|
-nocompress \
|
|
|
|
-nomemcopy \
|
|
|
|
-o executors/docker/bindata.go \
|
|
|
|
prebuilt-x86_64.tar.xz \
|
|
|
|
prebuilt-arm.tar.xz
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
install -d $out/bin
|
|
|
|
# The recommended name is gitlab-runner so we create a symlink with that name
|
|
|
|
ln -sf gitlab-ci-multi-runner $bin/bin/gitlab-runner
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "GitLab Runner the continuous integration executor of GitLab";
|
|
|
|
license = licenses.mit;
|
2017-08-01 22:03:30 +02:00
|
|
|
homepage = https://about.gitlab.com/gitlab-ci/;
|
2017-03-23 22:45:23 +01:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ lib.maintainers.bachp ];
|
|
|
|
};
|
|
|
|
}
|