inspec / train

Transport Interface to unify communication over SSH, WinRM, and friends.
Apache License 2.0
119 stars 87 forks source link

gem: pin down googleauth gem to below 1.9 #773

Closed ahasunos closed 6 months ago

ahasunos commented 7 months ago

Description

This PR addresses recent CI failures on Windows caused by changes in googleauth gem's method https://github.com/googleapis/google-auth-library-ruby/blob/8f127eee40b0f970706c59cb324f71408dd2fec4/lib/googleauth/compute_engine.rb#L72 . To restore stability to our CI pipelines, we're pinning the googleauth gem to version below 1.9 in our gemspec.

Related Issue

Types of changes

Checklist:

ahasunos commented 6 months ago

The intuition behind pinning googleauth below 1.9 is that the CI is failing with the following stacktrace on Windows

Click to see the stacktrace ``` C:/ruby31/lib/ruby/3.1.0/win32/registry.rb:289:in `OpenKey': The system cannot find the file specified. (Win32::Registry::Error) from C:/ruby31/lib/ruby/3.1.0/win32/registry.rb:431:in `open' from C:/ruby31/lib/ruby/3.1.0/win32/registry.rb:542:in `open' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_smbios.rb:123:in `load_product_name' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_smbios.rb:36:in `block in initialize' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/lazy_value.rb:462:in `perform_compute' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/lazy_value.rb:279:in `get' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_smbios.rb:51:in `product_name' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_smbios.rb:83:in `google_compute?' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_metadata.rb:708:in `block in gce_check' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_metadata.rb:706:in `synchronize' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_metadata.rb:706:in `gce_check' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_metadata.rb:397:in `lookup_response' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_metadata.rb:445:in `lookup' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env/compute_metadata.rb:487:in `check_existence' from C:/ruby31/lib/ruby/gems/3.1.0/gems/google-cloud-env-2.1.1/lib/google/cloud/env.rb:129:in `metadata?' from C:/ruby31/lib/ruby/gems/3.1.0/gems/googleauth-1.11.0/lib/googleauth/compute_engine.rb:73:in `on_gce?' from C:/ruby31/lib/ruby/gems/3.1.0/gems/googleauth-1.11.0/lib/googleauth/application_default.rb:58:in `get_application_default' from C:/ruby31/lib/ruby/gems/3.1.0/gems/train-3.12.0/lib/train/transports/gcp.rb:96:in `connect' from C:/ruby31/lib/ruby/gems/3.1.0/gems/train-3.12.0/lib/train/transports/gcp.rb:49:in `initialize' from C:/ruby31/lib/ruby/gems/3.1.0/gems/train-3.12.0/lib/train/transports/gcp.rb:33:in `new' from C:/ruby31/lib/ruby/gems/3.1.0/gems/train-3.12.0/lib/train/transports/gcp.rb:33:in `connection' from C:/workdir/lib/inspec/backend.rb:38:in `create' from C:/workdir/lib/inspec/runner.rb:92:in `configure_transport' from C:/workdir/lib/inspec/runner.rb:84:in `initialize' from C:/workdir/lib/inspec/cli.rb:407:in `new' from C:/workdir/lib/inspec/cli.rb:407:in `block in exec' from C:/workdir/lib/inspec/feature/runner.rb:24:in `with_feature' from C:/workdir/lib/inspec/feature.rb:6:in `with_feature' from C:/workdir/lib/inspec/cli.rb:395:in `exec' from C:/ruby31/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run' from C:/ruby31/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command' from C:/ruby31/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch' from C:/ruby31/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start' from C:/workdir/lib/inspec/base_cli.rb:40:in `start' from C:/workdir/inspec-bin/bin/inspec:11:in `
' ```

This arises from the method:

https://github.com/googleapis/google-auth-library-ruby/blob/8f127eee40b0f970706c59cb324f71408dd2fec4/lib/googleauth/compute_engine.rb#L72

which was updated in PR: https://github.com/googleapis/google-auth-library-ruby/pull/459

Hence, using a version which doesn't include the changes in this method.