tomzo/gocd-yaml-config-plugin

Issue with export of pipeline with two materials without a name

arvindsv opened this issue · 1 comments

Found by @maheshp:

If you try to export a pipeline with two materials without explicit names, then one of the materials won't show up in the export.

JSON to reproduce this
{
  "target_version": 1,
  "errors": [],
  "environments": [],
  "pipelines": [
    {
      "group": "simple",
      "name": "Pipe",
      "display_order_weight": -1.0,
      "label_template": "${COUNT}",
      "lock_behavior": "none",
      "environment_variables": [],
      "parameters": [],
      "materials": [
        {
          "url": "test1",
          "branch": "master",
          "shallow_clone": false,
          "filter": {
            "ignore": [],
            "includes": []
          },
          "destination": "test1",
          "auto_update": true,
          "type": "git"
        },
        {
          "url": "test2",
          "branch": "master",
          "shallow_clone": false,
          "filter": {
            "ignore": [],
            "includes": []
          },
          "destination": "test2",
          "auto_update": true,
          "type": "git"
        }
      ],
      "stages": [
        {
          "name": "S",
          "fetch_materials": true,
          "never_cleanup_artifacts": false,
          "clean_working_directory": false,
          "approval": {
            "type": "success",
            "users": [],
            "roles": [],
            "allow_only_on_success": false
          },
          "environment_variables": [],
          "jobs": [
            {
              "name": "j",
              "environment_variables": [],
              "tabs": [],
              "resources": [],
              "artifacts": [],
              "timeout": 0.0,
              "tasks": [
                {
                  "command": "ls",
                  "timeout": -1.0,
                  "arguments": [],
                  "run_if": "passed",
                  "type": "exec"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
Exported YAML
format_version: 9
pipelines:
  Pipe:
    group: simple
    label_template: ${COUNT}
    lock_behavior: none
    display_order: -1
    materials:
      git:
        git: test2
        shallow_clone: false
        auto_update: true
        branch: master
        destination: test2
    stages:
    - S:
        fetch_materials: true
        keep_artifacts: false
        clean_workspace: false
        approval:
          type: success
          allow_only_on_success: false
        jobs:
          j:
            timeout: 0
            tasks:
            - exec:
                command: ls
                run_if: passed

Looks to be a problem with the defaulting of material name to material type around here.

tomzo commented

fixed in 0.13.0