artillery icon indicating copy to clipboard operation
artillery copied to clipboard

Azure DevOps pipeline fails - appears related to Node version

Open davidfordaus opened this issue 5 months ago • 0 comments

When running the following example: https://github.com/artilleryio/artillery/blob/main/examples/cicd/azure-devops/azure-pipelines.yml

Version info:

2.0.20

Running this command:

Run the pipeline within Azure DevOps above with the example file provided

I expected to see this happen:

  • Success / pipeline runs correctly

Instead, this happened:

============================================================================== Task : Command line Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows Version : 2.244.3 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line

Generating script. Script contents: artillery run tests/performance/socket-io.yml ========================== Starting Command Output =========================== /usr/bin/bash --noprofile --norc /home/vsts/work/_temp/96570284-a41e-4827-a70b-75a84145ac56.sh /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/artillery/node_modules/@oclif/core/lib/command.js:45 delete this.baseFlags?.json; ^

SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/artillery/node_modules/@oclif/core/lib/index.js:4:19) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

Files being used:

https://github.com/artilleryio/artillery/blob/main/examples/cicd/azure-devops/azure-pipelines.yml

This file references node v12. Optional chaining (A JavaScript language feature) as above wasn't introduced until Node v14.

The primary issue is locking the Node version at 12 while permitting the Artillery version to be @latest so the Node and Artillery versions can get out of sync

Suggestions:

  • I'd suggest updating the Node install section of the Pipeline YML file
  • Synchronise the documentation with the code; in general public documentation should be updated as the code / examples are updated

davidfordaus avatar Sep 13 '24 06:09 davidfordaus