Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Use rails credentials instead of secrets #928

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented Nov 15, 2024

:vmware_cloud_defaults => {:host => "vmwarecloudhost", :userid => "VMWARE_CLOUD_USERID", :password => "VMWARE_CLOUD_PASSWORD"},
:vmware_infra_defaults => {:hostname => "HOSTNAME"},
:vmware_tanzu_defaults => {:hostname => "vmware-tanzu-hostname", :userid => "VMWARE_TANZU_USERID", :password => "VMWARE_TANZU_PASSWORD"}
}.freeze
Copy link
Member Author

@jrafanie jrafanie Nov 15, 2024

Choose a reason for hiding this comment

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

@agrare I'm thinking this constant ☝️ would live in each plugin...

The two methods below could live in core spec/shared:
👇

VCR.configure do |config|
# config.default_cassette_options = { :record => :all }
Copy link
Member Author

Choose a reason for hiding this comment

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

placeholder to verify cassette recording uses the correct values from local rails credentials and falls back to the defaults.

@jrafanie
Copy link
Member Author

jrafanie commented Dec 5, 2024

@agrare @Fryguy any feedback on the changes in this PR? I'd like to move the common methods to core and implement them in the provider PRs if the direction looks ok.

TEST_CREDENTIALS_DEFAULTS = {
:vmware_cloud_defaults => {:host => "vmwarecloudhost", :userid => "VMWARE_CLOUD_USERID", :password => "VMWARE_CLOUD_PASSWORD"},
:vmware_infra_defaults => {:hostname => "HOSTNAME"},
:vmware_tanzu_defaults => {:hostname => "vmware-tanzu-hostname", :userid => "VMWARE_TANZU_USERID", :password => "VMWARE_TANZU_PASSWORD"}
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm open to make the constant have the DEFAULTS name an simplify the keys to no longer have defaults in the name to avoid redundancy. Let me know your thoughts.

@Fryguy
Copy link
Member

Fryguy commented Dec 5, 2024

I'm thinking of a slightly different way to organize this, but I'm not 100% sure it will work, because I really don't understand the new Rails credentials thing (nor why we wouldn't keep it the way it was to some extent). Let's discuss over voice, then I can more properly write my thoughts here.

We don't need to use Rails secrets or credentials here as the secrets we have
are defaults for sanitizing any of our real secrets with fake ones so our tests
can run anywhere from cassettes.
@jrafanie
Copy link
Member Author

@Fryguy @agrare please see this PR along with the core PR: ManageIQ/manageiq#23292... throw 🍅

@jrafanie jrafanie added the test label Dec 10, 2024
:hostname: vmware-tanzu-hostname
:userid: VMWARE_TANZU_USERID
:password: VMWARE_TANZU_PASSWORD

Copy link
Member

Choose a reason for hiding this comment

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

Minor, but there's a bonus newline here.

end

config.define_cassette_placeholder(default_vcr_secret_by_key_path(:vmware_tanzu, :hostname)) { vcr_secret_by_key_path(:vmware_tanzu, :hostname) }
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but I'm wondering if we consolidate this pattern into a helper method...something like

Suggested change
config.define_cassette_placeholder(default_vcr_secret_by_key_path(:vmware_tanzu, :hostname)) { vcr_secret_by_key_path(:vmware_tanzu, :hostname) }
vcr_define_cassette_placeholder(config, :vmware_tanzu, :hostname)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants