forked from cloudstax/amazon-ecs-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (78 loc) · 2.87 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
# Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the
# "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and
# limitations under the License.
VERSION := $(shell git describe --tags | sed -e 's/v//' -e 's/-.*//')
DEB_SIGN ?= 1
.PHONY: dev generate lint static test build-mock-images sources rpm srpm
dev:
./scripts/gobuild.sh dev
generate:
PATH=$(PATH):$(shell pwd)/scripts go generate -v ./...
lint:
./scripts/lint.sh
static:
./scripts/gobuild.sh
gotest:
go test -short -v -cover ./...
test: generate lint gotest
test-in-docker:
docker build -f scripts/dockerfiles/test.dockerfile -t "amazon/amazon-ecs-init-test:make" .
docker run -v "$(shell pwd):/go/src/github.com/cloudstax/amazon-ecs-init" "amazon/amazon-ecs-init-test:make"
build-mock-images:
docker build -t "test.localhost/amazon/mock-ecs-agent" -f "scripts/dockerfiles/mock-agent.dockerfile" .
docker build -t "test.localhost/amazon/wants-update" -f "scripts/dockerfiles/wants-update.dockerfile" .
docker build -t "test.localhost/amazon/exit-success" -f "scripts/dockerfiles/exit-success.dockerfile" .
sources.tgz:
./scripts/update-version.sh
cp packaging/amazon-linux-ami/ecs-init.spec ecs-init.spec
cp packaging/amazon-linux-ami/ecs.conf ecs.conf
tar -czf ./sources.tgz ecs-init scripts
sources: sources.tgz
.srpm-done: sources.tgz
test -e SOURCES || ln -s . SOURCES
rpmbuild --define "%_topdir $(PWD)" -bs ecs-init.spec
find SRPMS/ -type f -exec cp {} . \;
touch .srpm-done
srpm: .srpm-done
.rpm-done: sources.tgz
test -e SOURCES || ln -s . SOURCES
rpmbuild --define "%_topdir $(PWD)" -bb ecs-init.spec
find RPMS/ -type f -exec cp {} . \;
touch .rpm-done
rpm: .rpm-done
ubuntu-trusty:
cp packaging/ubuntu-trusty/ecs.conf ecs.conf
tar -czf ./amazon-ecs-init_${VERSION}.orig.tar.gz ecs-init ecs.conf scripts README.md
mkdir -p BUILDROOT
cp -r packaging/ubuntu-trusty/debian BUILDROOT/debian
cp -r ecs-init BUILDROOT
cp packaging/ubuntu-trusty/ecs.conf BUILDROOT
cp -r scripts BUILDROOT
cp README.md BUILDROOT
cd BUILDROOT && debuild $(shell [ "$(DEB_SIGN)" -ne "0" ] || echo "-uc -us")
get-deps:
go get github.com/tools/godep
go get golang.org/x/tools/cover
go get golang.org/x/tools/cmd/cover
go get golang.org/x/tools/cmd/goimports
clean:
-rm ecs-init.spec
-rm ecs.conf
-rm ./sources.tgz
-rm ./amazon-ecs-init
-rm ./ecs-init-*.src.rpm
-rm ./ecs-init-* -r
-rm -r ./BUILDROOT BUILD RPMS SRPMS SOURCES SPECS
-rm ./x86_64 -r
-rm ./amazon-ecs-init_${VERSION}*
-rm .srpm-done .rpm-done