Skip to content

Support environment variable interpolation in keyvault config#504

Merged
devendra-lohar merged 3 commits intomasterfrom
dev/support-env-var-interpolation-keyvault
Feb 2, 2026
Merged

Support environment variable interpolation in keyvault config#504
devendra-lohar merged 3 commits intomasterfrom
dev/support-env-var-interpolation-keyvault

Conversation

@devendra-lohar
Copy link
Contributor

@devendra-lohar devendra-lohar commented Jan 28, 2026

This PR adds support for environment variable interpolation for Azure Key Vault configurations.

Changes:

  • Added env var expansion to SafeLoaderIgnoreUnknown during the initial YAML parsing (before KeyVaultLoader is created), so keyvault config values are expanded early.

  • test_and_build.yml: Added KEYVAULT_NAME env var

  • dummyconfig_keyvault.yaml, dummyconfig_keyvault_remote.yaml: Updated to use ${KEYVAULT_NAME}

More information can be found here: https://cognitedata.atlassian.net/browse/DOG-6250

@gemini-code-assist
Copy link

Summary of Changes

Hello @devendra-lohar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the configuration loading mechanism to support environment variable interpolation within YAML files, particularly for Azure Key Vault configurations. This change streamlines how sensitive or dynamic configuration values are managed, allowing them to be sourced directly from the environment rather than hardcoded or requiring explicit os.path.expandvars calls. The update simplifies the code for initializing Key Vault clients and is thoroughly tested to ensure robust behavior across different authentication methods.

Highlights

  • Environment Variable Interpolation: YAML configurations can now directly use environment variables for Azure Key Vault settings, such as keyvault-name, client-id, tenant-id, and secret.
  • Simplified Key Vault Client Initialization: Removed explicit dotenv loading and os.path.expandvars calls from the Key Vault client initialization, as environment variable resolution is now handled by the YAML loader.
  • Comprehensive Testing: Added new unit tests to ensure environment variable expansion works correctly for both default and client-secret authentication methods for Azure Key Vault.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for environment variable interpolation within the Azure KeyVault configuration. The approach of handling this during the YAML loading phase is correct. However, I've identified a critical issue in the _load_yaml_dict_raw function concerning thread safety due to modification of global state, and inconsistent behavior when handling unknown YAML tags. I have provided a detailed review comment with a suggested refactoring to resolve these issues.

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.13%. Comparing base (ac0840a) to head (8b6e5da).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #504      +/-   ##
==========================================
+ Coverage   81.03%   81.13%   +0.10%     
==========================================
  Files          43       43              
  Lines        4212     4208       -4     
==========================================
+ Hits         3413     3414       +1     
+ Misses        799      794       -5     
Files with missing lines Coverage Δ
cognite/extractorutils/configtools/loaders.py 85.33% <100.00%> (+1.92%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@devendra-lohar devendra-lohar marked this pull request as ready for review January 28, 2026 09:06
@devendra-lohar devendra-lohar requested a review from a team as a code owner January 28, 2026 09:06
Copy link
Contributor

@nithinb nithinb left a comment

Choose a reason for hiding this comment

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

LGTM

@devendra-lohar devendra-lohar added the waiting-for-risk-review Waiting for a member of the risk review team to take an action label Jan 29, 2026
@einarmo einarmo self-assigned this Feb 2, 2026
@einarmo einarmo added the risk-review-ongoing Risk review is in progress label Feb 2, 2026
@einarmo einarmo added waiting-for-team Waiting for the submitter or reviewer of the PR to take an action and removed waiting-for-risk-review Waiting for a member of the risk review team to take an action labels Feb 2, 2026
@devendra-lohar devendra-lohar added waiting-for-risk-review Waiting for a member of the risk review team to take an action and removed waiting-for-team Waiting for the submitter or reviewer of the PR to take an action labels Feb 2, 2026
@einarmo
Copy link
Contributor

einarmo commented Feb 2, 2026

🦄

@einarmo einarmo added waiting-for-team Waiting for the submitter or reviewer of the PR to take an action and removed waiting-for-risk-review Waiting for a member of the risk review team to take an action labels Feb 2, 2026
@devendra-lohar devendra-lohar merged commit dd94c20 into master Feb 2, 2026
8 of 9 checks passed
@devendra-lohar devendra-lohar deleted the dev/support-env-var-interpolation-keyvault branch February 2, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants