A drone plugin to wait for external hosts to be available, useful for CI when waiting on a service.
In this example pipeline, we spawn a redis service, ask waiton to test for redis avaibility, and then do our work in a task depending on waiton.
kind: pipeline
steps:
- name: waiton
image: akhenakh/drone-waiton:1.0
settings:
globaltimeout: 30s
urls:
- tcp://cache:6379
- name: service-ready
image: busybox
commands:
- echo "redis ready"
depends_on:
- waiton
services:
- name: cache
image: redis
ports:
- 6379
type []string
default ''
description List of URLs to test, supported schema are http://
, https://
and tcp://
.
example
# .drone.yml
kind: pipeline
steps:
- name: waiton
image: akhenakh/drone-waiton
settings:
urls:
- http://www.google.com
- http://httpbin.org/delay/5
type string
default '1m'
description Duration before a timeout error is returned, if tests are not completed yet.
note Duration can be expressed in minute m
, seconds s
...
example
# .drone.yml
# this pipeline will fail because the url will return in 5s but the globaltimeout is set to 3s
kind: pipeline
steps:
- name: waiton
image: akhenakh/drone-waiton
settings:
globaltimeout: 3s
urls:
- http://httpbin.org/delay/5
type string
default '10s'
description Duration before timeouting a single request and retrying.
note Duration can be expressed in minute m
, seconds s
...
example
# .drone.yml
kind: pipeline
steps:
- name: waiton
image: akhenakh/drone-waiton
settings:
urltimeout: 3s
urls:
- http://httpbin.org/delay/2
type int
default '100'
description Number of retries before failing.
example
# .drone.yml
kind: pipeline
steps:
- name: waiton
image: akhenakh/drone-waiton
settings:
urltimeout: 1m
maxretries: 10
urls:
- http://httpbin.org/delay/2
The waiton docker image is 4.2MB compressed, based on a distroless image with a simple Go program.
For HTTP & TCP, waiton wll retry every 1s as a backoff strategy.