-
Notifications
You must be signed in to change notification settings - Fork 69
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
base: master
Are you sure you want to change the base?
Changes from all commits
be14f86
62137fd
78d79f4
b89bf7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
--- | ||
test: | ||
vmware_cloud_defaults: &vmware_cloud_defaults | ||
host: vmwarecloudhost | ||
userid: VMWARE_CLOUD_USERID | ||
password: VMWARE_CLOUD_PASSWORD | ||
vmware_cloud: | ||
<<: *vmware_cloud_defaults | ||
vmware_infra_defaults: &vmware_infra_defaults | ||
hostname: HOSTNAME | ||
vmware_infra: | ||
<<: *vmware_infra_defaults | ||
vmware_tanzu_defaults: &vmware_tanzu_defaults | ||
hostname: vmware-tanzu-hostname | ||
userid: VMWARE_TANZU_USERID | ||
password: VMWARE_TANZU_PASSWORD | ||
vmware_tanzu: | ||
<<: *vmware_tanzu_defaults | ||
:vmware_cloud: | ||
:host: vmwarecloudhost | ||
:userid: VMWARE_CLOUD_USERID | ||
:password: VMWARE_CLOUD_PASSWORD | ||
:vmware_infra: | ||
:hostname: HOSTNAME | ||
:vmware_tanzu: | ||
:hostname: vmware-tanzu-hostname | ||
:userid: VMWARE_TANZU_USERID | ||
:password: VMWARE_TANZU_PASSWORD | ||
|
||
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,24 +14,27 @@ | |||||
end | ||||||
end | ||||||
|
||||||
Object.include Spec::Shared::CassetteSecretsHelper | ||||||
VCR.configure do |config| | ||||||
# config.default_cassette_options = { :record => :all } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||
|
||||||
config.ignore_hosts 'codeclimate.com' if ENV['CI'] | ||||||
config.cassette_library_dir = File.join(ManageIQ::Providers::Vmware::Engine.root, 'spec/vcr_cassettes') | ||||||
|
||||||
secrets = Rails.application.secrets | ||||||
config.define_cassette_placeholder(Rails.application.secrets.vmware_infra_defaults[:hostname]) do | ||||||
Rails.application.secrets.vmware_infra[:hostname] | ||||||
config.define_cassette_placeholder(default_vcr_secret_by_key_path(:vmware_infra, :hostname)) do | ||||||
vcr_secret_by_key_path(:vmware_infra, :hostname) | ||||||
end | ||||||
config.define_cassette_placeholder(Rails.application.secrets.vmware_cloud_defaults[:host]) do | ||||||
Rails.application.secrets.vmware_cloud[:host] | ||||||
config.define_cassette_placeholder(default_vcr_secret_by_key_path(:vmware_cloud, :host)) do | ||||||
vcr_secret_by_key_path(:vmware_cloud, :host) | ||||||
end | ||||||
config.define_cassette_placeholder("VMWARE_CLOUD_AUTHORIZATION") do | ||||||
Base64.encode64("#{Rails.application.secrets.vmware_cloud[:userid]}:#{Rails.application.secrets.vmware_cloud[:password]}").chomp | ||||||
Base64.encode64("#{vcr_secret_by_key_path(:vmware_cloud, :userid)}:#{vcr_secret_by_key_path(:vmware_cloud, :password)}").chomp | ||||||
end | ||||||
config.define_cassette_placeholder("VMWARE_CLOUD_INVALIDAUTHORIZATION") do | ||||||
Base64.encode64("#{Rails.application.secrets.vmware_cloud[:userid]}:invalid").chomp | ||||||
end | ||||||
secrets.vmware_tanzu.each do |key, val| | ||||||
config.define_cassette_placeholder(secrets.vmware_tanzu_defaults[key]) { val } | ||||||
Base64.encode64("#{vcr_secret_by_key_path(:vmware_cloud, :userid)}:invalid").chomp | ||||||
end | ||||||
|
||||||
config.define_cassette_placeholder(default_vcr_secret_by_key_path(:vmware_tanzu, :hostname)) { vcr_secret_by_key_path(:vmware_tanzu, :hostname) } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, :userid)) { vcr_secret_by_key_path(:vmware_tanzu, :userid) } | ||||||
config.define_cassette_placeholder(default_vcr_secret_by_key_path(:vmware_tanzu, :password)) { vcr_secret_by_key_path(:vmware_tanzu, :password) } | ||||||
end |
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.
Minor, but there's a bonus newline here.