torbencarstens / dhall-circleci

Generate CircleCI config from `dhall` representations
MIT License
1 stars 1 forks source link

Get Workflows working #1

Open torbencarstens opened 5 years ago

torbencarstens commented 5 years ago

I'm currently stuck on the implementation of this part of a workflow:

workflows:
  version: 2
  build_and_deploy:
    jobs:
      - run
      - pdoc
      - build:
          requires:
            - run
          filters:
            branches:
              only:
                - develop
                - master

I can't get the Union of jobs working correctly (that is, dynamic keys in the job list).


First try:

[
        {
            mapKey = "version"
            , mapValue = < Version = 2 | Workflow : { jobs : List < Name : Text | Job : { mapKey: Text, mapValue : { requires : Optional (List Text), filters : Optional { branches : { only : Optional (List Text) } } } } > } >
        }
        ,{
            mapKey = "build_and_deploy"
            , mapValue =
                < Version : Natural | Workflow = { jobs = [
                        < Name = "job" | Job : { mapKey : Text, mapValue : { requires : Optional (List Text), filters : Optional { branches : { only : Optional (List Text) } } } } >
                        , (keyValue "build" { requires = (Some ["asd"]), filters = None { branches : { only : Optional (List Text) } } })
                    ]
                } >
        }]

->

workflows:
  build_and_deploy:
    jobs:
    - job
    - mapKey: build
      mapValue:
        requires:
        - asd
  version: 2

Not sure why mapKey and mapValue aren't replaced correctly... seems like a deep nesting issue.

torbencarstens commented 5 years ago
workflows =
        {jobs = [
        < A = {
            nesting  = Nesting.Nested "run"
            , field = "job"
            , contents = Example.Right "contents"
        } | B : { mapKey : Text, mapValue : Text} >,
        < A : { nesting : Nesting, field : Text, contents : Example } | B = {
            mapKey = "job",
            mapValue = "test"
        } >
        ]}

->

workflows:
  jobs:
  - run: contents
    job: Right
  - mapKey: job
    mapValue: test

Same issue (mapKey and mapValue) stay the same.