74 lines
2.5 KiB
Ruby
74 lines
2.5 KiB
Ruby
class GitlabRunner < Formula
|
|
desc "The official GitLab CI runner written in Go"
|
|
homepage "https://gitlab.com/gitlab-org/gitlab-runner"
|
|
url "https://gitlab.com/gitlab-org/gitlab-runner.git",
|
|
:tag => "v11.4.2",
|
|
:revision => "cf91d5e113e5e77f245c63276e2e4d5f4224bbca"
|
|
head "https://gitlab.com/gitlab-org/gitlab-runner.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "160da4e3ba4afbee39a7d55582d81f4b679de4b436d8854ec3f99b39fea92b4a" => :mojave
|
|
sha256 "fceb731ad4117d6dcb95af86c0a7de8497f50592797b3c4bd84a0b2a5011e74c" => :high_sierra
|
|
sha256 "e93c8993dd4ff270eff15ab9eb0508c87570821b8469b0e6cbbe9a39610562e1" => :sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
dir = buildpath/"src/gitlab.com/gitlab-org/gitlab-runner"
|
|
dir.install buildpath.children
|
|
|
|
cd dir do
|
|
proj = "gitlab.com/gitlab-org/gitlab-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
|
|
-X #{proj}/common.NAME=gitlab-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-runner"
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
plist_options :manual => "gitlab-runner start"
|
|
|
|
def plist; <<~EOS
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>SessionCreate</key><false/>
|
|
<key>KeepAlive</key><true/>
|
|
<key>RunAtLoad</key><true/>
|
|
<key>Disabled</key><false/>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/gitlab-runner</string>
|
|
<string>run</string>
|
|
<string>--working-directory</string>
|
|
<string>#{ENV["HOME"]}</string>
|
|
<string>--config</string>
|
|
<string>#{ENV["HOME"]}/.gitlab-runner/config.toml</string>
|
|
<string>--service</string>
|
|
<string>gitlab-runner</string>
|
|
<string>--syslog</string>
|
|
</array>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/gitlab-runner --version")
|
|
end
|
|
end
|