f2calv / yamlizr

Azure DevOps Designer-to-YAML Pipeline CLI CodeGen Tool w/GitHub Actions Generation
MIT License
69 stars 16 forks source link

generated pipeline is null #184

Closed AnderssonPeter closed 1 year ago

AnderssonPeter commented 1 year ago

Key

Describe the bug When I run the command above I get the following output:

  _   _  __ _ _ __ ___ | (_)_____ __
 | | | |/ _` | '_ ` _ \| | |_  / '__|
 | |_| | (_| | | | | | | | |/ /| |
  \__, |\__,_|_| |_| |_|_|_/___|_|
  |___/

For documentaton/support;
- https://github.com/f2calv/yamlizr (Azure Pipelines)
- https://github.com/samsmithnz/AzurePipelinesToGitHubActionsConverter (GitHub Actions)

To update/refresh this tool;
   dotnet tool update --global yamlizr

Connecting to DevOps REST API, https://dev.azure.com/petoj87/ ... connected :)
Retrieving Azure DevOps Project 'DeployToProxmox' ...  retrieved :)
Pre-loading relevant Azure DevOps objects, this may take some time...
100,00% 1 build definition reference(s) retrieved.                                                                                                                       00:00:00 / 00:00:00────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────info: CasCap.Services.ApiService[0]
      Retrieving all extensions for organisation 'https://dev.azure.com/petoj87/'

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
100,00% Retrieved 1 of 1 full build definition(s).                                                                                                                       00:00:00 / 00:00:00────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
100,00% YamlPipelineGenerator processed 1 of 1 release definition(s).                                                                                                    00:00:00 / 00:00:00────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

100,00% Persisting 0 release pipeline(s) to disk with GitHub Actions conversion...                                                                                       00:00:00 / 00:00:00────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

1 error(s) encountered when running Azure Designer -> Azure Pipeline conversion;
- Processing release definition id 1 'DebianDockerVM' failed (generated pipeline is null)
Total of 0 YAML file(s) created.
Exiting...

To Reproduce Steps to reproduce the behavior:

Create a release pipeline with the following: Create a pipeline from json (I removed some parts and replaced some urls with ...)

