commit 5832f9393d0a4dd765956418e70523b26fdbf2e3 Author: Christine Dodrill Date: Thu Jan 23 20:50:23 2020 +0000 drone generation diff --git a/drone/common/dockerBuild.dhall b/drone/common/dockerBuild.dhall new file mode 100644 index 0000000..c7d2193 --- /dev/null +++ b/drone/common/dockerBuild.dhall @@ -0,0 +1,15 @@ +let drone = ../types.dhall + +let dockerHost = ./dockerHost.dhall + +let dockerBuild + : Text → drone.Step.Type + = λ(imageName : Text) + → drone.Step::{ + , name = "build image ${imageName}" + , volumes = Some [ dockerHost.step ] + , image = "docker:dind" + , commands = [ "docker build -t ${imageName} ." ] + } + +in dockerBuild diff --git a/drone/common/dockerHost.dhall b/drone/common/dockerHost.dhall new file mode 100644 index 0000000..ead806b --- /dev/null +++ b/drone/common/dockerHost.dhall @@ -0,0 +1,8 @@ +let drone = ../types.dhall + +in { pipeline = drone.Volume::{ + , name = "dockersock" + , host = Some drone.HostVolume::{ path = "/var/run/docker.sock" } + } + , step = drone.StepVolume::{ name = "dockersock", path = "/var/run" } + } diff --git a/drone/common/go.dhall b/drone/common/go.dhall new file mode 100644 index 0000000..f00afc1 --- /dev/null +++ b/drone/common/go.dhall @@ -0,0 +1,12 @@ +let drone = ../types.dhall + +let image = env:GO_IMAGE ? "xena/go:1.13.6" + +let step = + drone.Step::{ + , name = "go test" + , image = image + , commands = [ "go test ./..." ] + } + +in step diff --git a/drone/pipeline.dhall b/drone/pipeline.dhall new file mode 100644 index 0000000..573722f --- /dev/null +++ b/drone/pipeline.dhall @@ -0,0 +1,14 @@ +let drone = ./types.dhall + +let dockerBuild = ./common/dockerBuild.dhall + +let dockerHost = ./common/dockerHost.dhall + +let pl = + drone.Pipeline::{ + , name = "go" + , steps = [ ./common/go.dhall, dockerBuild "xena/test" ] + , volumes = Some [ dockerHost.pipeline ] + } + +in pl diff --git a/drone/types.dhall b/drone/types.dhall new file mode 100644 index 0000000..9f50be5 --- /dev/null +++ b/drone/types.dhall @@ -0,0 +1,6 @@ +{ Step = ./types/step.dhall +, StepVolume = ./types/stepVolume.dhall +, HostVolume = ./types/hostVolume.dhall +, Volume = ./types/volume.dhall +, Pipeline = ./types/pipeline.dhall +} diff --git a/drone/types/hostVolume.dhall b/drone/types/hostVolume.dhall new file mode 100644 index 0000000..2e8567c --- /dev/null +++ b/drone/types/hostVolume.dhall @@ -0,0 +1 @@ +{ Type = { path : Text }, default = { path = "" } } diff --git a/drone/types/pipeline.dhall b/drone/types/pipeline.dhall new file mode 100644 index 0000000..42d5ab5 --- /dev/null +++ b/drone/types/pipeline.dhall @@ -0,0 +1,19 @@ +let Volume = ./volume.dhall + +let Step = ./step.dhall + +in { Type = + { kind : Text + , name : Text + , type : Text + , steps : List Step.Type + , volumes : Optional (List Volume.Type) + } + , default = + { kind = "pipeline" + , type = "docker" + , name = "test" + , steps = [] : List Step.Type + , volumes = None (List Volume.Type) + } + } diff --git a/drone/types/step.dhall b/drone/types/step.dhall new file mode 100644 index 0000000..8465910 --- /dev/null +++ b/drone/types/step.dhall @@ -0,0 +1,15 @@ +let StepVolume = ./stepVolume.dhall + +in { Type = + { name : Text + , image : Text + , commands : List Text + , volumes : Optional (List StepVolume.Type) + } + , default = + { name = "test" + , image = "xena/alpine:latest" + , commands = [ "uname -av" ] + , volumes = None (List StepVolume.Type) + } + } diff --git a/drone/types/stepVolume.dhall b/drone/types/stepVolume.dhall new file mode 100644 index 0000000..e9e15b6 --- /dev/null +++ b/drone/types/stepVolume.dhall @@ -0,0 +1 @@ +{ Type = { name : Text, path : Text }, default = { name = "", path = "" } } diff --git a/drone/types/volume.dhall b/drone/types/volume.dhall new file mode 100644 index 0000000..8b9295c --- /dev/null +++ b/drone/types/volume.dhall @@ -0,0 +1,5 @@ +let HostVolume = ./hostVolume.dhall + +in { Type = { name : Text, host : Optional HostVolume.Type } + , default = { name = "", host = None } + }