forked from quay/quay-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (67 loc) · 2.35 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
85
86
87
88
89
90
91
# Image URL to use all building/pushing image targets
REGISTRY ?= quay.io
REPOSITORY ?= $(REGISTRY)/redhat-cop/quay-operator
DEV_TAG ?= dev
IMG := $(REPOSITORY):latest
VERSION := v1.0.2
BUILD_COMMIT := $(shell ./scripts/build/get-build-commit.sh)
BUILD_TIMESTAMP := $(shell ./scripts/build/get-build-timestamp.sh)
BUILD_HOSTNAME := $(shell ./scripts/build/get-build-hostname.sh)
LDFLAGS := "-X github.com/redhat-cop/quay-operator/version.Version=$(VERSION) \
-X github.com/redhat-cop/quay-operator/version.Vcs=$(BUILD_COMMIT) \
-X github.com/redhat-cop/quay-operator/version.Timestamp=$(BUILD_TIMESTAMP) \
-X github.com/redhat-cop/quay-operator/version.Hostname=$(BUILD_HOSTNAME)"
all: manager
# Run tests
native-test: generate fmt vet
go test ./pkg/... ./cmd/... -coverprofile cover.out
# Build manager binary
manager: generate fmt vet
go build -o build/_output/bin/quay-operator -ldflags $(LDFLAGS) github.com/redhat-cop/quay-operator/cmd/manager
# Build manager binary
manager-osx: generate fmt vet
go build -o build/_output/bin/quay-operator GOOS=darwin -ldflags $(LDFLAGS) github.com/redhat-cop/quay-operator/cmd/manager
# Run against the configured Kubernetes cluster in ~/.kube/config
run: generate fmt vet
go run ./cmd/manager/main.go
# Install CRDs into a cluster
install:
cat deploy/crds/*crd.yaml | kubectl apply -f-
# Run go fmt against code
fmt:
go fmt ./pkg/... ./cmd/...
# Run go vet against code
vet:
go vet ./pkg/... ./cmd/...
# Generate code
generate:
go generate ./pkg/... ./cmd/...
# Docker Login
docker-login:
@docker login -u $(DOCKER_USER) -p $(DOCKER_PASSWORD) $(REGISTRY)
# Tag for Dev
docker-tag-dev:
@docker tag $(IMG) $(REPOSITORY):$(DEV_TAG)
# Tag for Dev
docker-tag-release:
@docker tag $(IMG) $(REPOSITORY):$(VERSION)
@docker tag $(IMG) $(REPOSITORY):latest
# Push for Dev
docker-push-dev: docker-tag-dev
@docker push $(REPOSITORY):$(DEV_TAG)
# Push for Release
docker-push-release: docker-tag-release
@docker push $(REPOSITORY):$(VERSION)
@docker push $(REPOSITORY):latest
# Build the docker image
docker-build:
docker build . -t ${IMG}
# Push the docker image
docker-push:
docker push ${IMG}
# CI Latest Tag Deployment
ci-latest-deploy: docker-login docker-build docker-push
# CI Dev Deployment
ci-dev-deploy: docker-login docker-build docker-push-dev
# CI Release
ci-release-deploy: docker-login docker-build docker-push-release