blob: 6a9cf4fe24d3de564599716cdbd947bb77d4d1fd (
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
|
TEMPDIR := `mktemp -d`
BUILDDIR := "_build"
alias dr := debug-run
alias dt := debug-test
docker tag:
docker build -t go-git-server:{{tag}} .
docker-run:
docker run -it --rm -p 8080:8080 --volume $(pwd)/tokens.csv:/opt/app/etc/tokens.csv go-git-server
clean:
rm -r {{ BUILDDIR }}
builddir:
mkdir -p {{ BUILDDIR }}/etc
mkdir -p {{ BUILDDIR }}/bin
release part: build
#!/usr/bin/env bash
set -euxo pipefail
current_ver=$(bumpver {{part}} <(git tag -l))
new_ver=$(bumpver {{part}} <(git tag -l))
# temp tag for release notes
git tag $new_ver
echo "v${new_ver} release" > {{ TEMPDIR }}/chglog
git-chglog $current_ver..$new_ver >> {{ TEMPDIR }}/chglog
echo "## Coverage" >> {{ TEMPDIR }}/chglog
echo "" >> {{ TEMPDIR }}/chglog
go tool cover -func={{ TEMPDIR }}/testcover.out >> {{ TEMPDIR }}/chglog
# end temp tag
git tag -d $new_ver
git tag --annotate --sign --cleanup=whitespace --file {{ TEMPDIR }}/chglog ${new_ver}
git push origin ${new_ver}
build: test builddir
cp policy.csv auth_model.ini gitserver.yaml {{ BUILDDIR }}/etc/
CGO_ENABLED=0 go build -a -ldflags '-s' -o {{ BUILDDIR }}//bin/go-git-server cmd/main.go
push tag="latest" registry="public.ecr.aws/s0f9o2k5": (docker tag)
docker tag go-git-server:latest {{registry}}/go-git-server:{{tag}}
docker push {{registry}}/go-git-server:{{tag}}
run repo=(TEMPDIR):
go run cmd/main.go -a -r {{repo}}
test:
golangci-lint run
go test -v -coverprofile={{ TEMPDIR }}/testcover.out ./...
go tool cover -func={{ TEMPDIR }}/testcover.out
debug-run:
dlv debug cmd/main.go -- -s {{justfile_directory()}}/gitserver.yaml -r {{ TEMPDIR }} -t tokens.csv -p policy.csv -m auth_model.ini -a
local-push: (push "localhost:5000")
@echo "build and push to local dir"
local-clean:
kustomize build manifests/local | kubectl --context k3d-go-git-cluster delete -f -
local-undeploy:
kustomize build manifests/base | kubectl --context k3d-go-git-cluster delete -f -
kustomize build manifests/cgit | kubectl --context k3d-go-git-cluster delete -f -
local-deploy:
kustomize build manifests/local | kubectl --context k3d-go-git-cluster apply -f -
local-cluster:
k3d cluster create go-git-cluster --registry-create go-git-registry:5000
local-cluster-clean:
k3d cluster delete go-git-cluster
debug-test pkg func:
dlv test {{pkg}} -- -test.v -test.run {{func}}
|