2016-02-22 08:37:27 +00:00
|
|
|
require "language/go"
|
|
|
|
|
2015-11-10 14:18:19 +00:00
|
|
|
class GitlabCiMultiRunner < Formula
|
|
|
|
desc "The official GitLab CI runner written in Go"
|
|
|
|
homepage "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner"
|
|
|
|
url "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner.git",
|
2016-11-30 08:37:06 +00:00
|
|
|
:tag => "v1.8.1",
|
|
|
|
:revision => "a2efdd470c19e69223f9cb3af2c0c95e5f9ce002"
|
2015-11-10 14:18:19 +00:00
|
|
|
head "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner.git"
|
|
|
|
|
2015-11-11 08:51:38 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2016-11-30 10:49:31 +00:00
|
|
|
sha256 "2367674856b4e4ff1f1e44b32cd8d2cb14726d270404643cac8bca8e045b12d6" => :sierra
|
|
|
|
sha256 "ce4d69bc607c77ed3ec26d661caf7d27d11f2a017fcddab51fa1a839fef2fd99" => :yosemite
|
2015-11-11 08:51:38 +00:00
|
|
|
end
|
|
|
|
|
2015-11-10 14:18:19 +00:00
|
|
|
depends_on "go" => :build
|
2016-02-22 08:37:27 +00:00
|
|
|
depends_on "docker" => :recommended
|
2015-11-10 14:18:19 +00:00
|
|
|
|
2016-02-22 08:37:27 +00:00
|
|
|
go_resource "github.com/jteeuwen/go-bindata" do
|
|
|
|
url "https://github.com/jteeuwen/go-bindata.git",
|
2016-09-24 15:45:48 +00:00
|
|
|
:revision => "a0ff2567cfb70903282db057e799fd826784d41d"
|
2016-02-22 08:37:27 +00:00
|
|
|
end
|
2015-11-10 14:18:19 +00:00
|
|
|
|
2016-09-01 14:06:16 +00:00
|
|
|
resource "prebuilt-x86_64.tar.xz" do
|
2016-11-30 08:37:06 +00:00
|
|
|
url "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v1.8.1/docker/prebuilt-x86_64.tar.xz",
|
2016-09-24 15:45:48 +00:00
|
|
|
:using => :nounzip
|
2016-11-30 08:37:06 +00:00
|
|
|
version "1.8.1"
|
|
|
|
sha256 "c350e7d385894aae8b247ffcf3fd2034ac7ac1adc9b64d3d761243966b8920a5"
|
2016-02-22 08:37:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
2016-08-11 06:52:47 +00:00
|
|
|
dir = buildpath/"src/gitlab.com/gitlab-org/gitlab-ci-multi-runner"
|
2016-07-24 15:31:23 +00:00
|
|
|
dir.install buildpath.children
|
2016-02-22 08:37:27 +00:00
|
|
|
ENV.prepend_create_path "PATH", buildpath/"bin"
|
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
|
2016-08-11 06:52:47 +00:00
|
|
|
cd "src/github.com/jteeuwen/go-bindata/go-bindata" do
|
2016-02-22 08:37:27 +00:00
|
|
|
system "go", "install"
|
|
|
|
end
|
|
|
|
|
2016-07-24 15:31:23 +00:00
|
|
|
cd dir do
|
2016-09-01 14:06:16 +00:00
|
|
|
resource("prebuilt-x86_64.tar.xz").stage do
|
2016-09-23 18:57:07 +00:00
|
|
|
system "go-bindata", "-pkg", "docker", "-nocompress", "-nomemcopy",
|
|
|
|
"-nometadata", "-o",
|
|
|
|
"#{dir}/executors/docker/bindata.go",
|
|
|
|
"prebuilt-x86_64.tar.xz"
|
2016-07-24 15:31:23 +00:00
|
|
|
end
|
2016-02-22 08:37:27 +00:00
|
|
|
|
2016-08-11 06:52:47 +00:00
|
|
|
proj = "gitlab.com/gitlab-org/gitlab-ci-multi-runner"
|
|
|
|
commit = Utils.popen_read("git", "rev-parse", "--short", "HEAD").chomp
|
|
|
|
branch = version.to_s.split(".")[0..1].join("-") + "-stable"
|
|
|
|
system "go", "build", "-ldflags", <<-EOS.undent
|
|
|
|
-X #{proj}/common.NAME=gitlab-ci-multi-runner
|
|
|
|
-X #{proj}/common.VERSION=#{version}
|
|
|
|
-X #{proj}/common.REVISION=#{commit}
|
|
|
|
-X #{proj}/common.BRANCH=#{branch}
|
|
|
|
EOS
|
|
|
|
|
2015-11-10 14:18:19 +00:00
|
|
|
bin.install "gitlab-ci-multi-runner"
|
2016-07-24 15:31:23 +00:00
|
|
|
bin.install_symlink bin/"gitlab-ci-multi-runner" => "gitlab-runner"
|
|
|
|
prefix.install_metafiles
|
2015-11-10 14:18:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-08-11 06:52:47 +00:00
|
|
|
assert_match version.to_s, shell_output("#{bin}/gitlab-runner --version")
|
2015-11-10 14:18:19 +00:00
|
|
|
end
|
|
|
|
end
|