Search code examples
tfsazure-devopscommand-line-interfacemarketplaceazure-devops-extensions

How to publish a prod build of our VSTS extensions package to my dev VSTS (not prod VSTS), so I can validate it before publishing to prod VSTS?


I want to take the package as-built by the release line, and install it to another (non-prod) VSTS, so I can validate it works, before installing to our prod VSTS.

We use VSTS vNext build with VSTS task 'Package Extension' to compile the package. This compiles 'Publisher' with value 'my-prod-publisher' into file 'extension.vsixmanifest'

I've tried:

  • Manually upload package to VSTS marketplace portal for "my-dev-publisher". Results are:

    'Upload Error' : Publisher ID 'my-prod-publisher' provided in the extension manifest should match the publisher ID 'my-dev-publisher' under which you are trying to publish this extension.

  • Modify VSIX package:

    • Unzip the .VSIX package
    • Edit file 'extension.vsixmanifest' to change 'Publisher' from value 'my-prod-publisher' to 'my-dev-publisher'
    • zip contents into new ZIP file
    • change package file suffix .ZIP to .VSIX
    • upload to VSTS marketplace portal for 'my-dev-publisher'
    • Results are:

      TF400898: An Internal Error Occurred. Activity Id: 64d37121-ea19-42dc-9994-dbef8e6dc205.

    My google-fu failed to find content about this error relevant to my case. Didn't search too hard on this, as I wasn't expecting re-zipping the files to produce same results as how these packages are compiled.

  • Publish via tfx-cli

    tfx extension publish --service-url https://marketplace.visualstudio.com/ --publisher "my-dev-publisher" --vsix .\my-prod-publisher.vsts-buildrelease-tasks-0.6.181012.vsix --accounts my-dev-vsts --auth-type pat --token [my-dev-vsts-PAT] --trace-level debug

    Results in error:

    Received response 401 (Not Authorized). Check that your personal access token is correct and hasn't expired.

    I verified 'my dev vsts PAT' isn't expired, and is authorized for "All scopes", in VSTS 'my-dev-vsts'.

  • Validating a branch build, instead of release-line build

    Compiling the package with 'Publisher' = 'my-dev-publisher' does allow me to publish to portal 'my-dev-publisher' which then allows me to install extensions package into 'my-dev-VSTS'. This wasn't effective enough, since I've been burned by subtle issues such as:

    • package/tasks version numbers not getting bumped correctly, or different values from PROD.
    • files/changes missed during commit to release-line.

Solution

  • We have support for these features in the CI/CD tasks for extensions. These build tasks also offer the option of bumping the version of the extension and the build tasks included in the extension. You can standardize the build process using a Task Group if you want to. Or use Release Management to promote the vsix from dev to prod. These tasks will actually override the publisher-id. You will also have to override the extension-id and make it private. Only one public prod extension can be made public and extension-ids are globally unique.

    The alternative is to build the dev and the release vsix at the same time to ensure they're matching. Then don't use the release package until you need it.

    The issues you're seeing are the reason we built these tasks.

    • TF400898: An Internal Error Occurred. Activity Id: 64d37121-ea19-42dc-9994-dbef8e6dc205. This happens when the zip is using the wrong compression method. In the extension tasks I had to fiddle quite a bit to get the 7z syntx right.
    • Received response 401 (Not Authorized). Check that your personal access token is correct and hasn't expired. is caused by the fact that when publishing from vsix the --extension-id and --publisher are ignored. But TFX doesn't tell you.