Skip to content

Commit

Permalink
tests: fix kokoro environment loading to get credentials from secret …
Browse files Browse the repository at this point in the history
…manager (#502)
  • Loading branch information
dazuma authored Dec 4, 2024
1 parent 682d328 commit 075b59e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .kokoro/presubmit/samples.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ env_vars: {

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: ""
value: "ruby-main-ci-service-account"
}
20 changes: 10 additions & 10 deletions .toys/.lib/repo_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ class RepoContext

def self.load_kokoro_env
return if @loaded_env
@loaded_env = true

if ::ENV["KOKORO_GFILE_DIR"]
service_account = "#{::ENV['KOKORO_GFILE_DIR']}/service-account.json"
raise "#{service_account} is not a file" unless ::File.file? service_account
::ENV["GOOGLE_APPLICATION_CREDENTIALS"] = service_account
gfile_dir = ::ENV["KOKORO_GFILE_DIR"]
return unless gfile_dir

filename = "#{::ENV['KOKORO_GFILE_DIR']}/ruby_env_vars.json"
raise "#{filename} is not a file" unless ::File.file? filename
env_vars = ::JSON.parse ::File.read filename
env_vars.each { |k, v| ::ENV[k] ||= v }
end
filename = "#{gfile_dir}/ruby_env_vars.json"
raise "#{filename} is not a file" unless ::File.file? filename
env_vars = ::JSON.parse ::File.read filename
env_vars.each { |k, v| ::ENV[k] ||= v }

@loaded_env = true
filename = "#{gfile_dir}/secret_manager/ruby-main-ci-service-account"
raise "#{filename} is not a file" unless ::File.file? filename
::ENV["GOOGLE_APPLICATION_CREDENTIALS"] = filename
end
end
2 changes: 0 additions & 2 deletions lib/googleauth/id_tokens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ def verify_oidc token,
aud: nil,
azp: nil,
iss: OIDC_ISSUERS

verifier = Verifier.new key_source: oidc_key_source,
aud: aud,
azp: azp,
Expand Down Expand Up @@ -206,7 +205,6 @@ def verify_iap token,
aud: nil,
azp: nil,
iss: IAP_ISSUERS

verifier = Verifier.new key_source: iap_key_source,
aud: aud,
azp: azp,
Expand Down

0 comments on commit 075b59e

Please sign in to comment.