artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
8.06k stars 511 forks source link

Azure DevOps pipeline fails - appears related to Node version #3339

Open davidfordaus opened 2 months ago

davidfordaus commented 2 months ago

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:

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: