microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.5k stars 2.61k forks source link

[REGRESSION]: Java Tool Installer task #20391

Closed pfoote closed 1 month ago

pfoote commented 2 months ago

New issue checklist

Task name

JavaToolInstaller

Breaking task version

0.245.3

Last working task version

0.243.3

Regression Description

Java tool installer fails

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Oracle Linux 8

Relevant log output

2024-09-09T05:09:09.7201506Z ##[section]Starting: Install JDK
2024-09-09T05:09:09.7224953Z ==============================================================================
2024-09-09T05:09:09.7225501Z Task         : Java tool installer
2024-09-09T05:09:09.7226038Z Description  : Acquire a specific version of Java from a user-supplied Azure blob or the tool cache and sets JAVA_HOME
2024-09-09T05:09:09.7226727Z Version      : 0.245.3
2024-09-09T05:09:09.7227118Z Author       : Microsoft Corporation
2024-09-09T05:09:09.7227602Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/tool/java-tool-installer
2024-09-09T05:09:09.7228177Z ==============================================================================
2024-09-09T05:09:10.0511195Z ##[error]Unhandled: Cannot find module 'node:os'
2024-09-09T05:09:10.0552710Z ##[error]Error: Cannot find module 'node:os'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/opc/agent-1/_work/_tasks/JavaToolInstaller_c0e0b74f-0931-47c7-ac27-7c5a19456a36/0.245.3/node_modules/@azure/logger/dist/commonjs/log.js:7:19)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2024-09-09T05:09:10.0558757Z ##[section]Finishing: Install JDK

Full task logs with system.debug enabled

2024-09-09T05:09:09.7201506Z ##[section]Starting: Install JDK 2024-09-09T05:09:09.7224953Z ============================================================================== 2024-09-09T05:09:09.7225501Z Task : Java tool installer 2024-09-09T05:09:09.7226038Z Description : Acquire a specific version of Java from a user-supplied Azure blob or the tool cache and sets JAVA_HOME 2024-09-09T05:09:09.7226727Z Version : 0.245.3 2024-09-09T05:09:09.7227118Z Author : Microsoft Corporation 2024-09-09T05:09:09.7227602Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/tool/java-tool-installer 2024-09-09T05:09:09.7228177Z ============================================================================== 2024-09-09T05:09:10.0511195Z ##[error]Unhandled: Cannot find module 'node:os' 2024-09-09T05:09:10.0552710Z ##[error]Error: Cannot find module 'node:os' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/home/opc/agent-1/_work/_tasks/JavaToolInstaller_c0e0b74f-0931-47c7-ac27-7c5a19456a36/0.245.3/node_modules/@azure/logger/dist/commonjs/log.js:7:19) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) 2024-09-09T05:09:10.0558757Z ##[section]Finishing: Install JDK

Repro steps

- task: JavaToolInstaller@0.245.3
  inputs:
    versionSpec: $(JDK_VERSION)
    jdkArchitectureOption: x64
    jdkSourceOption: LocalDirectory
    jdkFile: $(Agent.TempDirectory)/jdk.tar.gz
  displayName: Install JDK
DmitriiBobreshev commented 2 months ago

Hi @pfoote, thank you for your issue. Seems like the error happens because the agent run the task using node10 which don't have node:os module. To mitigate the issue could you please update your agent and/or remove AGENT_USE_NODE10 knob as it forces to run all tasks using node10 to check that this will resolve the error?

pfoote commented 1 month ago

Hi @pfoote, thank you for your issue. Seems like the error happens because the agent run the task using node10 which don't have node:os module. To mitigate the issue could you please update your agent and/or remove AGENT_USE_NODE10 knob as it forces to run all tasks using node10 to check that this will resolve the error?

Agent update fixed the issue, thank you

pfoote commented 1 month ago

Agent update fixed the issue, thank you