-
Notifications
You must be signed in to change notification settings - Fork 192
馃懛 skip telemetry error checks when no datacenter has credentials #4997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BenoitZugmeyer
merged 2 commits into
main
from
benoit/skip-telemetry-check-without-credentials
Aug 28, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import assert from 'node:assert/strict' | ||
| import path from 'node:path' | ||
| import { afterEach, before, describe, it, mock } from 'node:test' | ||
| import { mockModule } from '../deploy/lib/testHelpers.ts' | ||
|
|
||
| describe('secrets', () => { | ||
| let getTelemetryOrgApiKey: (site: string) => string | undefined | ||
| const commandMock = mock.fn<(...args: any[]) => any>() | ||
|
|
||
| before(async () => { | ||
| await mockModule(path.resolve(import.meta.dirname, './command.ts'), { command: commandMock }) | ||
| ;({ getTelemetryOrgApiKey } = await import('./secrets.ts')) | ||
| }) | ||
|
|
||
| afterEach(() => { | ||
| commandMock.mock.resetCalls() | ||
| }) | ||
|
|
||
| function mockCommandRun(run: () => string): void { | ||
| commandMock.mock.mockImplementation(() => { | ||
| const chain = { | ||
| withInput: () => chain, | ||
| withEnvironment: () => chain, | ||
| withCurrentWorkingDirectory: () => chain, | ||
| withLogs: () => chain, | ||
| run, | ||
| } | ||
| return chain | ||
| }) | ||
| } | ||
|
|
||
| it('returns the secret value when the parameter exists', () => { | ||
| mockCommandRun(() => 'a-secret-value\n') | ||
|
|
||
| assert.strictEqual(getTelemetryOrgApiKey('datadoghq.com'), 'a-secret-value') | ||
| }) | ||
|
|
||
| it('returns undefined when the parameter is not found', () => { | ||
| mockCommandRun(() => { | ||
| throw new Error( | ||
| 'Command failed with exit status 255: aws ssm get-parameter\n---- stderr: ----\n' + | ||
| 'aws: [ERROR]: An error occurred (ParameterNotFound) when calling the GetParameter operation:\n----' | ||
| ) | ||
| }) | ||
|
|
||
| assert.strictEqual(getTelemetryOrgApiKey('datadoghq.com'), undefined) | ||
| }) | ||
|
|
||
| it('rethrows errors that are not ParameterNotFound', () => { | ||
| mockCommandRun(() => { | ||
| throw new Error( | ||
| 'Command failed with exit status 255: aws ssm get-parameter\n---- stderr: ----\nNetwork error\n----' | ||
| ) | ||
| }) | ||
|
|
||
| assert.throws(() => getTelemetryOrgApiKey('datadoghq.com'), /Network error/) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: When AWS SSM is temporarily unavailable or the job loses permission, both telemetry credential getters catch every command failure and return
undefined, so this condition disables the pre-deploy check and the entire post-deploy gate while the production workflow proceeds with deployment. Before this change, the gate retried credential reads on every iteration and could recover from a transient failure; distinguish a genuinely missing parameter from lookup errors, or keep reevaluating credentials during the gate.Useful? React with 馃憤聽/ 馃憥.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenoitZugmeyer should we only skip when crendentials are confirmed to be missing ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a commit for that. The command will now crash if something goes wrong instead of proceed forward.