-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
143 lines (132 loc) · 5.89 KB
/
build.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
138
139
140
141
142
143
<project name="continuousphp-aws-swf" default="help" basedir=".">
<import file="./vendor/continuousphp/aws-sdk-phing/tasks.xml"/>
<property file="./build.properties"/>
<target name="help" description="List available targets">
<exec executable="./vendor/bin/phing"
passthru="true">
<arg value="-l"/>
</exec>
</target>
<target name="aws-bootstrap">
<echo msg="Setup AWS credential..." />
<if>
<and>
<isset property="aws.profile" />
<not>
<equals arg1="${aws.profile}" arg2="" />
</not>
</and>
<then>
<echo msg="CREDENTIAL LOAD PROFILE" />
<aws-config region="${aws.region}" profile="${aws.profile}" />
</then>
<else>
<if>
<and>
<isset property="aws.key" />
<isset property="aws.secret" />
<not>
<equals arg1="${aws.key}" arg2="" />
</not>
<not>
<equals arg1="${aws.secret}" arg2="" />
</not>
</and>
<then>
<echo msg="CREDENTIAL LOAD KEY AND SECRET ${aws.region}" />
<aws-config region="${aws.region}" key="${aws.key}" secret="${aws.secret}" />
</then>
<else>
<echo msg="CREDENTIAL AUTO" />
<aws-config region="${aws.region}" />
</else>
</if>
</else>
</if>
<echo msg="Reading instance identity" />
<if>
<not>
<isset property="aws.identity" />
</not>
<then>
<php expression="@file_get_contents('http://169.254.169.254/latest/meta-data/instance-id') ?: php_uname('n')"
returnProperty="aws.identity" />
</then>
</if>
<if>
<not>
<and>
<equals arg1="" arg2="${aws.region}"/>
</and>
</not>
<then>
<echo message="Creating AWS config file"/>
<loadfile property="aws.config" file="./config/autoload/aws.local.php.dist">
<filterchain>
<replacetokens>
<token key="aws.region" value="${aws.region}"/>
<token key="aws.identity" value="${aws.identity}"/>
<token key="aws.key" value="${aws.key}"/>
<token key="aws.secret" value="${aws.secret}"/>
<token key="aws.profile" value="${aws.profile}"/>
</replacetokens>
</filterchain>
</loadfile>
<echo message="${aws.config}" file="./config/autoload/aws.local.php"/>
</then>
</if>
<if>
<not>
<and>
<equals arg1="" arg2="${swf.domain.name}"/>
<equals arg1="" arg2="${swf.domain.version}"/>
</and>
</not>
<then>
<echo message="Creating SWF config file" />
<loadfile property="swf.config" file="./config/autoload/swf.local.php.dist">
<filterchain>
<replacetokens>
<token key="swf.domain.name" value="${swf.domain.name}-${swf.domain.version}" />
</replacetokens>
</filterchain>
</loadfile>
<echo message="${swf.config}" file="./config/autoload/swf.local.php" />
</then>
</if>
</target>
<target name="aws-workflow" description="Setup AWS SWF">
<if>
<not>
<isset property="swf.domain.name"/>
</not>
<then>
<fail message="the swf.domain.name property is required"/>
</then>
</if>
<aws-swf-domain name="${swf.domain.name}-${swf.domain.version}" retention="${swf.domain.retention}"/>
<foreach list="${swf.workflows}" param="workflow" target="create-swf-workflow"/>
<foreach list="${swf.activities}" param="activity" target="create-swf-activity"/>
</target>
<target name="create-swf-workflow">
<aws-swf-workflow domain="${swf.domain.name}-${swf.domain.version}"
name="${swf.workflow.${workflow}.name}"
version="${swf.workflow.${workflow}.version}"
tasklist="${swf.workflow.${workflow}.tasklist}"
taskStartToCloseTimeout="${swf.workflow.${workflow}.taskStartToCloseTimeout}"
executionStartToCloseTimeout="${swf.workflow.${workflow}.executionStartToCloseTimeout}"
childPolicy="${swf.workflow.${workflow}.childPolicy}"/>
</target>
<target name="create-swf-activity">
<aws-swf-activity domain="${swf.domain.name}-${swf.domain.version}"
name="${activity}"
version="${swf.activity.${activity}.version}"
tasklist="${swf.workflow.${workflow}.tasklist}"
startToCloseTimeout="${swf.activity.${activity}.startToCloseTimeout}"
heartbeatTimeout="${swf.activity.heartbeat}"
scheduleToStartTimeout="${swf.activity.${activity}.scheduleToStartTimeout}"
scheduleToCloseTimeout="${swf.activity.${activity}.scheduleToCloseTimeout}"/>
</target>
<target name="build" depends="aws-bootstrap"/>
<target name="init" depends="aws-bootstrap, aws-workflow"/>
</project>