Skip to content

[DEV-140033] Extract function to fetch secrets to prepare for new .env source#51

Merged
tonitienda-rovtech merged 22 commits into
masterfrom
refactor/extract-function-to-fetch-secrets
Mar 2, 2026
Merged

[DEV-140033] Extract function to fetch secrets to prepare for new .env source#51
tonitienda-rovtech merged 22 commits into
masterfrom
refactor/extract-function-to-fetch-secrets

Conversation

@tonitienda-rovtech
Copy link
Copy Markdown
Contributor

@tonitienda-rovtech tonitienda-rovtech commented Feb 25, 2026

Preparing the codebase for the introduction of a new source that will require to fetch secrets from AWS SM.

Changes

  • Extract the functionality of retrieving secrets from AWS SM from the "secretsmanager" resolver to a "connector"
  • Use it in both secretsmanager resolver and manifest resolver

Overview

flowchart

subgraph resolvers
   manifest
   sm_resolver[secretsmanager]
   s3_resolver[s3]
end

subgraph connectors
   sm_conn[secretsmanager]
end


subgraph aws
sm_aws[AWS SM]
s3_aws[S3]

end
manifest --> sm_conn
sm_resolver --> sm_conn

s3_resolver --> s3_aws
sm_conn --> sm_aws
Loading

Tests

  • Unit tests work
  • I tested that for sources with the format sm:// .. the output of 0.6.1 and this version the output is the same.

@tonitienda-rovtech tonitienda-rovtech marked this pull request as ready for review February 25, 2026 13:21
@tonitienda-rovtech tonitienda-rovtech changed the title Refactor/extract function to fetch secrets [DEV-140033] Extract function to fetch secrets to prepare for new .env source Feb 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors AWS Secrets Manager integration by extracting the secret retrieval logic into a reusable connector module. This prepares the codebase for introducing a new .env source that will also need to fetch secrets from AWS Secrets Manager.

Changes:

  • Created a new aws_sm_connector.go file containing the extracted AWS Secrets Manager connection and secret retrieval logic
  • Refactored secretsmanager.go to use the new connector for recursive secret resolution
  • Refactored manifest.go to use the new connector instead of its own worker implementation
  • Added comprehensive unit tests for the new connector functionality

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 14 comments.

File Description
pkg/resolvers/aws_sm_connector.go New connector module providing NewSecretsManager client factory, smWorker for concurrent secret retrieval, and getSecrets function for batch secret fetching
pkg/resolvers/aws_sm_connector_test.go Comprehensive test suite with mocks for testing the connector's worker, concurrency handling, error cases, and configuration
pkg/resolvers/secretsmanager.go Removed duplicate worker code and refactored resolveRecursive to use new connector's NewSecretsManager and getSecrets functions
pkg/resolvers/manifest.go Removed manifestWorker implementation and refactored resolveManifestItems to use new connector, updated function signature to accept source parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/resolvers/manifest.go Outdated
Comment thread pkg/connectors/secretsmanager_test.go Outdated
Comment thread pkg/resolvers/aws_sm_connector.go Outdated
Comment thread pkg/connectors/secretsmanager_test.go Outdated
Comment thread pkg/resolvers/aws_sm_connector.go Outdated
Comment thread pkg/resolvers/aws_sm_connector.go Outdated
Comment thread pkg/connectors/secretsmanager_test.go Outdated
Comment thread pkg/resolvers/aws_sm_connector.go Outdated
Comment thread pkg/resolvers/aws_sm_connector.go Outdated
Comment thread pkg/resolvers/aws_sm_connector.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/clients/aws.go
Comment thread pkg/connectors/secretsmanager.go Outdated
Comment thread pkg/connectors/secretsmanager_test.go
Comment thread pkg/resolvers/manifest_test.go Outdated
Comment thread pkg/resolvers/manifest.go Outdated
Comment thread pkg/connectors/secretsmanager.go Outdated
Comment thread pkg/connectors/secretsmanager.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/resolvers/manifest.go Outdated
Comment thread pkg/connectors/secretsmanager.go
Comment thread pkg/connectors/secretsmanager.go
Comment thread pkg/connectors/secretsmanager.go Outdated
Comment thread pkg/config/config.go Outdated
Comment thread pkg/resolvers/manifest_test.go
Comment thread pkg/resolvers/manifest_test.go
Comment thread pkg/resolvers/secretsmanager_test.go
Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

@tonitienda-rovtech I've opened a new pull request, #52, to work on those changes. Once the pull request is ready, I'll request review from you.

@tonitienda-rovtech tonitienda-rovtech merged commit 9c9f69e into master Mar 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants