chart-testing 3.0.0 (new formula)

Closes #58615.

Signed-off-by: Dawid Dziurla <dawidd0811@gmail.com>
master
Alexander Zigelski 2020-07-25 20:25:32 +02:00 committed by Dawid Dziurla
parent 1e50fb5212
commit b966b71b6b
1 changed files with 33 additions and 0 deletions

33
Formula/chart-testing.rb Normal file
View File

@ -0,0 +1,33 @@
class ChartTesting < Formula
desc "Testing and linting Helm charts"
homepage "https://github.com/helm/chart-testing"
url "https://github.com/helm/chart-testing.git",
tag: "v3.0.0",
revision: "50db473a1e68c605b18d82f019d83ea401542213"
license "Apache-2.0"
depends_on "go" => :build
depends_on "helm" => :test
depends_on "yamllint" => :test
def install
commit = Utils.safe_popen_read("git", "rev-parse", "HEAD").chomp
ldflags = %W[
-X github.com/helm/chart-testing/v3/ct/cmd.Version=#{version}
-X github.com/helm/chart-testing/v3/ct/cmd.GitCommit=#{commit}
-X github.com/helm/chart-testing/v3/ct/cmd.BuildDate=#{Date.today}
].join(" ")
system "go", "build", *std_go_args, "-ldflags", ldflags, "-o", bin/"ct", "./ct/main.go"
etc.install "etc" => "ct"
end
test do
assert_match "Lint and test", shell_output("#{bin}/ct --help")
# Lint an empty Helm chart that we create with `helm create`
system "helm", "create", "testchart"
output = shell_output("#{bin}/ct lint --charts ./testchart --validate-chart-schema=false" \
" --validate-maintainers=false").lines.last.chomp
assert_match "All charts linted successfully", output
end
end