drone generation

This commit is contained in:
Cadey Ratio 2020-01-23 20:50:23 +00:00
commit 5832f9393d
10 changed files with 96 additions and 0 deletions

View File

@ -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

View File

@ -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" }
}

12
drone/common/go.dhall Normal file
View File

@ -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

14
drone/pipeline.dhall Normal file
View File

@ -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

6
drone/types.dhall Normal file
View File

@ -0,0 +1,6 @@
{ Step = ./types/step.dhall
, StepVolume = ./types/stepVolume.dhall
, HostVolume = ./types/hostVolume.dhall
, Volume = ./types/volume.dhall
, Pipeline = ./types/pipeline.dhall
}

View File

@ -0,0 +1 @@
{ Type = { path : Text }, default = { path = "" } }

View File

@ -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)
}
}

15
drone/types/step.dhall Normal file
View File

@ -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)
}
}

View File

@ -0,0 +1 @@
{ Type = { name : Text, path : Text }, default = { name = "", path = "" } }

5
drone/types/volume.dhall Normal file
View File

@ -0,0 +1,5 @@
let HostVolume = ./hostVolume.dhall
in { Type = { name : Text, host : Optional HostVolume.Type }
, default = { name = "", host = None }
}