maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=helm-mapkubeapis
pkgver=0.5.2
pkgrel=6
pkgdesc="Helm plugin to map deprecated or removed Kubernetes APIs to supported ones"
url="https://github.com/helm/helm-mapkubeapis"
arch="all"
license="Apache-2.0"
makedepends="go"
install="helm-mapkubeapis.pre-install"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/helm/helm-mapkubeapis/archive/refs/tags/v$pkgver.tar.gz
	"
options="net" # download Go modules

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -v ./cmd/mapkubeapis/
}

check() {
	go test ./...
}

package() {
	install -Dm755 mapkubeapis "$pkgdir/usr/share/helm/plugins/mapkubeapis/bin/mapkubeapis"

	cat <<-EOF > "$pkgdir/usr/share/helm/plugins/mapkubeapis/plugin.yaml"
	name: "mapkubeapis"
	version: "$pkgver"
	usage: "Map release deprecated Kubernetes APIs in-place"
	description: "Map release deprecated Kubernetes APIs in-place"
	platformCommand:
	  - os: "$(go env GOOS)"
	    arch: "$(go env GOARCH)"
	    command: "\${HELM_PLUGIN_DIR}/bin/mapkubeapis"
	EOF
}

sha512sums="
5f2f29834d087e462f30f94952ae092af279f9175f432196efef032ec39fc1277db1c9ef449ee01336313825500a9255d9d6965187f0b29786c7f78ca543f0e8  helm-mapkubeapis-0.5.2.tar.gz
"
