61 lines
1.8 KiB
Ruby
61 lines
1.8 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.4",
|
|
:revision => "3af514fa9f85430f0c1557c4a0291e62112ab026"
|
|
head "https://github.com/kubernetes-sigs/kustomize.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
rebuild 1
|
|
sha256 "e7e4728e65df26734f4815f517940b47d5a1d3cf6e0ce709772a76da4905c053" => :catalina
|
|
sha256 "ae5b7fa548e13b5d191ef95499b50a469ca29b840b086848d608bf9cc27c2e2f" => :mojave
|
|
sha256 "9cc7948af53b2711ef41d539032544ce472237c3466702bd5ac0d40370292148" => :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
|