forked from devtron-labs/devtron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·65 lines (51 loc) · 1.9 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
#!make
all: build
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:
export INTEGRATION_TEST_ENV_ID=$(docker run --env TEST_BRANCH=$TEST_BRANCH --env LATEST_HASH=$LATEST_HASH --privileged -d --name dind-test -v $PWD/tests/integrationTesting/:/tmp/ docker:dind)
docker exec ${INTEGRATION_TEST_ENV_ID} sh /tmp/create-test-env.sh
docker exec ${INTEGRATION_TEST_ENV_ID} sh /tests/integrationTesting/run-integration-test.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