|
| 1 | +let GitLab = ../package.dhall |
| 2 | + |
| 3 | +let Prelude = GitLab.Prelude |
| 4 | + |
| 5 | +let renderTop = GitLab.Top.toJSON |
| 6 | + |
| 7 | +-- No inheritance setting |
| 8 | +let inherit_absent = |
| 9 | + GitLab.Job::{ |
| 10 | + , stage = Some "build" |
| 11 | + , image = Some { name = "alpine:latest", entrypoint = Some [ " " ] } |
| 12 | + , script = [ "echo 'Hello World'" ] |
| 13 | + , inherit = None GitLab.Inherit.Type |
| 14 | + } |
| 15 | + |
| 16 | +-- Use default inheritance setting |
| 17 | +let inherit_inherit_default = |
| 18 | + GitLab.Job::{ |
| 19 | + , stage = Some "build" |
| 20 | + , image = Some { name = "alpine:latest", entrypoint = Some [ " " ] } |
| 21 | + , script = [ "echo 'Hello World'" ] |
| 22 | + , inherit = Some { |
| 23 | + `default` = Some (GitLab.Inherit.Choice.Defaults True), |
| 24 | + variables = None GitLab.Inherit.Choice, |
| 25 | + interruptible = None Bool |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | +-- Use variable default setting |
| 30 | +let inherit_variables_default = |
| 31 | + GitLab.Job::{ |
| 32 | + , stage = Some "build" |
| 33 | + , image = Some { name = "alpine:latest", entrypoint = Some [ " " ] } |
| 34 | + , script = [ "echo 'Hello World'" ] |
| 35 | + , inherit = Some { |
| 36 | + `default` = None GitLab.Inherit.Choice, |
| 37 | + variables = Some (GitLab.Inherit.Choice.Defaults True), |
| 38 | + interruptible = None Bool |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | +-- Use variable list |
| 43 | +let inherit_variables_list = |
| 44 | + GitLab.Job::{ |
| 45 | + , stage = Some "build" |
| 46 | + , image = Some { name = "alpine:latest", entrypoint = Some [ " " ] } |
| 47 | + , script = [ "echo 'Hello World'" ] |
| 48 | + , inherit = Some { |
| 49 | + `default` = None GitLab.Inherit.Choice, |
| 50 | + variables = Some (GitLab.Inherit.Choice.Keywords ["a", "b"]), |
| 51 | + interruptible = None Bool |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | +-- Use variable list |
| 56 | +let inherit_interruptible = |
| 57 | + GitLab.Job::{ |
| 58 | + , stage = Some "build" |
| 59 | + , image = Some { name = "alpine:latest", entrypoint = Some [ " " ] } |
| 60 | + , script = [ "echo 'Hello World'" ] |
| 61 | + , inherit = Some { |
| 62 | + `default` = None GitLab.Inherit.Choice, |
| 63 | + variables = None GitLab.Inherit.Choice, |
| 64 | + interruptible = Some True |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | +let inherit_all_fields = |
| 69 | + GitLab.Job::{ |
| 70 | + , stage = Some "build" |
| 71 | + , image = Some { name = "alpine:latest", entrypoint = Some [ " " ] } |
| 72 | + , script = [ "echo 'Hello World'" ] |
| 73 | + , inherit = Some { |
| 74 | + `default` = Some (GitLab.Inherit.Choice.Defaults True), |
| 75 | + variables = Some (GitLab.Inherit.Choice.Keywords ["a", "b"]), |
| 76 | + interruptible = Some True |
| 77 | + } |
| 78 | + } |
| 79 | + |
| 80 | +let top = GitLab.Top::{ jobs = toMap { |
| 81 | + -- `inherits` field absent |
| 82 | + inherit_absent, |
| 83 | + -- `inherits` sets `default` to true. |
| 84 | + inherit_inherit_default, |
| 85 | + -- `inherits` sets `variables` to `true` |
| 86 | + inherit_variables_default, |
| 87 | + -- `inherits` sets `variables` to a list |
| 88 | + inherit_variables_list, |
| 89 | + -- `inherits` sets `interruptible`. |
| 90 | + inherit_interruptible, |
| 91 | + -- `inherits` sets all fields to a value (not necessarily useful but shows coverage). |
| 92 | + inherit_all_fields |
| 93 | + } |
| 94 | +} |
| 95 | + |
| 96 | +in Prelude.JSON.renderYAML (renderTop top) |
0 commit comments