Skip to content

Commit

Permalink
Add env variable to disable git unshallow
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariovido committed Feb 18, 2025
1 parent f9bf2f5 commit bd2d56a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ class CiVisibilityExporter extends AgentInfoExporter {
log.debug('Successfully uploaded git metadata')
}
this._resolveGit(err)
}
},
this._config.isTestUnshallowEnabled
)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function generateAndUploadPackFiles ({
/**
* This function uploads git metadata to CI Visibility's backend.
*/
function sendGitMetadata (url, { isEvpProxy, evpProxyPrefix }, configRepositoryUrl, callback) {
function sendGitMetadata (url, { isEvpProxy, evpProxyPrefix }, configRepositoryUrl, callback, isUnshallowEnabled) {
if (!isGitAvailable()) {
return callback(new Error('Git is not available'))
}
Expand Down Expand Up @@ -284,7 +284,9 @@ function sendGitMetadata (url, { isEvpProxy, evpProxyPrefix }, configRepositoryU
}
// Otherwise we unshallow and get commits to upload again
log.debug('It is shallow clone, unshallowing...')
unshallowRepository()
if (isUnshallowEnabled) {
unshallowRepository()
}

// The latest commits change after unshallowing
latestCommits = getLatestCommits()
Expand Down
5 changes: 4 additions & 1 deletion packages/dd-trace/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ class Config {
this._setValue(defaults, 'isTestDynamicInstrumentationEnabled', false)
this._setValue(defaults, 'isServiceUserProvided', false)
this._setValue(defaults, 'testManagementAttemptToFixRetries', 20)
this._setValue(defaults, 'isTestUnshallowEnabled', true)
this._setValue(defaults, 'isTestManagementEnabled', false)
this._setValue(defaults, 'logInjection', false)
this._setValue(defaults, 'lookup', undefined)
Expand Down Expand Up @@ -1146,7 +1147,8 @@ class Config {
DD_AGENTLESS_LOG_SUBMISSION_ENABLED,
DD_TEST_DYNAMIC_INSTRUMENTATION_ENABLED,
DD_TEST_MANAGEMENT_ENABLED,
DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES
DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES,
DD_TEST_UNSHALLOW_ENABLED
} = process.env

if (DD_CIVISIBILITY_AGENTLESS_URL) {
Expand All @@ -1171,6 +1173,7 @@ class Config {
'testManagementAttemptToFixRetries',
coalesce(maybeInt(DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES), 20)
)
this._setBoolean(calc, 'isTestUnshallowEnabled', isTrue(DD_TEST_UNSHALLOW_ENABLED))
}
this._setString(calc, 'dogstatsd.hostname', this._getHostname())
this._setBoolean(calc, 'isGitUploadEnabled',
Expand Down

0 comments on commit bd2d56a

Please sign in to comment.