summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 04b20379d12cfcd1db6b8eb4b3f107287cd5999a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Maintainer: JP Roemer <jp+aur@roemer.im>

pkgname=kconnect
pkgver=0.5.18
_saml2awsver="35a4d415a9823c2811c108b9106cae77e006414f"
pkgrel=1
pkgdesc='CLI utility that can be used to discover and securely access Kubernetes clusters across multiple operating environments.'
arch=('x86_64' 'aarch64')
url="https://github.com/fidelity/kconnect"
license=('Apache-2.0')
depends=('kubectl')
makedepends=('go')
optdepends=('aws-iam-authenticator: authentication to AWS EKS clusters'
            'azure-kubelogin: non-interactive authentication to Azure AKS clusters'
            'azure-cli: interactive authentication to Azure AKS clusters')
provides=("${pkgname}")
conflicts=("${pkgname}-bin")
source=(
    "${pkgname}_${pkgver}.tar.gz::${url}/archive/refs/tags/${pkgver}.tar.gz"
)
sha256sums=('8136026ba0ceef658b1b6c13c3bd2eac65d7bbcde12f72758e0d834c39d9d8a8')

export GGO_ENABLED="0"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-trimpath -mod=readonly -modcacherw"

build() {
    local _commit _flags
    _commit=$(bsdcat "${pkgname}_${pkgver}.tar.gz" | git get-tar-commit-id)
    _flags=(
        -X=github.com/fidelity/kconnect/internal/version.version="${pkgver}"
        -X=github.com/fidelity/kconnect/internal/version.commitHash="${_commit}"
        -X=github.com/fidelity/kconnect/internal/version.buildDate="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
    )
    cd "${pkgname}-${pkgver}"
    go build -o "${pkgname}" -ldflags="-s -w ${_flags[*]}" "./cmd/${pkgname}"
}

package() {
    cd "${pkgname}-${pkgver}"
    install -Dm 755 "${pkgname}" -t "${pkgdir}/usr/bin"
}