Skip to content

Latest commit

 

History

History
43 lines (35 loc) · 1.8 KB

README.md

File metadata and controls

43 lines (35 loc) · 1.8 KB

wait-for things in CircleCI

CircleCI Orb commands to wait for anything testable with a Bourne shell command

Usefull when you need to wait for background dependencies to be ready before next job steps.

version: 2.1
orbs:
wait-for: cobli/wait-for@x.x.x
jobs:
build:
    docker:
    - image: builder-image:tag
    steps:
    - checkout
    - run:
        name: Some stuff
        command: ./some_command
    - wait-for/sh-command:
        #checks if a file exists ...
        sh_command: "[ ! -f /tmp/foo.txt ]"
        #... each 10 seconds ...
        seconds_between_retries: 10
        #... for 60 seconds
        timeout: 60
    - run:
        name: Build
        command: ./build_command

Needs timeout GNU command in CircleCI machine or base container.

Beside sh-command, this Orb contains some higher level commands to be used to wait for others containers/backgroud services:

  • wait-for/port: waits for a port to be open. Needs netcat (present in all important linux distribution)
  • wait-for/kafka: waits for a Kafka service to be ready. Needs netcat
  • wait-for/redis: waits for a Redis service to be ready. Needs netcat
  • wait-for/cassandra: waits for a Cassandra database to be ready. Needs netcat
  • wait-for/localstack-s3: waits for a Localstack S3 service to be ready. Needs curl

See examples