drone / go-convert

Package convert provides tools for converting pipeline configuration files to the Drone format.
Apache License 2.0
9 stars 8 forks source link

[downgrade] fix parallel steps #166

Closed jimsheldon closed 8 months ago

jimsheldon commented 8 months ago

This v1 yaml

stages:
- name: test
  spec:
    steps:
    - spec:
        steps:
        - name: test1
          spec:
            image: busybox:latest
            run: |-
              echo "Do a test here"
              echo "For example run a test suite"
          type: script
        - name: test2
          spec:
            image: busybox:latest
            run: |-
              echo "Do another parallel test here"
              echo "For example run a lint test"
          type: script
      type: parallel
  type: ci
version: 1

currently downgrades to this v0 yaml

pipeline:
  identifier: default
  name: default
  orgIdentifier: default
  projectIdentifier: default
  properties:
    ci:
      codebase:
        build: <+input>
  stages:
  - stage:
      identifier: test
      name: test
      spec:
        cloneCodebase: true
        execution:
          steps:
          - parallel:
            - identifier: test1
              name: test1
              spec:
                command: |-
                  echo "Do a test here"
                  echo "For example run a test suite"
                image: busybox:latest
              timeout: ""
              type: Run
            - identifier: test2
              name: test2
              spec:
                command: |-
                  echo "Do another parallel test here"
                  echo "For example run a lint test"
                image: busybox:latest
              timeout: ""
              type: Run
        platform:
          arch: Amd64
          os: Linux
        runtime:
          spec: {}
          type: Cloud
      type: CI

it should downgrade to this

pipeline:
  identifier: default
  name: default
  orgIdentifier: default
  projectIdentifier: default
  stages:
  - stage:
      identifier: test
      name: test
      spec:
        cloneCodebase: true
        execution:
          steps:
          - parallel:
            - step:
                identifier: test1
                name: test1
                spec:
                  command: |-
                    echo "Do a test here"
                    echo "For example run a test suite"
                  image: busybox:latest
                timeout: ""
                type: Run
            - step:
                identifier: test2
                name: test2
                spec:
                  command: |-
                    echo "Do another parallel test here"
                    echo "For example run a lint test"
                  image: busybox:latest
                timeout: ""
                type: Run
        platform:
          arch: Amd64
          os: Linux
        runtime:
          spec: {}
          type: Cloud
      type: CI
jimsheldon commented 8 months ago

Fix in #167