-
Notifications
You must be signed in to change notification settings - Fork 487
/
Makefile
executable file
·72 lines (58 loc) · 2.2 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
#!make
all: fetch-all-env build
TARGET_BRANCH?=main
TAG?=$(shell bash -c 'git log --pretty=format:'%h' -n 1')
FLAGS=
ENVVAR=
GOOS?=darwin
REGISTRY?=686244538589.dkr.ecr.us-east-2.amazonaws.com
BASEIMAGE?=alpine:3.9
#BUILD_NUMBER=$$(date +'%Y%m%d-%H%M%S')
BUILD_NUMBER := $(shell bash -c 'echo $$(date +'%Y%m%d-%H%M%S')')
ENV_FILE?=scripts/dev-conf/envfile.env
GIT_COMMIT =$(shell sh -c 'git log --pretty=format:'%h' -n 1')
BUILD_TIME= $(shell sh -c 'date -u '+%Y-%m-%dT%H:%M:%SZ'')
SERVER_MODE_FULL= FULL
SERVER_MODE_EA_ONLY=EA_ONLY
#TEST_BRANCH=PUT_YOUR_BRANCH_HERE
#LATEST_HASH=PUT_YOUR_HASH_HERE
GOFLAGS:= $(GOFLAGS) -buildvcs=false
include $(ENV_FILE)
export
build: clean wire
$(ENVVAR) GOOS=$(GOOS) go build -o devtron \
-ldflags="-X 'github.com/devtron-labs/devtron/util.GitCommit=${GIT_COMMIT}' \
-X 'github.com/devtron-labs/devtron/util.BuildTime=${BUILD_TIME}' \
-X 'github.com/devtron-labs/devtron/util.ServerMode=${SERVER_MODE_FULL}'"
wire:
wire
clean:
rm -rf devtron
test-all: test-unit
echo 'test cases ran successfully'
test-unit:
go test ./pkg/pipeline
test-integration:
docker run --env-file=wireNilChecker.env --privileged -d --name dind-test -v $(PWD)/:/wirenil/:ro -v $(PWD)/temp/:/tempfile docker:dind
docker exec dind-test sh -c "mkdir test && cp -r wirenil/* test/ && ./test/tests/integrationTesting/exportEnvsExecuteWireNilChecker.sh"
run: build
./devtron
.PHONY: build
docker-build-image: build
docker build -t devtron:$(TAG) .
.PHONY: build, all, wire, clean, run, set-docker-build-env, docker-build-push, devtron,
docker-build-push: docker-build-image
docker tag devtron:${TAG} ${REGISTRY}/devtron:${TAG}
docker push ${REGISTRY}/devtron:${TAG}
#############################################################################
build-all: build
make --directory ./cmd/external-app build
build-ea:
make --directory ./cmd/external-app build
fetch-all-env:
go run fetchAllEnv/fetchAllEnv.go
dep-update-oss:
go mod edit -replace=github.com/devtron-labs/common-lib=github.com/devtron-labs/devtron-services/common-lib@$(TARGET_BRANCH) \
-replace=github.com/devtron-labs/authenticator=github.com/devtron-labs/devtron-services/authenticator@$(TARGET_BRANCH)
go mod tidy
go mod vendor