{
    "source": 2,
    "revision": 10,
    "description": null,
    "createdBy":
    {
        "displayName": "Peter Andersson"
    },
    "createdOn": "2023-02-20T16:48:01.877Z",
    "modifiedBy":
    {
        "displayName": "Peter Andersson"
    },
    "modifiedOn": "2023-02-21T12:31:20.337Z",
    "isDeleted": false,
    "lastRelease":
    {
        "id": 9,
        "name": "0.0.12",
        "artifacts": [],
        "_links": {},
        "description": "Triggered by AnderssonPeter.ServerSetup 0.0.12.",
        "releaseDefinition":
        {
            "id": 1,
            "projectReference": null,
            "_links": {}
        },
        "createdOn": "2023-02-21T12:32:21.000Z",
        "createdBy":
        {
            "displayName": "Microsoft.VisualStudio.Services.TFS"
        }
    },
    "variables": {},
    "variableGroups": [],
    "environments": [
        {
            "id": 1,
            "name": "Stage 1",
            "rank": 1,
            "owner":
            {
                "displayName": "Peter Andersson"
            },
            "variables": {},
            "variableGroups": [],
            "preDeployApprovals":
            {
                "approvals": [
                    {
                        "rank": 1,
                        "isAutomated": true,
                        "isNotificationOn": false,
                        "id": 1
                    }
                ],
                "approvalOptions":
                {
                    "requiredApproverCount": null,
                    "releaseCreatorCanBeApprover": false,
                    "autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
                    "enforceIdentityRevalidation": false,
                    "timeoutInMinutes": 0,
                    "executionOrder": 1
                }
            },
            "deployStep":
            {
                "id": 2
            },
            "postDeployApprovals":
            {
                "approvals": [
                    {
                        "rank": 1,
                        "isAutomated": true,
                        "isNotificationOn": false,
                        "id": 3
                    }
                ],
                "approvalOptions":
                {
                    "requiredApproverCount": null,
                    "releaseCreatorCanBeApprover": false,
                    "autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
                    "enforceIdentityRevalidation": false,
                    "timeoutInMinutes": 0,
                    "executionOrder": 2
                }
            },
            "deployPhases": [
                {
                    "deploymentInput":
                    {
                        "healthPercent": 0,
                        "deploymentHealthOption": "OneTargetAtATime",
                        "tags": [],
                        "skipArtifactsDownload": false,
                        "artifactsDownloadInput":
                        {
                            "downloadInputs": []
                        },
                        "queueId": 28,
                        "demands": [],
                        "enableAccessToken": false,
                        "timeoutInMinutes": 0,
                        "jobCancelTimeoutInMinutes": 1,
                        "condition": "succeeded()",
                        "overrideInputs": {}
                    },
                    "rank": 1,
                    "phaseType": 4,
                    "name": "Deployment group job",
                    "refName": null,
                    "workflowTasks": [
                        {
                            "environment": {},
                            "taskId": "5e1e3830-fbfb-11e5-aab1-090c92bc4988",
                            "version": "1.*",
                            "name": "Extract files ",
                            "refName": "",
                            "enabled": true,
                            "alwaysRun": false,
                            "continueOnError": false,
                            "timeoutInMinutes": 0,
                            "retryCountOnTaskFailure": 0,
                            "definitionType": "task",
                            "overrideInputs": {},
                            "condition": "succeeded()",
                            "inputs":
                            {
                                "archiveFilePatterns": "**/*.zip",
                                "destinationFolder": "/tmp/test",
                                "cleanDestinationFolder": "true",
                                "overwriteExistingFiles": "false",
                                "pathToSevenZipTool": ""
                            }
                        }
                    ]
                }
            ],
            "environmentOptions":
            {
                "emailNotificationType": "OnlyOnFailure",
                "emailRecipients": "release.environment.owner;release.creator",
                "skipArtifactsDownload": false,
                "timeoutInMinutes": 0,
                "enableAccessToken": false,
                "publishDeploymentStatus": true,
                "badgeEnabled": false,
                "autoLinkWorkItems": false,
                "pullRequestDeploymentEnabled": false
            },
            "demands": [],
            "conditions": [
                {
                    "name": "ReleaseStarted",
                    "conditionType": 1,
                    "value": ""
                }
            ],
            "executionPolicy":
            {
                "concurrencyCount": 1,
                "queueDepthCount": 0
            },
            "schedules": [],
            "currentRelease":
            {
                "id": 1,
                "url": "....",
                "_links": {}
            },
            "retentionPolicy":
            {
                "daysToKeep": 30,
                "releasesToKeep": 3,
                "retainBuild": true
            },
            "processParameters": {},
            "properties":
            {
                "BoardsEnvironmentType":
                {
                    "$type": "System.String",
                    "$value": "unmapped"
                },
                "LinkBoardsWorkItems":
                {
                    "$type": "System.String",
                    "$value": "False"
                }
            },
            "preDeploymentGates":
            {
                "id": 0,
                "gatesOptions": null,
                "gates": []
            },
            "postDeploymentGates":
            {
                "id": 0,
                "gatesOptions": null,
                "gates": []
            },
            "environmentTriggers": [],
            "badgeUrl": "...."
        }
    ],
    "artifacts": [
        {
            "sourceId": "c44021b4-176f-4d26-b4e7-28c4db0b382b:1",
            "type": "Build",
            "alias": "_AnderssonPeter.ServerSetup",
            "definitionReference":
            {
                "artifactSourceDefinitionUrl":
                {
                    "id": "...",
                    "name": ""
                },
                "defaultVersionBranch":
                {
                    "id": "",
                    "name": ""
                },
                "defaultVersionSpecific":
                {
                    "id": "",
                    "name": ""
                },
                "defaultVersionTags":
                {
                    "id": "",
                    "name": ""
                },
                "defaultVersionType":
                {
                    "id": "latestType",
                    "name": "Latest"
                },
                "definition":
                {
                    "id": "1",
                    "name": "AnderssonPeter.ServerSetup"
                },
                "definitions":
                {
                    "id": "",
                    "name": ""
                },
                "IsMultiDefinitionType":
                {
                    "id": "False",
                    "name": "False"
                },
                "project":
                {
                    "id": "...",
                    "name": "DeployToProxmox"
                },
                "repository":
                {
                    "id": "",
                    "name": ""
                }
            },
            "isPrimary": true,
            "isRetained": false
        }
    ],
    "triggers": [
        {
            "artifactAlias": "_AnderssonPeter.ServerSetup",
            "triggerConditions": [],
            "triggerType": 1
        }
    ],
    "releaseNameFormat": "$(Build.BuildNumber)",
    "tags": [],
    "properties":
    {
        "DefinitionCreationSource":
        {
            "$type": "System.String",
            "$value": "ReleaseNew"
        },
        "IntegrateBoardsWorkItems":
        {
            "$type": "System.String",
            "$value": "False"
        },
        "IntegrateJiraWorkItems":
        {
            "$type": "System.String",
            "$value": "false"
        }
    },
    "id": 1,
    "name": "DebianDockerVM",
    "path": "\\",
    "projectReference": null,
    "url": "...",
    "_links":
    {
        "self":
        {
            "href": "..."
        },
        "web":
        {
            "href": "..."
        }
    }
}

Run the command above and you get the output posted above.

Expected behavior It should export a yml file?

Screenshots image image image image

Desktop (please complete the following information):

AnderssonPeter commented 1 year ago

After debugging the code I managed to find a solution adding --phasetype MachineGroupBasedDeployment did it.