Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from lucasventurasc/master
Browse files Browse the repository at this point in the history
  • Loading branch information
rnorth authored Mar 24, 2021
2 parents b35d361 + aa57d4b commit 0153604
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .drone.newer-versions-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pipeline:
build:
image: quay.io/testcontainers/dind-drone-plugin
environment:
CI_WORKSPACE: "/drone/src"
settings:
build_image: alpine:fake
cmd: cat /etc/issue
image_aliases:
alpine:3.5: alpine:fake
alpine:3.6: alpine:fake2

services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run

volumes:
- name: dockersock
temp: {}
2 changes: 1 addition & 1 deletion .drone.example.yml → .drone.version-0.8-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pipeline:
cmd: cat /etc/issue
image_aliases:
alpine:3.5: alpine:fake
alpine:3.6: alpine:fake2
alpine:3.6: alpine:fake2
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker-in-Docker Drone plugin

This is a plugin for **Drone 0.8** that is aimed mainly at enabling [Testcontainers](https://www.testcontainers.org) to be used during CI build/test steps.
This is a plugin for Drone that is aimed mainly at enabling [Testcontainers](https://www.testcontainers.org) 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:
Expand All @@ -15,8 +15,8 @@ This plugin:

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.
* (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)

Expand Down Expand Up @@ -45,6 +45,52 @@ pipeline:
someregistry.com/redis:4.0.6: redis:4.0.6
```
### Usage with newer drone versions
Modify steps of the pipeline to resemble:
```yaml
steps:
- name: build
image: quay.io/testcontainers/dind-drone-plugin
environment:
CI_WORKSPACE: "/drone/src"
settings:
# This specifies the command that should be executed to perform build, test and
# integration tests. Not to be confused with Drone's `command`:
cmd: sleep 5 && ./gradlew clean check --info
# This image will run the cmd with your build steps
build_image: adoptopenjdk:14-openj9
# 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
volumes:
- name: dockersock
path: /var/run

# Specify docker:dind as a service
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run

volumes:
- name: dockersock
temp: {}
```
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.
Expand Down

0 comments on commit 0153604

Please sign in to comment.