82 lines
3.1 KiB
Ruby
82 lines
3.1 KiB
Ruby
require "language/go"
|
|
|
|
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",
|
|
:tag => "v1.10.4",
|
|
:revision => "b32125f8ca6eaf22f1c6ba0d39d19c1e0f37b23b"
|
|
head "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "d676e03316e3e7a65673a02e1e1f1a250128039690b686066e2551694032bb95" => :sierra
|
|
sha256 "d3f33961c9b12c1f2f294182346742730abcb7f729e197f354acccbfb0e78a88" => :el_capitan
|
|
sha256 "2d0d96deacf6b9a9c18ad339efb80be7d61ce81a9290fe3c27650efe0603759e" => :yosemite
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "docker" => :recommended
|
|
|
|
go_resource "github.com/jteeuwen/go-bindata" do
|
|
url "https://github.com/jteeuwen/go-bindata.git",
|
|
:revision => "a0ff2567cfb70903282db057e799fd826784d41d"
|
|
end
|
|
|
|
resource "prebuilt-x86_64.tar.xz" do
|
|
url "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v1.10.4/docker/prebuilt-x86_64.tar.xz",
|
|
:using => :nounzip
|
|
version "1.10.4"
|
|
sha256 "b3104c5fe3406e544a4cc1b0735c6bf6b66a8d09e8691efbcdd336061f534a33"
|
|
end
|
|
|
|
resource "prebuilt-arm.tar.xz" do
|
|
url "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v1.10.4/docker/prebuilt-arm.tar.xz",
|
|
:using => :nounzip
|
|
version "1.10.4"
|
|
sha256 "f3622932cc0e1013e9b999df68f00e6cfde148f56590cc2336806c9136b94dd3"
|
|
end
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
dir = buildpath/"src/gitlab.com/gitlab-org/gitlab-ci-multi-runner"
|
|
dir.install buildpath.children
|
|
ENV.prepend_create_path "PATH", buildpath/"bin"
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
cd "src/github.com/jteeuwen/go-bindata/go-bindata" do
|
|
system "go", "install"
|
|
end
|
|
|
|
cd dir do
|
|
Pathname.pwd.install resource("prebuilt-x86_64.tar.xz"),
|
|
resource("prebuilt-arm.tar.xz")
|
|
system "go-bindata", "-pkg", "docker", "-nocompress", "-nomemcopy",
|
|
"-nometadata", "-o",
|
|
"#{dir}/executors/docker/bindata.go",
|
|
"prebuilt-x86_64.tar.xz",
|
|
"prebuilt-arm.tar.xz"
|
|
|
|
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"
|
|
built = Time.new.strftime("%Y-%m-%dT%H:%M:%S%:z")
|
|
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}
|
|
-X #{proj}/common.BUILT=#{built}
|
|
EOS
|
|
|
|
bin.install "gitlab-ci-multi-runner"
|
|
bin.install_symlink bin/"gitlab-ci-multi-runner" => "gitlab-runner"
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/gitlab-runner --version")
|
|
end
|
|
end
|