59 lines
1.7 KiB
Ruby
59 lines
1.7 KiB
Ruby
class Kustomize < Formula
|
|
desc "Template-free customization of Kubernetes YAML manifests"
|
|
homepage "https://github.com/kubernetes-sigs/kustomize"
|
|
url "https://github.com/kubernetes-sigs/kustomize.git",
|
|
:tag => "kustomize/v3.5.1",
|
|
:revision => "2c9635967a2b1469d605a91a1d040bd27c73ca7d"
|
|
head "https://github.com/kubernetes-sigs/kustomize.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "c96d401ee6dd4aeeccfe1556e36628d0658579a6356564098106d10209f085a2" => :mojave
|
|
sha256 "33e40b1c9baddae54e108cf2c5e3e9707dcc45b9abd3e137ac7c3daa7d16ffc2" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
revision = Utils.popen_read("git", "rev-parse", "HEAD").strip
|
|
|
|
cd "kustomize" do
|
|
ldflags = %W[
|
|
-s -X sigs.k8s.io/kustomize/api/provenance.version=#{version}
|
|
-X sigs.k8s.io/kustomize/api/provenance.gitCommit=#{revision}
|
|
-X sigs.k8s.io/kustomize/api/provenance.buildDate=#{Time.now.iso8601}
|
|
]
|
|
system "go", "build", "-ldflags", ldflags.join(" "), "-o", bin/"kustomize"
|
|
end
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/kustomize version")
|
|
|
|
(testpath/"kustomization.yaml").write <<~EOS
|
|
resources:
|
|
- service.yaml
|
|
patchesStrategicMerge:
|
|
- patch.yaml
|
|
EOS
|
|
(testpath/"patch.yaml").write <<~EOS
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: brew-test
|
|
spec:
|
|
selector:
|
|
app: foo
|
|
EOS
|
|
(testpath/"service.yaml").write <<~EOS
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: brew-test
|
|
spec:
|
|
type: LoadBalancer
|
|
EOS
|
|
output = shell_output("#{bin}/kustomize build #{testpath}")
|
|
assert_match /type:\s+"?LoadBalancer"?/, output
|
|
end
|
|
end
|