forked from identitatem/idp-configs-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (59 loc) · 1.76 KB
/
Makefile
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
78
79
80
81
82
83
84
# Copyright Red Hat
-include /opt/build-harness/Makefile.prow
S := $(shell uname)
UNAME_S := $(shell uname -s)
OS_SED :=
ifeq ($(UNAME_S),Darwin)
OS_SED += ""
endif
IMAGE="quay.io/cloudservices/idp-configs-api"
IMAGE_TAG="latest"
KUBECTL=kubectl
NAMESPACE=default
check: check-copyright
check-copyright:
@build/check-copyright.sh
build:
go build -o idp-configs-api main.go
run:
go run main.go
run-migrate:
go run cmd/migrate/migrate.go
# Docker build, push and run
docker-build:
# Base image for go is pulled from registry.redhat.io
docker login -u="${RH_REGISTRY_USER}" -p="${RH_REGISTRY_TOKEN}" registry.redhat.io
docker build --tag ${IMAGE}:${IMAGE_TAG} .
docker-run:
docker run --publish 3000:3000 ${IMAGE}:${IMAGE_TAG}
test:
go test ./... -coverprofile=coverage.out
vet:
go vet ./...
staticcheck:
staticcheck ./...
lint: vet staticcheck
# Note: The Golint linter is deprecated and frozen. As per the docs (https://github.com/golang/lint) there's no drop-in replacement for it, but tools such as Staticcheck and go vet should be used instead.
# OpenAPI 3.0 Spec
generate-docs:
go run cmd/spec/main.go
bonfire-config-local:
@cp default_config.yaml.local.example config.yaml
@sed -i ${OS_SED} 's|REPO|$(PWD)|g' config.yaml
bonfire-config-github:
@cp default_config.yaml.github.example config.yaml
create-ns:
$(KUBECTL) create ns $(NAMESPACE)
deploy-env:
bonfire deploy-env -n $(NAMESPACE)
deploy-app:
bonfire deploy idp-configs -n $(NAMESPACE)
scale-down:
$(KUBECTL) scale --replicas=0 deployment/idp-configs-api-service -n $(NAMESPACE)
scale-up:
$(KUBECTL) scale --replicas=1 deployment/idp-configs-api-service -n $(NAMESPACE)
restart-app:
$(MAKE) scale-down NAMESPACE=$(NAMESPACE)
sleep 5
$(MAKE) scale-up NAMESPACE=$(NAMESPACE)
.PHONY: build