|
| 1 | +class Kbld < Formula |
| 2 | + desc "Tool for building and pushing container images in development workflows" |
| 3 | + homepage "https://carvel.dev/kbld/" |
| 4 | + url "https://github.com/carvel-dev/kbld/archive/refs/tags/v0.45.0.tar.gz" |
| 5 | + sha256 "06ec0c144ea24f462fad87bd57463e28cf853d6f58a47a434e79a2deb49d23cd" |
| 6 | + license "Apache-2.0" |
| 7 | + head "https://github.com/carvel-dev/kbld.git", branch: "develop" |
| 8 | + |
| 9 | + bottle do |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "516e60d8536c37a1733172e2a5e950026f97ff66d09820b05196e4e59dd80082" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "516e60d8536c37a1733172e2a5e950026f97ff66d09820b05196e4e59dd80082" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "516e60d8536c37a1733172e2a5e950026f97ff66d09820b05196e4e59dd80082" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "618fa0ac2340bfcab3ada07fdb70f64c7a7eef31ad8d41b6a30c7bc8dcac2fd5" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "618fa0ac2340bfcab3ada07fdb70f64c7a7eef31ad8d41b6a30c7bc8dcac2fd5" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "e15c17078103f935499e0913a345fb044a77feb5bd7336f90b795a02d5159228" |
| 16 | + end |
| 17 | + |
| 18 | + depends_on "go" => :build |
| 19 | + |
| 20 | + def install |
| 21 | + ldflags = %W[ |
| 22 | + -s -w |
| 23 | + -X carvel.dev/kbld/pkg/kbld/version.Version=#{version} |
| 24 | + ] |
| 25 | + system "go", "build", *std_go_args(ldflags:), "./cmd/kbld" |
| 26 | + end |
| 27 | + |
| 28 | + test do |
| 29 | + assert_match version.to_s, shell_output("#{bin}/kbld --version") |
| 30 | + |
| 31 | + test_yaml = testpath/"test.yml" |
| 32 | + test_yaml.write <<~YAML |
| 33 | + --- |
| 34 | + apiVersion: v1 |
| 35 | + kind: Pod |
| 36 | + metadata: |
| 37 | + name: test |
| 38 | + spec: |
| 39 | + containers: |
| 40 | + - name: test |
| 41 | + image: nginx:1.14.2 |
| 42 | + YAML |
| 43 | + |
| 44 | + output = shell_output("#{bin}/kbld -f #{test_yaml}") |
| 45 | + assert_match "image: index.docker.io/library/nginx@sha256", output |
| 46 | + end |
| 47 | +end |
0 commit comments