Skip to content

Commit

Permalink
use SSI variables on release builds (#4571)
Browse files Browse the repository at this point in the history
* use SSI variables in CI

* add SSI env var guards in guardrails tests

* only run in SSI mode on release
  • Loading branch information
bengl authored Aug 2, 2024
1 parent 748e199 commit 3e690eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions integration-tests/init.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const { engines } = require('../package.json')
const supportedRange = engines.node
const currentVersionIsSupported = semver.satisfies(process.versions.node, supportedRange)

// These are on by default in release tests, so we'll turn them off for
// more fine-grained control of these variables in these tests.
delete process.env.DD_INJECTION_ENABLED
delete process.env.DD_INJECT_FORCE

function testInjectionScenarios (arg, filename, esmWorks = false) {
if (!currentVersionIsSupported) return
const doTest = (file, ...args) => testFile(file, ...args)
Expand Down
5 changes: 5 additions & 0 deletions integration-tests/package-guardrails.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const DD_TRACE_DEBUG = 'true'
const DD_INJECTION_ENABLED = 'tracing'
const DD_LOG_LEVEL = 'error'

// These are on by default in release tests, so we'll turn them off for
// more fine-grained control of these variables in these tests.
delete process.env.DD_INJECTION_ENABLED
delete process.env.DD_INJECT_FORCE

describe('package guardrails', () => {
useEnv({ NODE_OPTIONS })
const runTest = (...args) =>
Expand Down
6 changes: 6 additions & 0 deletions packages/dd-trace/test/setup/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ if (global.describe && typeof global.describe.skip !== 'function') {
}

process.env.DD_INSTRUMENTATION_TELEMETRY_ENABLED = 'false'

// If this is a release PR, set the SSI variables.
if (/^v\d+\.x$/.test(process.env.GITHUB_BASE_REF || '')) {
process.env.DD_INJECTION_ENABLED = 'true'
process.env.DD_INJECT_FORCE = 'true'
}

0 comments on commit 3e690eb

Please sign in to comment.