From 26487b1400fd8b069f688d73e0d91dde2f4e01f1 Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Tue, 12 Sep 2023 17:31:31 +0200 Subject: migrate formulae --- goss.rb | 21 +++++++++++++++++++ ksniff.rb | 22 ++++++++++++++++++++ kubent.rb | 23 +++++++++++++++++++++ linkerd@2.11.5.rb | 32 +++++++++++++++++++++++++++++ terraform@1.2.9.rb | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 goss.rb create mode 100644 ksniff.rb create mode 100644 kubent.rb create mode 100644 linkerd@2.11.5.rb create mode 100644 terraform@1.2.9.rb diff --git a/goss.rb b/goss.rb new file mode 100644 index 0000000..380e8db --- /dev/null +++ b/goss.rb @@ -0,0 +1,21 @@ +class Goss < Formula + desc "Quick and Easy server testing/validation" + homepage "https://goss.rocks" + url "https://github.com/goss-org/goss/archive/refs/tags/v0.3.20.tar.gz" + sha256 "5330d62826261533c8b1474799d9bc932fd50977e6f5a193b72244e0aaaf8946" + license "Apache-2.0" + head "https://github.com/goss-org/goss.git", branch: "master" + + depends_on "go" => [:build] + + def install + ldflags = "-s -w" + ldflags += if build.head? + " -X main.version=#{Utils.git_head}" + else + " -X main.version=v#{version}" + end + + system "go", "build", "-ldflags", ldflags, "-o", bin/"goss", "./cmd/goss" + end +end diff --git a/ksniff.rb b/ksniff.rb new file mode 100644 index 0000000..5a1b319 --- /dev/null +++ b/ksniff.rb @@ -0,0 +1,22 @@ +class Ksniff < Formula + desc "Kubectl plugin to ease sniffing on kubernetes pods using tcpdump and wireshark" + homepage "https://github.com/eldadru/ksniff" + url "https://github.com/eldadru/ksniff/releases/download/v1.6.2/ksniff.zip" + sha256 "c59b5c9ea84d6cb771096f1246c919b71389f9d4234e858f4929208957e561fd" + license "Apache-2.0" + + def install + if OS.linux? + bin.install "kubectl-sniff" + elsif OS.mac? + if Hardware::CPU.arm? + bin.install "kubectl-sniff-darwin-arm64" => "kubectl-sniff" + elsif Hardware::CPU.intel? + bin.install "kubectl-sniff-darwin" => "kubectl-sniff" + end + end + + bin.install "static-tcpdump" + chmod 0755, "bin/static-tcpdump" + end +end diff --git a/kubent.rb b/kubent.rb new file mode 100644 index 0000000..201c973 --- /dev/null +++ b/kubent.rb @@ -0,0 +1,23 @@ +class Kubent < Formula + desc "Easily check your clusters for use of deprecated APIs" + homepage "https://github.com/doitintl/kube-no-trouble" + url "https://github.com/doitintl/kube-no-trouble/archive/refs/tags/0.7.0.tar.gz" + sha256 "a0517831170b48648aba3fcabfd553350dc75764597a5d7c02bad6253ddeaa90" + license "MIT" + head "https://github.com/doitintl/kube-no-trouble.git", branch: "master" + + depends_on "go" => [:build] + + def install + ldflags = "-s -w" + + if build.head? + ldflags += " -X main.version=#{Utils.git_head}" + ldflags += " -X main.gitSha=#{Utils.git_head}" + else + ldflags += " -X main.version=v#{version}" + end + + system "go", "build", "-ldflags", ldflags, "-o", bin/"kubent", "./cmd/kubent" + end +end diff --git a/linkerd@2.11.5.rb b/linkerd@2.11.5.rb new file mode 100644 index 0000000..c7ddc6d --- /dev/null +++ b/linkerd@2.11.5.rb @@ -0,0 +1,32 @@ +class LinkerdAT2115 < Formula + desc "Command-line utility to interact with linkerd" + homepage "https://linkerd.io" + url "https://github.com/linkerd/linkerd2.git", + tag: "stable-2.11.5" + license "Apache-2.0" + + keg_only :versioned_formula + + depends_on "go" => :build + + def install + ENV["CI_FORCE_CLEAN"] = "1" + + system "bin/build-cli-bin" + bin.install Dir["target/cli/*/linkerd"] + prefix.install_metafiles + + generate_completions_from_executable(bin/"linkerd", "completion") + end + + test do + run_output = shell_output("#{bin}/linkerd 2>&1") + assert_match "linkerd manages the Linkerd service mesh.", run_output + + version_output = shell_output("#{bin}/linkerd version --client 2>&1") + assert_match "Client version: ", version_output + assert_match stable.specs[:tag], version_output if build.stable? + + system bin/"linkerd", "install", "--ignore-cluster" + end +end diff --git a/terraform@1.2.9.rb b/terraform@1.2.9.rb new file mode 100644 index 0000000..ca3f150 --- /dev/null +++ b/terraform@1.2.9.rb @@ -0,0 +1,60 @@ +class TerraformAT129 < Formula + desc "Tool to build, change, and version infrastructure" + homepage "https://www.terraform.io/" + url "https://github.com/hashicorp/terraform/archive/v1.2.9.tar.gz" + sha256 "40aba75e2fcc3088a88b086a6038c8fb3b1dbe93ac769124c72ce1983558bec7" + license "MPL-2.0" + head "https://github.com/hashicorp/terraform.git", branch: "main" + + keg_only :versioned_formula + + depends_on "go" => :build + + conflicts_with "tfenv", because: "tfenv symlinks terraform binaries" + + # Needs libraries at runtime: + # /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by node) + fails_with gcc: "5" + + def install + # v0.6.12 - source contains tests which fail if these environment variables are set locally. + ENV.delete "AWS_ACCESS_KEY" + ENV.delete "AWS_SECRET_KEY" + + # resolves issues fetching providers while on a VPN that uses /etc/resolv.conf + # https://github.com/hashicorp/terraform/issues/26532#issuecomment-720570774 + ENV["CGO_ENABLED"] = "1" + + system "go", "build", *std_go_args, "-ldflags", "-s -w" + end + + test do + minimal = testpath/"minimal.tf" + minimal.write <<~EOS + variable "aws_region" { + default = "us-west-2" + } + variable "aws_amis" { + default = { + eu-west-1 = "ami-b1cf19c6" + us-east-1 = "ami-de7ab6b6" + us-west-1 = "ami-3f75767a" + us-west-2 = "ami-21f78e11" + } + } + # Specify the provider and access details + provider "aws" { + access_key = "this_is_a_fake_access" + secret_key = "this_is_a_fake_secret" + region = var.aws_region + } + resource "aws_instance" "web" { + instance_type = "m1.small" + ami = var.aws_amis[var.aws_region] + count = 4 + } + EOS + system "#{bin}/terraform", "init" + system "#{bin}/terraform", "graph" + end +end -- cgit v1.2.3