forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-test-analytics-cloud.xml
137 lines (105 loc) · 3.91 KB
/
build-test-analytics-cloud.xml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0"?>
<project basedir="." name="portal-test-analytics-cloud" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<macrodef name="start-analytics-cloud">
<sequential>
<fail message="Please set the property ${env.DOCKER_ENABLED}." unless="env.DOCKER_ENABLED" />
<replaceregexp
file="${analytics.cloud.asah.dir}/docker-compose.yml"
match="container_name: com-liferay-osb-faro-private"
replace="container_name: ${analytics.cloud.faro.container.name}"
/>
<replaceregexp
file="${analytics.cloud.asah.dir}/docker-compose.yml"
match="image: liferay/com-liferay-osb-faro:\s+"
replace="image: ${analytics.cloud.faro.image.name}"
/>
<replaceregexp
file="${analytics.cloud.asah.dir}/docker-compose.yml"
match="\"8080:8080\""
replace=""${analytics.cloud.faro.dxp.port}:8080""
/>
<replaceregexp
file="${analytics.cloud.asah.dir}/docker-compose.yml"
match="\"11311:11311\""
replace=""${analytics.cloud.faro.osgi.console.port}:11311""
/>
<replaceregexp
file="${analytics.cloud.faro.dir}/build-ext.gradle"
match="def dockerContainerId = \"([^\"]+)\""
replace="def dockerContainerId = \"${analytics.cloud.faro.container.name}\""
/>
<replaceregexp
file="${analytics.cloud.faro.dir}/build-ext.gradle"
match="def dockerImageId = \"([^\"]+)\""
replace="def dockerImageId = \"${analytics.cloud.faro.image.name}\""
/>
<replaceregexp
file="${analytics.cloud.faro.dir}/build-ext.gradle"
match="network \"([^\"]+)\""
replace="network \"${analytics.cloud.project.name}_default\""
/>
<if>
<equals arg1="${analytics.cloud.asah.build}" arg2="true" />
<then>
<execute dir="${analytics.cloud.asah.dir}">
touch local.env
./gradlew jar
./gradlew clean assemble
docker-compose --file=docker-compose.yml --project-name=${analytics.cloud.project.name} build
</execute>
</then>
</if>
<if>
<equals arg1="${analytics.cloud.faro.build}" arg2="true" />
<then>
<execute dir="${analytics.cloud.faro.dir}">
./gradlew createDocker -Pcom.liferay.osb.faro.environment.name=asah-local
</execute>
</then>
</if>
<property location="${analytics.cloud.asah.dir}/start_analytics_cloud.sh" name="analytics.cloud.start.sh" />
<echo file="${analytics.cloud.start.sh}">
#!/bin/bash
touch local.env
docker-compose --file=docker-compose.yml --project-name=${analytics.cloud.project.name} up --detach
while [[ -n $(docker ps | grep "health: starting") ]] || [[ -n $(docker ps | grep "unhealthy") ]]
do
echo "Waiting for docker compose to be healthy."
sleep 30
done
while [[ -z $(docker logs ${analytics.cloud.faro.container.name} | grep "Completed demo data creation") ]]
do
echo "Waiting for faro to startup."
sleep 15
done
docker logs ${analytics.cloud.faro.container.name}
docker container prune -f
docker image prune -f
docker volume prune -f
</echo>
<exec dir="${analytics.cloud.asah.dir}" executable="/bin/bash">
<arg value="${analytics.cloud.start.sh}" />
</exec>
<delete file="${analytics.cloud.start.sh}" />
</sequential>
</macrodef>
<macrodef name="stop-analytics-cloud">
<sequential>
<fail message="Please set the property ${env.DOCKER_ENABLED}." unless="env.DOCKER_ENABLED" />
<execute dir="${analytics.cloud.asah.dir}">
touch local.env
docker-compose --file=docker-compose.yml --project-name=${analytics.cloud.project.name} down --volumes
docker container prune -f
docker image prune -f
docker volume prune -f
</execute>
</sequential>
</macrodef>
<target name="start-analytics-cloud">
<start-analytics-cloud />
</target>
<target name="stop-analytics-cloud">
<stop-analytics-cloud />
</target>
</project>