-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
122 lines (104 loc) · 3.07 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
API_PKGS=apps channels releases
BUILDTAGS = containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp
export GO111MODULE=on
export CGO_ENABLED=0
.PHONY: test-unit
test-unit:
go test -v `go list ./... | grep -v /pact | grep -v /pkg/integration` -tags "$(BUILDTAGS)"
.PHONY: test-pact
test-pact:
go test -v ./pact/... -tags "$(BUILDTAGS)"
.PHONY: test-integration
test-integration: build
go test -v ./pkg/integration/...
.PNONY: test-e2e
test-e2e:
# integration and e2e
docker build -t replicated-cli-test -f hack/Dockerfile.testing .
docker run --rm --name replicated-cli-tests \
-v `pwd`:/go/src/github.com/replicatedhq/replicated \
replicated-cli-test
.PHONY: test
test: test-unit test-pact test-e2e
.PHONY: publish-pact
publish-pact:
pact-broker publish ./pacts \
--auto-detect-version-properties \
--consumer-app-version ${PACT_VERSION} \
--verbose
.PHONY: can-i-deploy
can-i-deploy:
pact-broker can-i-deploy \
--pacticipant replicated-cli \
--version ${PACT_VERSION} \
--to-environment production \
--verbose
.PHONY: record-release
record-release:
pact-broker record-release \
--pacticipant replicated-cli \
--version ${PACT_VERSION} \
--environment production \
--verbose
.PHONY: record-support-ended
record-support-ended:
pact-broker record-support-ended \
--pacticipant replicated-cli \
--version ${PACT_VERSION} \
--environment production \
--verbose
# fetch the swagger specs from the production Vendor API
.PHONY: get-spec-prod
get-spec-prod:
mkdir -p gen/spec/
curl -o gen/spec/v1.json https://api.replicated.com/vendor/v1/spec/vendor-api.json
curl -o gen/spec/v3.json https://api.replicated.com/vendor/v3/spec/vendor-api-v3.json
# generate the swagger specs from the local replicatedcom/vendor-api repo
.PHONY: get-spec-local
get-spec-local:
mkdir -p gen/spec/
docker run --rm \
--volume ${GOPATH}/src/github.com:/go/src/github.com \
replicatedhq.replicated /bin/bash -c ' \
for PKG in ${API_PKGS}; do \
swagger generate spec \
-b ../../replicatedcom/vendor-api/handlers/replv1/$$PKG \
-o gen/spec/$$PKG.json; \
done \
&& swagger generate spec \
-b ../../replicatedcom/vendor-api/handlers/replv2 \
-o gen/spec/v2.json'
# generate from the specs in gen/spec, which come from either get-spec-prod or get-spec-local
.PHONY: gen-models
gen-models:
docker run --rm \
--volume `pwd`:/local \
swaggerapi/swagger-codegen-cli generate \
-Dmodels -DmodelsDocs=false \
-i /local/gen/spec/v1.json \
-l go \
-o /local/gen/go/v1; \
docker run --rm \
--volume `pwd`:/local \
swaggerapi/swagger-codegen-cli generate \
-Dmodels -DmodelsDocs=false \
-i /local/gen/spec/v3.json \
-l go \
-o /local/gen/go/v3; \
.PHONY: build
build:
go build \
${LDFLAGS} \
-tags "$(BUILDTAGS)" \
-o bin/replicated \
cli/main.go
.PHONY: docs
docs:
go run ./docs/
.PHONE: release
release:
dagger call release \
--one-password-service-account-production env:OP_SERVICE_ACCOUNT_PRODUCTION \
--version $(version) \
--github-token env:GITHUB_TOKEN \
--progress plain