Azure-pipelines-tasks: How to build and package a Task into vsix?

Created on 14 May 2019  路  8Comments  路  Source: microsoft/azure-pipelines-tasks

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Question

Enter Task Name: filetransform
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/FileTransformV1

Environment

  • Server - TFS on-premises

    • If using TFS on-premises, provide the version: 16.131.27701.1

Issue Description

I'm trying to build and package the filetransform task, from your master branch, into a vsix file. Then, I'm hoping to install it on our on-premise TFS 2018, since it is not available there.

I found this page and tried following the linked guides, but I can't get it to work:
https://137.116.185.157/content/problem/552873/file-transform-task-missing-form-azure-devops-serv.html

What I did was:

  1. Download the master branch from here
  2. Build the entire thing with: node make.js build
    (I don't know if this is the correct way to build this..)
  3. Went into the folder ./_build/Tasks/FileTransformV1
  4. Tried running: tfx extension create --manifest-globs package.json
    This fails with the error:
    error: 'publisher' must be provided.,One or more 'categories' must be provided.,Your extension must define at least one contribution or contribution type.
  1. I then tried adding "publisher", "categories" and "contribution" elements to package.json, and managed to create a vsix file. That vsix file seems empty though, since it doesn't contain the javascript nor task.json.

I'm probably doing this the wrong way. I have a feeling that the package.json is not meant to be used as an extension manifest..
How can I create a working vsix for the filetransform task?

question route

All 8 comments

Hey @MathiasRonnblom, the docs do seem a little confusing since there are multiple .json files for any given task. I believe you'll want to use the task.json here: https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/FileTransformV1/task.json for uploading extensions.

That is the correct way to build the task, but that will also build every other task in the repo as well. If you want something a little quicker, you can do node make.js build --task FileTransformV1 which will just build that one task

@joshmgross Thanks for the quick reply!

Trying to run from task.json also produces errors:

tfx extension create --manifest-globs task.json

error: 'version' must be provided.,'publisher' must be provided.,One or more 'categories' must be provided.,Your extension must define at least one contribution or contribution type.

Adding "version", "publisher" and "categories" to task.json creates a vsix, but it is still empty save for three files:
extension.vsixmanifest
extension.vsomanifest
[Content_Types].xml

I would expect at least the file filetransform.js to be included. It seems that task.json is not a valid extension manifest either.. How do you go about packaging this for the marketplace? Maybe there's one huge extension manifest for the entire thing?

Hey @MathiasRonnblom, looks like I was incorrect. You'll need to create a manifest file, these docs should help: https://docs.microsoft.com/en-us/azure/devops/extend/develop/manifest?view=tfs-2017

Ok, thanks!

@mronnblom Hey! Did you manage to actually package this into a vix-file and upload it? I'm trying to do the same thing but I can't even build the project.

node make.js build --task FileTransformV1

Leads to:

------------------------------------------------------------
Building: FileTransformV1
------------------------------------------------------------

> getting task externals

Building module C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\Tasks\Common\webdeployment-common-v2

> cd Tasks\Common\webdeployment-common-v2

> npm install

> tsc --outDir "C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\_build\Tasks\Common\webdeployment-common-v2" --rootDir "C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\Tasks\Common\webdeployment-common-v2"

> cd ..\..\..

> copying module resources
copying *.ps1
copying *.psd1
copying *.psm1
copying *.sh
copying *.txt
copying icon.png
copying icon.svg
copying module.json
copying node_modules
copying package.json
copying Strings
copying task.json
copying task.loc.json
copying Tests

> getting module externals
Downloading file: https://vstsagenttools.blob.core.windows.net/tools/7zip/1/7zip.zip
Could not use "nc", falling back to slower node.js method for sync requests.
C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\node_modules\sync-request\index.js:77
    throw new Error(res.stderr.toString());
    ^

Error
    at doRequestWith (C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\node_modules\sync-request\index.js:77:11)
    at doRequest (C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\node_modules\sync-request\index.js:20:10)
    at downloadFile (C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\make-util.js:411:22)
    at downloadArchive (C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\make-util.js:451:27)
    at C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\make-util.js:644:33
    at Array.forEach (<anonymous>)
    at getExternals (C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\make-util.js:639:25)
    at C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\make.js:235:25
    at Array.forEach (<anonymous>)
    at C:\Users\FJBE85\Downloads\azure-pipelines-tasks-master\make.js:203:20

@poserdonut I'm afraid not. I think we made a workaround with Powershell in TFS instead. It was quite a while ago, I'm not on the same project anymore, so I can't check unfortunately.

@poserdonut Try installing node 10

@poserdonut Try installing node 10

Thanks for the tip.

Was this page helpful?
0 / 5 - 0 ratings