aboutsummaryrefslogtreecommitdiffstats
path: root/testing/traefik/APKBUILD
blob: 8da7f01a9db70fd1de0f65ec332962525681e13a (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Contributor: Joe Holden <jwh@zorins.us>
# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=traefik
pkgver=2.3.4
pkgrel=0
pkgdesc="The Cloud Native Edge Router"
url="https://traefik.io"
arch="all !mips !mips64" # limited by go on mips
arch="$arch !x86 !armhf !armv7 !s390x" # failing tests
license="MIT"
makedepends="go go-bindata libcap"
install="$pkgname.pre-install"
pkgusers="$pkgname"
pkggroups="$pkgname"
subpackages="$pkgname-openrc"
options="chmod-clean"
source="$pkgname-$pkgver.tar.gz::https://github.com/containous/traefik/releases/download/v$pkgver/traefik-v$pkgver.src.tar.gz
	traefik.initd
	traefik.confd
	traefik.toml
	rate-limiter-test.patch
	skip-flaky-tests.patch
	"
builddir="$srcdir"

_codename=picodon
_build_timestamp=$(date -u "+%Y-%m-%dT%TZ" ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})

build() {
	go generate
	go build \
		-ldflags "
		-X github.com/containous/traefik/v2/pkg/version.Version=$pkgver
		-X github.com/containous/traefik/v2/pkg/version.Codename=$_codename
		-X github.com/containous/traefik/v2/pkg/version.BuildDate=$_build_timestamp
		" \
		-v -o bin/$pkgname \
		./cmd/$pkgname
}

check() {
	# unit tests
	go test ./...

	# integration tests
	cd integration
	go test -integration ./...

	# ensure correct version codename
	local codename_from_ci=$(grep "CODENAME" "$builddir"/.travis.yml | cut -d= -f2)
	[ "$_codename" = "$codename_from_ci" ] || die "new codename: $codename_from_ci"
}

package() {
	install -Dm755 bin/$pkgname "$pkgdir"/usr/sbin/$pkgname
	setcap cap_net_bind_service=+ep "$pkgdir"/usr/sbin/$pkgname

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname

	install -dm750 -o $pkgname -g $pkgname "$pkgdir"/etc/$pkgname
	install -m644 -o $pkgname -g $pkgname "$srcdir"/traefik.toml \
		"$pkgdir"/etc/$pkgname/$pkgname.toml
}

cleanup_srcdir() {
	go clean -modcache
	default_cleanup_srcdir
}

sha512sums="592e1da93985ed00dc4f37279ef9513b77d4be8d8d8a1a4c9b690652a6831f2e8e770b2e612f52cfb35e8f39f15c9dbc66de891913e6273f2a95e49f8662df2a  traefik-2.3.4.tar.gz
563175a94d31fc6b64729781b5749eb1fd76dd0203a877e605fb2135e4095c29e81dc1f0a708d38d21f9200fa20fd957dd858501a4473d9471f4056a60a9bd7c  traefik.initd
872c671a67ef050cd5e798a1190653fede4e499dd29123a073e49ae551b308ac43b11973f472eef1a36775bdfbcbcd3926956b68d8362f8c5674d117b2f36dd4  traefik.confd
7dff62db55362433fe33a69bfb556e6f285a033aaaab46ea970ae4ee1b19a4b0d6b25bf5523d4dc6b40d26922945fd1263ae8e53d295d6bf7f18ea1477a9e4d5  traefik.toml
af896c6200f7eedbc321c8f8fc0f789bcde73c94cfc9a38ff33c4da2aa8c867b2f082803778a606776db424bea6913f3fc7f26d4b24b026ee0fe194ff70647e3  rate-limiter-test.patch
21c533e8696928bf2b6bfededa65b026695fa75d4862bec3716dc08dfd9d899c42a296568d1a444938d0cfbd19b521f740b50fec7c6cd10d0c410f97ecc4c69b  skip-flaky-tests.patch"