forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-test-staging-mysql.xml
80 lines (63 loc) · 2.48 KB
/
build-test-staging-mysql.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
<?xml version="1.0"?>
<project basedir="." default="test" name="portal-test-staging-mysql" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<target name="rebuild-staging-database">
<delete dir="${liferay.home}/data/elasticsearch7" />
<!--<mirrors-get
dest="${liferay.home}/${custom.database.zip.name}"
src="${custom.database.zip.url}"
verbose="true"
/>-->
<!--<unzip
dest="${liferay.home}"
src="${project.dir}/portal-web/test/functional/com/liferay/portalweb/dependencies/${custom.database.zip.name}"
/>-->
<copy
todir="${liferay.home}"
>
<fileset
dir="${project.dir}/portal-web/test/functional/com/liferay/portalweb/dependencies/${custom.database.file.name}"
/>
</copy>
<property name="database.type" value="mysql" />
<get-database-property property.name="database.docker.image" />
<if>
<isset property="database.docker.image" />
<then>
<get-database-property property.name="database.host" />
<get-database-property property.name="database.password" />
<get-database-property property.name="database.schema" />
<get-database-property property.name="database.username" />
<get-database-property property.name="database.version" />
<property location="import-database.sh" name="import.database.sh.file.path" />
<echo>Database Type is: ${database.type}</echo>
<if>
<equals arg1="${database.type}" arg2="mysql" />
<then>
<antcall target="rebuild-database">
<param name="database.type" value="${database.type}" />
<param name="sql.dir" value="sql/create-bare/" />
<param name="sql.file" value="create-bare-mysql.sql" />
</antcall>
<echo file="${import.database.sh.file.path}">
<![CDATA[
#!/bin/bash
mysql --database=${database.schema} --password=${database.password} --user=${database.username} < /tmp/${database.type}.sql
]]>
</echo>
<property name="docker.database.dest.path" value="/tmp/${database.type}.sql" />
<property name="import.database.src.path" value="${liferay.home}/${database.type}.sql" />
</then>
</if>
<execute>
<![CDATA[
docker cp ${import.database.sh.file.path} ${database.host}:/tmp/import-database.sh
docker cp ${import.database.src.path} ${database.host}:${docker.database.dest.path}
docker exec ${database.host} /bin/bash /tmp/import-database.sh
]]>
</execute>
<echo>Import process is finished</echo>
</then>
</if>
</target>
</project>