azureazure-pipelinesazure-devops-extensionsazure-devops-server-2019azure-devops-server-2020

How to debug extension in Azure DevOps Server


Currently, I am implementing an extension for Azure DevOps cloud & Server. This extension is something that will add a pipeline task. When I was testing this extension I encountered an issue. After that, I fixed the problem and reinstalled the extension with a newer version.

Then I found out that newly added files are not reflected. Can anyone assist with this?

I tried compiling the Tasks and re install with the newer version.

Extension structure

{
    "manifestVersion": 1,
    "id": "dev",
    "name": "test",
    "version": "8.0",
    "publisher": "coder",
    "targets": [
        {
            "id": "Microsoft.VisualStudio.Services"
        }
    ],
    "description": "Manage your day-to-day work items, sprints, and releases in test",
    "categories": [
        "Azure Pipelines"
    ],

    "icons": {
        "default": "static/icon.png"
    },
    "content": {
        "details": {
            "path": "overview.md"
        }
    },

    "files": [
        {
            "path": "Tasks/AddFeedStatusV1"
        },
        {
            "path": "static",
            "addressable": true
        }
    ],
    "contributions": [
        {
            "id": "service-endpoint",
            "description": "Service endpoint type for devuser connections",
            "type": "ms.vss-endpoint.service-endpoint-type",
            "targets": [
                "ms.vss-endpoint.endpoint-types"
            ],
            "properties": {
                "name": "devuser",
                "displayName": "devuser server connection",
                "url": {
                    "displayName": "Server Url",
                    "helpText": "Url for the devuser server to connect to."
                },
                "inputDescriptors": [
                    {
                        "id": "integ_scope_id",
                        "name": "integ_scope_id",
                        "description": "",
                        "inputMode": "textbox",
                        "isConfidential": false,
                        "validation": {
                            "isRequired": true,
                            "dataType": "string",
                            "maxLength": 300
                        }
                    },
                    {
                        "id": "conenction_function_uuid",
                        "name": "conenction_function_uuid",
                        "description": "",
                        "inputMode": "textbox",
                        "isConfidential": false,
                        "validation": {
                            "isRequired": true,
                            "dataType": "string",
                            "maxLength": 300
                        }
                    },
                    {
                        "id": "conenction_function_version",
                        "name": "conenction_function_version",
                        "description": "",
                        "inputMode": "textbox",
                        "isConfidential": false,
                        "validation": {
                            "isRequired": true,
                            "dataType": "string",
                            "maxLength": 300
                        }
                    },
                    {
                        "id": "app_install_id",
                        "name": "app_install_id",
                        "description": "",
                        "inputMode": "textbox",
                        "isConfidential": false,
                        "validation": {
                            "isRequired": true,
                            "dataType": "string",
                            "maxLength": 300
                        }
                    },
                    {
                        "id": "extension_id",
                        "name": "extension_id",
                        "description": "",
                        "inputMode": "textbox",
                        "isConfidential": false,
                        "validation": {
                            "isRequired": true,
                            "dataType": "string",
                            "maxLength": 300
                        }
                    }
                ],
                "authenticationSchemes": [
                    {
                        "type": "ms.vss-endpoint.endpoint-auth-scheme-token"
                    }
                ],
                "dataSources": [],
                "helpMarkDown": "<a href=\"url-to-documentation\" target=\"_blank\"><b>Learn More</b></a>"
            }
        },
        {
            "id": "zs-addfeedstatus-task",
            "type": "ms.vss-distributed-task.task",
            "targets": [
                "ms.vss-distributed-task.tasks"
            ],
            "properties": {
                "name": "Tasks/AddFeedStatusV1"
            }
        }
    ]
}

Solution

  • Based on your description, the *.js and *.js.map files are in the AddFeedStatusV1 folder and the folder has been included in the vss-extension.json.

    "files": [
        {
            "path": "Tasks/AddFeedStatusV1"
        },
        {
            "path": "static",
            "addressable": true
        }
    ],
    

    When you package the extension, the updated files should be included in the extension.

    The cause of the issue could be that the task version is not update, Azure DevOps will not update the task configuration file. Updating the extension's version (in the manifest file) is not enough.

    You can try to update the task version in the task.json file.

    For example:

    task.json

    {
     "$schema": "https://raw.githubusercontent.com/Microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
     "id": "a4234567-b49c-22d3-f456-526614176030",
     "name": "xx",
     "friendlyName": "xx",
     "description": "xx",
     "helpMarkDown": "",
     "category": "Utility",
     "author": "A",
     "version": {
         "Major": 0,
         "Minor": 4,
         "Patch": 0
     },
    .....
    

    Then you can package the extension again and install the new extension.

    In this case, you can check if the updated files will be reflected.