Drone CI

Use LocalStack in Drone CI

This guide shows you how to start LocalStack in a Drone CI pipeline.

Drone CI Pipelines

There are a few restrictions in Drone CI Pipelines that make it hard to customize the behavior of Docker. For example, mounting the host machine Docker socket is considered insecure, and hence alleviated privileges are required to run commands like localstack wait. Learn more about configuring Docker for Drone CI pipelines over their official documentation.

A possible alternative to mounting the Docker socket (/var/run/docker.sock) into the container to communicate with the Docker daemon on the host is to expose port 2375 and make it reachable in the main LocalStack container. However, it requires changes to the typical Docker-Compose setup.

Example

We can integrate the following example into your Drone CI workflow. As an example, it will pull the LocalStack Docker image and check if the LocalStack service is up and running:

  1. kind: pipeline
  2. type: docker
  3. name: localstack
  4. trigger:
  5. branch:
  6. - main
  7. services:
  8. - name: localstack
  9. image: localstack/localstack
  10. steps:
  11. - name: localstack wait
  12. image: alpine/curl:3.14
  13. commands:
  14. - until curl -s http://localstack:4566/health; do echo -n . && sleep 1; done

Using LocalStack Pro

You can easily enable LocalStack Pro by adding your API key to Drone Repository secrets. You can manage them from your repository settings screen. Navigate to your Repository secrets on your Drone repository and add the LocalStack API key as localstack_api_key. Here is an example:

  1. services:
  2. - name: localstack
  3. image: localstack/localstack
  4. environment:
  5. LOCALSTACK_API_KEY:
  6. from_secret: localstack_api_key

Last modified June 16, 2022: docs: add drone ci to list of supported services (#177) (aa5127f2)