85 lines
2.7 KiB
Ruby
85 lines
2.7 KiB
Ruby
class GitlabRunner < Formula
|
|
desc "Official GitLab CI runner"
|
|
homepage "https://gitlab.com/gitlab-org/gitlab-runner"
|
|
url "https://gitlab.com/gitlab-org/gitlab-runner.git",
|
|
tag: "v13.5.0",
|
|
revision: "ece8634382223b250b259534ed398d2c125b9911"
|
|
license "MIT"
|
|
head "https://gitlab.com/gitlab-org/gitlab-runner.git"
|
|
|
|
livecheck do
|
|
url :head
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "8b884156876862b842d72b14cd1d31ba06d5d99d9f7add60b393dcef175ad56f" => :catalina
|
|
sha256 "b44fed098410031f72580821815ce1fccc7431c7e79f206b12d1d569dff40b5f" => :mojave
|
|
sha256 "a5cdfbd8b0283294e01ed3a763c2c8e87eec9416973176ffb1aed429397b8eb1" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
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.safe_popen_read("git", "rev-parse", "--short=8", "HEAD").chomp
|
|
branch = "#{version.major}-#{version.minor}-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"
|
|
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>
|
|
<key>EnvironmentVariables</key>
|
|
<dict>
|
|
<key>PATH</key>
|
|
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
|
</dict>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/gitlab-runner --version")
|
|
end
|
|
end
|