azure-devops-create-pr-task icon indicating copy to clipboard operation
azure-devops-create-pr-task copied to clipboard

Cross platform task

Open bdovaz opened this issue 1 year ago • 12 comments

  • I created the package.json file based on the wrapper example and taking values from the vss-extension.json file.
  • I created the tsconfig.json file following the official documentation: https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops

I created the index.ts file following the blog post where it explains how to make the wrapper:

  • The variables that read the task input are added in the order in which they appear in the task.json file in order to have some kind of order in the future if something is modified because being so many it is difficult to know if they are all in this file.
  • The parameters that are passed to the createPullRequest.ps1 RunTask function are added in the order in which they are received in that function for the same reasons as in the previous point.
  • The variable "githubEndpoint" is the only one that is not passed to the RunTask function of the createPullRequest.ps1 script. For this reason, I do not use it in index.ts for the moment.

Remaining tasks:

  • [ ] Check all the added files (I have hardly any experience with tasks development, npm, typescript, ...)
  • [ ] Check that there is no typo / something missing in index.ts
  • [ ] Necessary changes in createPullRequest.ps1 because right now it reads inside directly the parameters with Get-VstsInput in several functions and actually it should take the ones that arrive in the RunTask function.
  • [ ] Test everything very well to see that there are no regressions.

As I said, I have no experience with TypeScript or developing tasks for Azure Pipelines.... I see that there is no test so I'm afraid that creating a regression is very easy.

I need you to lend me a hand in what you can to speed up this PR. Otherwise, I don't think I will be able to do it on my own.

bdovaz avatar Jul 17 '22 17:07 bdovaz

Hi, Thank you so much for your PR, i will check it! First thing i can see that iIn the task.json need to change the execution from PS to TS:

    "execution": {
        "Node10": {
            "target": "index.js"
        }
    }

shayki5 avatar Jul 17 '22 20:07 shayki5

Replaced!

bdovaz avatar Jul 17 '22 21:07 bdovaz

Great! need to change the pipeline to convert .ts to .js file, can you push the .js file just for the tests?

shayki5 avatar Jul 18 '22 14:07 shayki5

It's git ignored because it's automatically generated with "npm run build" (with tsc) command.

bdovaz avatar Jul 18 '22 15:07 bdovaz

@shayki5 any news? Have you been able to take the time to check it?

bdovaz avatar Nov 18 '22 08:11 bdovaz

Not yet 😞 need to change the pipeline also for support the ts.. i have already an example from my other extensions: https://github.com/shayki5/azure-devops-print-all-variables/blob/master/azure-pipelines.yml Just need to time to make it work also in this pr...

shayki5 avatar Nov 21 '22 08:11 shayki5

How is this progressing? It would really like to be able to run this on other platforms other than windows.

DaleMckeown avatar Mar 22 '23 16:03 DaleMckeown

@DaleMckeown Unfortunately I haven't had time to delve into it yet, the pipeline needs to be updated also to support it. In the meantime, you can run a dedicated Windows job for this step.

shayki5 avatar Mar 26 '23 11:03 shayki5

Not yet 😞 need to change the pipeline also for support the ts.. i have already an example from my other extensions: https://github.com/shayki5/azure-devops-print-all-variables/blob/master/azure-pipelines.yml Just need to time to make it work also in this pr...

@shayki5 can you describe more specifically what needs to happen for this PR to be able to be completed? I and others may be willing to contribute if the acceptance criteria were specified (and if possible the specific files that need to be updated). Thanks!

steveruddell avatar Apr 18 '23 15:04 steveruddell

Hi @steveruddell, thank you for your comment! First of all need to update the azure pipeline to build the extension from the ts files, you can see an example here: https://github.com/shayki5/azure-devops-print-all-variables/blob/master/azure-pipelines.yml After that it will be possible to check the other files. I just don't have any experience with wrapping PS extension with TS, you can see here some guidness: https://blogs.blackmarble.co.uk/rfennell/a-technique-for-porting-powershell-based-azure-devops-extensions-to-node-so-they-can-be-run-cross-platform-without-a-complete-re-write/

shayki5 avatar Apr 18 '23 15:04 shayki5