Open jamiehaywood opened 2 years ago
@DenisRumyantsev is there any movement on this issue?
@jamiehaywood thank you for suggesting this feature, we will check if it is possible to implement it
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
bump - not stale
You have my vote
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
bump - not stale
(Not so) fun fact: NodeTool@0 (which is probably the predecessor of UseNode@1) supports using .nvmrc
@DenisRumyantsev is there any movement on this issue?
bump. stuck on NodeTool@0 with no upgrade path.
I had issues installing Node on custom Windows agents using NodeTool@0 so I had to switch to UseNode@1 and read the version from the .nvmrc
file myself.
Normally I would have written a bash or powershell script as that is 10x easier, but unfortunately they were not installed on the agents. Therefore I had to write a batch script:
- script: |
@echo off
setlocal enabledelayedexpansion
for /f "delims=v" %%i in ('type .nvmrc') do (
set NODE_VERSION=%%i
)
echo ##vso[task.setvariable variable=nodeVersion]!NODE_VERSION!
endlocal
displayName: "Read Node version from .nvmrc"
- task: UseNode@1
displayName: 'Install Node'
inputs:
version: $(nodeVersion)
For clarity: this uses the double percent notation (%%i
) because under the hood, the script is written to a batch file and then executed on the agent. The syntax of a for loop is different between batch files and direct cmd input.
We only use UseNode@1
with the major Node.js version, like this:
- task: UseNode@1
displayName: 'Install Node'
inputs:
version: 20
This at least means that a Node.js pre-installed on the build agent is always used, so the installation in the pipeline is stable. However, you have to take care manually that the Node.js of the build agents and the one in the project do not diverge.
https://stackoverflow.com/questions/75583337/cache-nodejs-tool-in-devops/78875309#78875309
Note
Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo
For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks
If you have an issue or request for the Azure Pipelines service, use developer community instead:
https://developercommunity.visualstudio.com/spaces/21/index.html )
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Feature
Enter Task Name: UseNode
list here (V# not needed):
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/UseNodeV1
Issue Description
It would be great to add optional inputs to UseNode that would allow for engines & nvmrc detection, i.e:
Currently we do some convoluted detection by doing the following: