Giter Site home page Giter Site logo

legart / dind-drone-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from testcontainers/dind-drone-plugin

0.0 1.0 0.0 39 KB

Plugin for Drone CI v0.8+ to enable use of Testcontainers using Docker-in-Docker

License: Apache License 2.0

Dockerfile 6.51% Shell 93.49%

dind-drone-plugin's Introduction

Docker-in-Docker Drone plugin

This is a plugin for Drone 0.8 that is aimed mainly at enabling Testcontainers to be used during CI build/test steps. Due to Drone's architecture, Docker-in-Docker is often the most practical way to run builds that require a Docker daemon.

This plugin:

  • Is based upon an Docker-in-Docker image
  • Includes a startup script that:
    • Starts a nested docker daemon
    • Optionally starts a pull of required images (in parallel with your build, so as to reduce overall time spent waiting for images to be pulled)
    • Starts a specified build container inside the Docker-in-Docker context, containing your source code and with a docker socket available to it

Prerequisites

Either:

  • (Drone 0.8): To enable on a per-repository basis, enable the Trusted setting for the repository. Or
  • (Drone 0.8): To enable this plugin globally in your Drone instance, add the image name to the DRONE_ESCALATE environment variable that the Drone process runs under.

Usage/Migration (Drone 0.8)

Modify the build step of the pipeline to resemble:

pipeline:
  ...
  build:
    image: quay.io/testcontainers/dind-drone-plugin
    build_image: openjdk:8-jdk-alpine
    # This specifies the command that should be executed to perform build, test and 
    #  integration tests. Not to be confused with Drone's `command`:
    cmd: ./gradlew clean check --info
    # Not mandatory; enables pre-fetching of images in parallel with the build, so may save 
    #  time:
    prefetch_images:
      - "redis:4.0.6"
    # Not mandatory; sets up image name 'aliases' by pulling from one registry and tagging
    #  as a different name. Intended as a simplistic mechanism for using a private registry 
    #  rather than Docker Hub for a known set of images. Accepts a dictionary of
    #  private registry image name to the Docker Hub image that it is a substitute for.
    #  Note that all images are pulled synchronously before the build starts, so this is
    #  inefficient if any unnecessary images are listed.
    image_aliases:
      someregistry.com/redis:4.0.6: redis:4.0.6

When migrating to use this plugin from an ordinary build step, note that:

  • commands should be changed to cmd. Note that commas are not supported within cmd lines due to the way these are passed in between Drone and this plugin.
  • image should be changed to build_image
  • prefetch_images is optional, but recommended. This specifies a list of images that should be pulled in parallel with your build process, thus saving some time.

Extending

Users with custom requirements can build a new image using this as a base image.

This image uses hook scripts, if present, to perform custom actions. Such scripts may be placed as executable files in any of /dind-drone-plugin/hooks/{pre_daemon_start,post_daemon_start,pre_run,post_run}, depending on which phase they are required to run in.

Some initial hook scripts already exist, which should be overwritten or removed if needed.

Copyright

This repository contains code which was mainly developed at Skyscanner, and is licenced under the Apache 2.0 Licence.

(c) 2017-2020 Skyscanner Ltd.

dind-drone-plugin's People

Contributors

rnorth avatar smeb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.