-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (44 loc) · 1.56 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
BUILDDIR ?= build
# git
LASTTAG := $(shell git tag --sort=committerdate | tail -1)
# docker option
DTAG ?= $(LASTTAG)
DFNAME ?= Dockerfile
DRNAME ?= docker.io/aryazanov/pipeline-agent
# example
TMPFOLDER ?= ./src/tmp
# ------------------------------------------------------------------------------
# init
init:
sudo apt update
sudo apt install jq
# ------------------------------------------------------------------------------
# proto
.PHONY: proto
proto:
@protoc -I .src/Proto .src/Proto/exec.proto \
--csharp_out=./src/Proto \
--grpc_out=./src/Proto \
--plugin=protoc-gen-grpc=./tools/grpc_csharp_plugin.exe
# ------------------------------------------------------------------------------
# container
.PHONY: container
container:
@docker build -t $(DRNAME):$(DTAG) -f ./src/$(DFNAME) .
@docker push $(DRNAME):$(DTAG)
# ------------------------------------------------------------------------------
# example
# make example name=echo
.PHONY: example
example:
rm -rf $(TMPFOLDER)
mkdir $(TMPFOLDER)
export PIPELINE_AGENT_VERSION=$(shell jq '.examples.echo."pipeline-agent-tag"' src/build-meta.jsonc); \
export COMMAND_EXECUTOR_VERSION=$(shell jq '.examples.echo."command-executor-tag"' src/build-meta.jsonc); \
envsubst < ./src/Examples/$(name)/skaffold.yaml > $(TMPFOLDER)/skaffold.gen
skaffold dev -f $(TMPFOLDER)/skaffold.gen --port-forward --no-prune=false --cache-artifacts=false
# make example-delete name=echo
.PHONY: example-delete
example-delete:
@skaffold delete -f ./src/Examples/$(name)/skaffold.yaml
rm -rf $(TMPFOLDER)