summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 432bd82dd37379ee76437b0a73900464b79184cf (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
# Maintainer: Franklin Yu <franklinyu@google.com>
pkgname=cloudprober
pkgver=0.13.2
pkgrel=1
pkgdesc='An active monitoring software to detect failures before your customers do.'
arch=(x86_64)
url="https://cloudprober.org"
license=(Apache)
makedepends=(go)
_commit='ae2ac8448953977d18a33530d4eb43d8de393da3'  # v0.13.2
source=("git+https://github.com/cloudprober/$pkgname#commit=$_commit" 'service')
sha256sums=(SKIP SKIP)

build() {
	cd "$pkgname"
	local ld_flags=(
		-X main.version=$pkgver
		-X main.buildTimestamp=$SOURCE_DATE_EPOCH
	)
	local go_flags=(
		--buildmode=pie
		--mod=readonly
		--modcacherw
		--trimpath

		# The values are used in the binary; see the upstream Makefile.
		--ldflags="${ld_flags[*]}"
	)
	CGO_ENABLED=0 go build "${go_flags[@]}" "./cmd/$pkgname.go"
}

check() {
	cd "$pkgname"
	# See https://github.com/cloudprober/cloudprober/issues/324
	# TODO: remove “TestK8STokenSource” in next release
	go test --skip='TestConnectFailures' ./...
}

package() {
	install -D --mode=755 "$pkgname/$pkgname" "$pkgdir/usr/bin/$pkgname"
	install -D --mode=644 ../service \
		"$pkgdir/usr/lib/systemd/system/$pkgname.service"
}