DataDog / datadog-ci

Use Datadog from your CI.
https://datadoghq.com
Apache License 2.0
129 stars 55 forks source link

Binary script fails with Node --max-old-space-size option set #1488

Open chrisforrette opened 3 weeks ago

chrisforrette commented 3 weeks ago

Bug description

We ran into an oddly specific failure scenario for this CLI. This took a while to figure out so I wanted to make sure to share it with y'all.

When running the Linux standalone binary of the datadog-ci CLI, if the Node --max-old-space-size option is set at all, any/all commands fail with bash exit code 4. We found this while running it in GitHub Actions:

Run datadog-ci version
  datadog-ci version
  shell: /usr/bin/bash -e {0}
  env:
    NODE_OPTIONS: --max-old-space-size=[4](https://github.com/splice/platform/actions/runs/11637324673/job/32410310394#step:3:4)096
Error: Process completed with exit code 4.

In "Steps to reproduce the issue" you will see that set --max-old-space-size to 4096 but I found that any value here would cause datadog-ci to fail.

Describe what you expected

I would expect to be able to set --max-old-space-size and other standard Node settings and the commands in this CLI to execute successfully, or communicate more obviously if the setting is restrictive enough to block the CLI from performing its tasks.

Steps to reproduce the issue

This GitHub Actions workflow does it:

name: 'Datadog CI Test Workflow'

on:
  push:
    branches:
      - name-of-your-branch

env:
  NODE_OPTIONS: '--max-old-space-size=4096'

jobs:
  datadog-ci:
    name: Test Datadog CI
    runs-on: [ubuntu-latest]
    steps:
      - name: Install Datadog CI
        run: curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

      - name: Datadog CI version
        run: datadog-ci version

If you remove/comment the NODE_OPTIONS environment variable entry, it works perfectly.

Additional context

No response

Command

None