Skip to content

Commit 1525c29

Browse files
k-andersonlazedo
authored andcommitted
ci-relx: support the packaging system (2600hz#4668)
* ci-relx: support the packaging system
1 parent 8560231 commit 1525c29

10 files changed

+132
-20
lines changed

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ build-dev-release: $(RELX) clean-release rel/dev.relx.config rel/dev.relx.config
9090
$(RELX) --dev-mode true --config rel/dev.relx.config -V 2 release --relname 'kazoo'
9191
build-ci-release: $(RELX) clean-release rel/ci.relx.config rel/ci.relx.config.script rel/ci.sys.config rel/ci.vm.args
9292
$(RELX) --config rel/ci.relx.config -V 2 release --relname 'kazoo'
93+
build-dist-release: $(RELX) clean-release rel/dist.relx.config rel/dist.relx.config.script rel/dist.vm.args rel/dist.sys.config
94+
$(RELX) --config rel/dist.relx.config -V 2 release --relname 'kazoo'
9395
tar-release: $(RELX) rel/relx.config rel/relx.config.script rel/sys.config rel/vm.args
9496
$(RELX) --config rel/relx.config -V 2 release tar --relname 'kazoo'
9597

make/kz.mk

+2-12
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ comma := ,
5656
empty :=
5757
space := $(empty) $(empty)
5858

59-
GIT_FOLDER = $(ROOT)/.git
60-
ifneq ($(wildcard $(GIT_FOLDER)),)
61-
VERSION=$(shell $(ROOT)/scripts/next_version)
62-
endif
59+
KZ_VERSION ?= $(shell $(ROOT)/scripts/next_version)
6360

6461
## SOURCES provides a way to specify compilation order (left to right)
6562
SOURCES ?= $(wildcard src/*.erl) $(wildcard src/*/*.erl)
@@ -78,18 +75,11 @@ endif
7875
## COMPILE_MOAR can contain Makefile-specific targets (see CLEAN_MOAR, compile-test)
7976
compile: $(COMPILE_MOAR) ebin/$(PROJECT).app json depend $(BEAMS)
8077

81-
ifneq ($(wildcard $(GIT_FOLDER)),)
8278
ebin/$(PROJECT).app:
8379
@mkdir -p ebin/
8480
ERL_LIBS=$(ELIBS) erlc -v $(ERLC_OPTS) $(PA) -o ebin/ $(SOURCES)
8581
@sed "s/{modules,\s*\[\]}/{modules, \[$(MODULES)\]}/" src/$(PROJECT).app.src \
86-
| sed -e "s/{vsn,\([^}]*\)}/\{vsn,\"$(VERSION)\"}/g" > $@
87-
else
88-
ebin/$(PROJECT).app:
89-
@mkdir -p ebin/
90-
ERL_LIBS=$(ELIBS) erlc -v $(ERLC_OPTS) $(PA) -o ebin/ $(SOURCES)
91-
@sed "s/{modules,\s*\[\]}/{modules, \[$(MODULES)\]}/" src/$(PROJECT).app.src > $@
92-
endif
82+
| sed -e "s/{vsn,\([^}]*\)}/\{vsn,\"$(KZ_VERSION)\"}/g" > $@
9383

9484
ebin/%.beam: src/%.erl
9585
ERL_LIBS=$(ELIBS) erlc -v $(ERLC_OPTS) $(PA) -o ebin/ $<

rel/ci.relx.config.script

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
VSN = case os:getenv("KZ_VERSION") of
2+
'false' -> os:cmd("echo -n $(scripts/next_version 2>/dev/null)");
3+
Version -> Version
4+
end,
5+
16
ToName = fun (App) -> list_to_atom(hd(string:tokens(App,"-"))) end,
27

38
Apps = [list_to_atom(App) || "applications/"++App = Dir <- filelib:wildcard("applications/*"), filelib:is_dir(Dir)],
@@ -13,13 +18,9 @@ ToFilterOut = [rabbitmq_codegen
1318
,meck
1419
],
1520
Preparer = fun (List) -> [{E,load} || E <- List, not lists:member(E, ToFilterOut)] end,
16-
Base = [runtime_tools
17-
,wx
18-
,observer
19-
,debugger
21+
Base = [tools
2022
,sasl
2123
],
22-
VSN = os:cmd("echo -n $(scripts/next_version 2>/dev/null)"),
2324

2425
BASE = [{default_release, {kazoo, VSN}}
2526
,{release, {kazoo, VSN}

rel/dev.relx.config.script

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
VSN = case os:getenv("KZ_VERSION") of
2+
'false' -> os:cmd("echo -n $(scripts/next_version 2>/dev/null)");
3+
Version -> Version
4+
end,
5+
16
ToName = fun (App) -> list_to_atom(hd(string:tokens(App,"-"))) end,
27

38
Apps = [list_to_atom(App) || "applications/"++App = Dir <- filelib:wildcard("applications/*"), filelib:is_dir(Dir)],
@@ -21,12 +26,12 @@ ToFilterOut = [rabbitmq_codegen
2126
],
2227
Preparer = fun (List) -> [{E,load} || E <- List, not lists:member(E, ToFilterOut)] end,
2328
Base = [runtime_tools
29+
,tools
2430
,wx
2531
,observer
2632
,debugger
2733
,sasl
2834
],
29-
VSN = os:cmd("echo -n $(scripts/next_version 2>/dev/null)"),
3035

3136
BASE = [{default_release, {kazoo, VSN}}
3237
,{release, {kazoo, VSN}

rel/dist.relx.config

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{lib_dirs, ["applications"
2+
,"core"
3+
,"deps"
4+
]}.
5+
6+
{include_src, false}.
7+
{include_erts, true}.
8+
{dev_mode, false}.
9+
10+
{generate_start_script, false}.
11+
{extended_start_script, false}.
12+
13+
{sys_config, "rel/dist.sys.config"}.
14+
{vm_args, "rel/dist.vm.args"}.
15+
16+
{overlay, [{copy, "../core/sup/priv/sup", "{{output_dir}}/bin/"}
17+
,{copy, "nodetool", "{{output_dir}}/bin/"}
18+
,{template, "kazoo", "{{output_dir}}/bin/kazoo"}
19+
]}.
20+

rel/dist.relx.config.script

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
VSN = case os:getenv("KZ_VERSION") of
2+
'false' -> os:cmd("echo -n $(scripts/next_version 2>/dev/null)");
3+
Version -> Version
4+
end,
5+
6+
ToName = fun (App) -> list_to_atom(hd(string:tokens(App,"-"))) end,
7+
8+
Core = [list_to_atom(App) || "core/"++App = Dir <- filelib:wildcard( "core/*"), filelib:is_dir(Dir)],
9+
Deps = [list_to_atom(App) || "deps/"++App = Dir <- filelib:wildcard( "deps/*"), filelib:is_dir(Dir)],
10+
11+
ToFilterOut = [rabbitmq_codegen
12+
,'.erlang.mk'
13+
,'ci.erlang.mk'
14+
,'.settings'
15+
,skel
16+
,parse_trans
17+
,meck
18+
],
19+
Preparer = fun (List) -> [{E, load} || E <- List, not lists:member(E, ToFilterOut)] end,
20+
Base = [runtime_tools
21+
,tools
22+
,sasl
23+
],
24+
25+
BASE = [{default_release, {kazoo, VSN}}
26+
,{release, {kazoo, VSN}
27+
,Base ++ Preparer(Core ++ Deps)
28+
}],
29+
30+
CONFIG ++ BASE.
31+

rel/dist.sys.config

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
{lager, [
3+
{handlers, [
4+
{lager_console_backend, [{level, info}
5+
,{formatter, lager_default_formatter}
6+
,{formatter_config, [time, " ", color, severity, " ", {module,[module],""}, {line,[".",line," "],""}, "\e[0m", message, "\n"]}]}
7+
,{lager_file_backend, [{file, "log/error.log"}, {level, error}, {size, 10485760}, {date, "$D0"}, {count, 5}
8+
,{formatter, lager_default_formatter}
9+
,{formatter_config, [time," [",severity,"] ", "|", {callid, <<"0000000000">>}, "|", module, ":", line, "(",pid, ") ", {log_prefix, ["[", log_prefix, "] "], ""}, message, "\n"]}
10+
]}
11+
,{lager_file_backend, [{file, "log/console.log"}, {level, info}, {size, 10485760}, {date, "$D0"}, {count, 5}
12+
,{formatter, lager_default_formatter}
13+
,{formatter_config, [time," [",severity,"] ", "|", {callid, <<"0000000000">>}, "|", module, ":", line, "(",pid, ") ", {log_prefix, ["[", log_prefix, "] "], ""}, message, "\n"]}
14+
]}
15+
,{lager_syslog_backend, ["2600hz", local0, debug
16+
,{lager_default_formatter, ["|", {callid, <<"0000000000">>}, "|", module, ":", line, "(",pid, ") ", {log_prefix, ["[", log_prefix, "] "], ""}, message, "\n"]}
17+
]}
18+
]}
19+
,{extra_sinks, [{data_lager_event,[]}
20+
]
21+
}
22+
,{colored, true}
23+
,{error_logger_hwm, 5000}
24+
]}
25+
].

rel/dist.vm.args

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Tell SASL not to log progress reports, and log SASL errors to a file
2+
-sasl errlog_type error
3+
# -sasl sasl_error_logger '{file, "log/error_log.sasl"}'
4+
-boot start_sasl
5+
6+
-kernel inet_dist_listen_min 11500 inet_dist_listen_max 11999
7+
8+
# Use kernel poll functionality if supported by emulator
9+
+K true
10+
11+
# Start a pool of asynchronous IO threads
12+
+A 100
13+
14+
# Treat error_logger:warning_msg/2 as warnings instead of errors (default)
15+
+W w
16+
17+
# utf8
18+
-pc unicode
19+
20+
# Hearbeat disbled by default
21+
##-heart
22+
23+
# GC more often
24+
-env ERL_FULLSWEEP_AFTER 10
25+
26+
# Increase number of concurrent ports / sockets
27+
##-env ERL_MAX_PORTS 4096
28+
29+
# When crashing, write dump with highest priority
30+
-env ERL_CRASH_DUMP_NICE 1
31+
32+
-s lager
33+
-s kazoo_apps_app

rel/relx.config.script

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
VSN = case os:getenv("KZ_VERSION") of
2+
'false' -> os:cmd("echo -n $(scripts/next_version 2>/dev/null)");
3+
Version -> Version
4+
end,
5+
16
ToName = fun (App) -> list_to_atom(hd(string:tokens(App,"-"))) end,
27

38
Apps = [list_to_atom(App) || "applications/"++App = Dir <- filelib:wildcard("applications/*"), filelib:is_dir(Dir)],
@@ -14,12 +19,12 @@ ToFilterOut = [rabbitmq_codegen
1419
],
1520
Preparer = fun (List) -> [{E,load} || E <- List, not lists:member(E, ToFilterOut)] end,
1621
Base = [runtime_tools
22+
,tools
1723
,wx
1824
,observer
1925
,debugger
2026
,sasl
2127
],
22-
VSN = os:cmd("echo -n $(scripts/next_version 2>/dev/null)"),
2328

2429
BASE = [{default_release, {kazoo, VSN}}
2530
,{release, {kazoo, VSN}

scripts/next_version

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
branch=$(git rev-parse --abbrev-ref HEAD)
66
parent=$(git show-branch 2>/dev/null | grep '\*' | grep -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
7-
if [[ $parent -eq "master" ]]
7+
if [[ $parent == "master" ]]
88
then
99
version=$(cat $(dirname $0)/../VERSION)
1010
else

0 commit comments

Comments
 (0)