-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorb.yaml
164 lines (154 loc) · 4.31 KB
/
orb.yaml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
version: 2.1
display:
home_url: https://github.com/Cobliteam/circleci-orb-wait-for
definitions:
port-parameter: &port-parameter
description: port
type: integer
localhost-parameter: &localhost-parameter
description: host
type: string
default: localhost
wait-for-parameters: &wait-for-parameters
description:
description: command name
type: string
default: command
timeout:
description: timeout
type: integer
default: 60
seconds-between-retries:
description: seconds
type: integer
default: 1
wait-for-attributes: &wait-for-attributes
seconds-between-retries: <<parameters.seconds-between-retries>>
timeout: <<parameters.timeout>>
description: <<parameters.description>>
wait-for-port-parameters: &wait-for-port-parameters
<<: *wait-for-parameters
description:
description: port description
type: string
default: port
host: *localhost-parameter
port: *port-parameter
wait-for-port-attributes: &wait-for-port-attributes
<<: *wait-for-attributes
host: <<parameters.host>>
port: <<parameters.port>>
description: Waits for things testable with a sh command
examples:
waiting_for_containers:
description: Waiting for containers to be ready for start testing
usage:
version: 2.1
orbs:
wait-for: cobli/[email protected]
jobs:
build:
docker:
- image: circleci/openjdk:8
- image: cassandra:3.2
steps:
- checkout
- wait-for/cassandra
- run:
name: Test
command: sbt test
commands:
sh-command:
description: Waits for a shell command to be sucessfully executed
parameters:
<<: *wait-for-parameters
sh-command:
description: command to be checked
type: string
default: "true"
steps:
- run:
name: Wait for <<parameters.description>>
command: |
timeout <<parameters.timeout>> sh -c \
'until <<parameters.sh-command>>; do
echo "Waiting for <<parameters.description>> ..."
sleep <<parameters.seconds-between-retries>>
done'
port:
description: Waits for a port be open
parameters: *wait-for-port-parameters
steps:
- sh-command:
<<: *wait-for-attributes
sh-command: nc -z <<parameters.host>> <<parameters.port>>
kafka:
description: Waits for Kafka be ready
parameters:
<<: *wait-for-parameters
description:
description: kafka description
type: string
default: Kafka
zookeeper-host: *localhost-parameter
zookeeper-port:
<<: *port-parameter
default: 2181
steps:
- sh-command:
<<: *wait-for-attributes
sh-command: >-
echo dump |
nc <<parameters.zookeeper-host>> <<parameters.zookeeper-port>> |
grep brokers
localstack-s3:
description: |
Waits for a LocalStack container with S3 service be ready
parameters:
<<: *wait-for-port-parameters
description:
description: LocalStack S3 description
type: string
default: Localstack S3
port:
<<: *port-parameter
default: 4572
steps:
- sh-command:
<<: *wait-for-attributes
sh-command: >-
curl --silent
"http://<<parameters.host>>:<<parameters.port>>" |
grep --quiet running
redis:
description: Waits for Redis to be ready
parameters:
<<: *wait-for-port-parameters
description:
description: redis description
type: string
default: Redis
port:
<<: *port-parameter
default: 6379
steps:
- sh-command:
<<: *wait-for-attributes
sh-command: >-
printf "PING\r\n" |
nc -q 1 <<parameters.host>> <<parameters.port>> |
grep PONG
cassandra:
description: Waits for Cassandra to be ready
parameters:
<<: *wait-for-port-parameters
description:
description: cassandra description
type: string
default: Cassandra
port:
<<: *port-parameter
default: 9042
steps:
- port: *wait-for-port-attributes