aboutsummaryrefslogtreecommitdiff
path: root/justfile
blob: 7c7b562ffb91bcbc5051f9696ed4ab86a633ea91 (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
TEMPDIR := `mktemp -d`
BUILDDIR := "_build"
alias dr := debug-run
alias dt := debug-test


docker:
    docker build -t go-git-server .

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

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 registry="public.ecr.aws/s0f9o2k5": docker
    docker tag go-git-server:latest {{registry}}/go-git-server:latest
    docker push {{registry}}/go-git-server:latest

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"

localdeploy:
    kubectx k3d-go-git-cluster
    kustomize build manifests/local | kubectl apply -f -

local-cluster:
    k3d cluster create go-git-cluster --registry-create go-git-registry

debug-test pkg func:
    dlv test {{pkg}} -- -test.v -test.run {{func}}