Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bgamari/dhall-gitlab-ci
A Dhall encoding of the GitLab CI configuration schema
https://github.com/bgamari/dhall-gitlab-ci
Last synced: about 1 month ago
JSON representation
A Dhall encoding of the GitLab CI configuration schema
- Host: GitHub
- URL: https://github.com/bgamari/dhall-gitlab-ci
- Owner: bgamari
- License: bsd-3-clause
- Created: 2020-07-04T19:10:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-13T23:02:12.000Z (almost 1 year ago)
- Last Synced: 2024-08-04T04:05:19.446Z (3 months ago)
- Language: Dhall
- Size: 46.9 KB
- Stars: 46
- Watchers: 6
- Forks: 19
- Open Issues: 10
-
Metadata Files:
- Readme: README.mkd
- License: LICENSE
Awesome Lists containing this project
- awesome-dhall - bgamari/dhall-gitlab-ci - Dhall types for GitLab CI/CD. (Libraries)
README
# `dhall-gitlab-ci`: A Dhall representation of `gitlab-ci.yml`
This is a Dhall encoding of the GitLab CI configuration
[schema](https://docs.gitlab.com/ee/ci/yaml/README.html).See code under the [examples](./examples) folder or checkout the [dhall-gitlab-pipeline](https://gitlab.com/mx00s/dhall-gitlab-pipeline/-/tree/master) for a more complete project example.
## [Single Job Example - Source](./examples/single-job.dhall)
```dhall
let GitLab =
https://raw.githubusercontent.com/bgamari/dhall-gitlab-ci/master/package.dhalllet Prelude = GitLab.Prelude
let renderTop = GitLab.Top.toJSON
let demoJob =
GitLab.Job::{
, stage = Some "build"
, image = Some { name = "alpine:latest", entrypoint = Some [ " " ] }
, script = [ "echo 'Hello World'" ]
}let top = GitLab.Top::{ jobs = toMap { generated-job = demoJob } }
in Prelude.JSON.renderYAML (renderTop top)
```## [Multiple Jobs Example - Source](./examples/multiple-jobs.dhall)
```dhall
let GitLab = ../package.dhalllet Prelude = GitLab.Prelude
let List/map = Prelude.List.map
let Map = Prelude.Map.Type
let Job = GitLab.Job.Type
let renderTop = GitLab.Top.toJSON
let buildDir = "build"
let targets = [ "package-1", "package-2" ]
let mkJob =
λ(target : Text) →
GitLab.Job::{
, stage = Some "build"
, image = Some { name = "alpine:latest", entrypoint = Some [ " " ] }
, script = [ "echo 'Building ${buildDir}/${target} World'" ]
}let jobList
: List { mapKey : Text, mapValue : Job }
= List/map
Text
{ mapKey : Text, mapValue : Job }
(λ(target : Text) → { mapKey = target, mapValue = mkJob target })
targetslet jobMap
: Map Text Job
= jobListlet top = GitLab.Top::{ jobs = jobMap }
in Prelude.JSON.renderYAML (renderTop top)
```