From 7765614c8ec5cd71e61315cd4479e4564e7ed501 Mon Sep 17 00:00:00 2001 From: amands98 Date: Tue, 12 Mar 2024 17:13:34 +0530 Subject: [PATCH 1/2] harbor 0.0.1 (new formula) Signed-off-by: amands98 --- Formula/h/harbor.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Formula/h/harbor.rb diff --git a/Formula/h/harbor.rb b/Formula/h/harbor.rb new file mode 100644 index 000000000000..3b86cbb0eb06 --- /dev/null +++ b/Formula/h/harbor.rb @@ -0,0 +1,20 @@ +class Harbor < Formula + desc "[Sandbox] Official Harbor CLI" + homepage "https://github.com/goharbor/harbor-cli" + url "https://github.com/goharbor/harbor-cli/archive/refs/tags/v0.0.1.tar.gz" + sha256 "8a764ea10173d8dca4c99c79f55b054bea184abf012e7a346b7b39fae094d805" + license "Apache-2.0" + + depends_on "go" => :build + + def install + ENV["CGO_ENABLED"] = "0" + + ldflags = %W[ + -s -w + -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=#{version} + ] + system "go", "build", *std_go_args(ldflags:), "./cmd/harbor" + end + +end From 6db2d5d69c76edeb4b680a9878aea0685f94a77f Mon Sep 17 00:00:00 2001 From: amands98 Date: Tue, 12 Mar 2024 20:52:38 +0530 Subject: [PATCH 2/2] harbor: add test case Signed-off-by: amands98 --- Formula/h/harbor.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Formula/h/harbor.rb b/Formula/h/harbor.rb index 3b86cbb0eb06..1b27ca4b43ab 100644 --- a/Formula/h/harbor.rb +++ b/Formula/h/harbor.rb @@ -17,4 +17,10 @@ def install system "go", "build", *std_go_args(ldflags:), "./cmd/harbor" end + test do + assert_match "#{version}", shell_output("#{bin}/harbor version") + # Test for handling credential store error during project creation. + assert_match "failed to read credential store", shell_output("#{bin}/harbor create project 2>&1", 1) + end + end