Skip to content

Fix invalid api key errors when using JCasC#515

Merged
rodrigo-roca merged 1 commit into
masterfrom
rodrigo.roca/fix-jcasc-invalid-api-key-on-startup
Jun 9, 2025
Merged

Fix invalid api key errors when using JCasC#515
rodrigo-roca merged 1 commit into
masterfrom
rodrigo.roca/fix-jcasc-invalid-api-key-on-startup

Conversation

@rodrigo-roca

@rodrigo-roca rodrigo-roca commented Jun 6, 2025

Copy link
Copy Markdown
Collaborator

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

When initialising the Datadog client using an API key, we typically get the secret from the Jenkins credentials (see DatadogCredentialsApiKey.java file). If using configuration as code, the user can provide an API key from the beginning and by the time we initialise the Datadog client the credentials are not ready yet, causing invalid API Key errors (when in reality the keys may be valid). To fix it, the user had to manually go to the settings page and click on Save or Apply.

Closes #514

Description of the Change

To avoid this, this PR makes the Datadog client to be initialised on SYSTEM_CONFIG_ADAPTED instead of SYSTEM_CONFIG_LOADED. At that point the credentials can be retrieved successfully.

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@rodrigo-roca rodrigo-roca self-assigned this Jun 6, 2025
@rodrigo-roca rodrigo-roca added the changelog/Fixed Fixed features results into a bug fix version bump label Jun 6, 2025
@rodrigo-roca rodrigo-roca changed the title init datadog config on systen config adapted milestone Fix invalid api key errors when using JCasC Jun 6, 2025
@rodrigo-roca
rodrigo-roca marked this pull request as ready for review June 6, 2025 12:55

@drodriguezhdez drodriguezhdez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rodrigo-roca
rodrigo-roca merged commit 1b4abfe into master Jun 9, 2025
20 checks passed
@rodrigo-roca
rodrigo-roca deleted the rodrigo.roca/fix-jcasc-invalid-api-key-on-startup branch June 9, 2025 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Fixed Fixed features results into a bug fix version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid API Key when plugin config is loaded via JcasC

2 participants