2016-09-17 12:07:26 +01:00
|
|
|
{ lib, buildGoPackage, fetchFromGitLab, fetchurl, go-bindata }:
|
|
|
|
|
|
|
|
let
|
2017-04-22 13:10:48 +01:00
|
|
|
version = "9.1.0";
|
2016-09-17 12:07:26 +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-04-22 13:10:48 +01:00
|
|
|
sha256 = "1mdcw755fygnf30v0gr13mx20zjqmxg5w2kj3k2jgcsh3gyrvymr";
|
2016-09-17 12:07:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
docker_arm = fetchurl {
|
|
|
|
url = "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v${version}/docker/prebuilt-arm.tar.xz";
|
2017-04-22 13:10:48 +01:00
|
|
|
sha256 = "1m5p6mlhy3xf0chrjlfpdyp24pv32b61s8iryh6a617i91vpzjg6";
|
2016-09-17 12:07:26 +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-04-22 13:10:48 +01:00
|
|
|
sha256 = "0n8hcj2b1pb95x4bd7fb9ri43vgc4h2dj2v3iiziw2imqjyphfx4";
|
2016-09-17 12:07:26 +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; {
|
2016-12-25 11:35:47 +00:00
|
|
|
description = "GitLab Runner the continuous integration executor of GitLab";
|
2016-09-17 12:07:26 +01:00
|
|
|
license = licenses.mit;
|
|
|
|
homepage = "https://about.gitlab.com/gitlab-ci/";
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ lib.maintainers.bachp ];
|
|
|
|
};
|
|
|
|
}
|