test-kitchen / kitchen-ec2

A Test Kitchen Driver for Amazon EC2
Other
221 stars 202 forks source link

Digest initialization failed: initialization error in the specified(Ruby-3.2/OpenSSL-3.0.8 7) #606

Open lmayorga1980 opened 1 year ago

lmayorga1980 commented 1 year ago

I am trying to run a kitchen-test using the latest AWS Codebuild Image https://github.com/aws/aws-codebuild-docker-images/blob/master/al2/aarch64/standard/3.0/Dockerfile

It is not working with this ruby version but the previous version before ruby 3.2 works fine. I also noticed that this 3.2 was compiled with openssl v3

Environment

gem 'serverspec' gem 'kitchen-ec2' gem 'kitchen-inspec' gem 'test-kitchen' gem 'rspec-retry' gem 'inspec-bin'

Error

------Exception------- agent_1 | >>>>>> Class: Kitchen::ActionFailed agent_1 | >>>>>> Message: 1 actions failed. agent_1 | >>>>>> Failed to complete #create action: [Digest initialization failed: initialization error in the specified region] agent_1 | >>>>>> ---------------------- agent_1 | >>>>>> Please see .kitchen/logs/kitchen.log for more details agent_1 | >>>>>> Also try running kitchen diagnose --all for configuration

Annih commented 5 months ago

Seems to relate to openssl compat issue. On my side I got the same with windows box, because of winrm not able to authenticate. The issue was actually in rubyntlm and they fixed their problem in https://github.com/WinRb/rubyntlm/blob/master/CHANGELOG.md#064-2024-06-06

lmayorga1980 commented 5 months ago

@Annih it seems like that issue is fixed but something else is failing. In this case, I am using ruby 3.2.1

bundle exec kitchen converge                                                                                               ░▒▓ ✔  24s   09:33:41  
-----> Starting Test Kitchen (v3.6.0)
-----> Creating <default-windows-2019>...
       Detected platform: windows version 2019rtm on x86_64. Instance Type: t2.large. Default username: administrator (default).
       If you are not using an account that qualifies under the AWS
free-tier, you may be charged to run these suites. The charge
should be minimal, but neither Test Kitchen nor its maintainers
are responsible for your incurred costs.

       Waited 0/60s for spot request to become fulfilled.
       Instance <i-0b6adeda9a2aa985f> requested.
       Polling AWS for existence, attempt 0...
       EC2 instance <i-0b6adeda9a2aa985f> created.
       Waited 0/600s for instance <i-0b6adeda9a2aa985f> to become ready.
       Waited 5/600s for instance <i-0b6adeda9a2aa985f> to become ready.
       Waited 10/600s for instance <i-0b6adeda9a2aa985f> to become ready.
       Waited 15/600s for instance <i-0b6adeda9a2aa985f> to become ready.
       Waited 20/600s for instance <i-0b6adeda9a2aa985f> to become ready.
       Waited 25/600s for instance <i-0b6adeda9a2aa985f> to become ready.
       Waited 30/600s for instance <i-0b6adeda9a2aa985f> to become ready.
       Waited 35/600s for instance <i-0b6adeda9a2aa985f> to become ready.
       Waited 0/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 5/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 10/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 15/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 20/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 25/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 30/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 35/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 40/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 45/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 50/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 55/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 60/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 65/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 70/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 75/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Waited 80/600s for instance <i-0b6adeda9a2aa985f> to fetch windows admin password.
       Retrieved Windows password for instance <i-0b6adeda9a2aa985f>.
       EC2 instance <i-0b6adeda9a2aa985f> ready (hostname: <PUBLIC_IP>).
       [WinRM] Established

       Finished creating <default-windows-2019> (2m42.40s).
-----> Converging <default-windows-2019>...
       Preparing files for transfer
       Preparing script
       No provisioner script file specified, skipping
       Transferring files to <default-windows-2019>
       Downloading files from <default-windows-2019>
       Finished converging <default-windows-2019> (0m8.33s).
-----> Test Kitchen is finished. (2m51.16s)
/Users/lcentinel/.rbenv/versions/3.2.1/bin/bundle: warning: Exception in finalizer #<Proc:0x0000000106312e80 /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/winrm-2.3.6/lib/winrm/shells/power_shell.rb:33>
/Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:471:in `new': can't alloc thread (ThreadError)
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:471:in `create_with_logging_context'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:436:in `new'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:101:in `create_timeout_thread'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:134:in `block in ensure_timeout_thread_created'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:132:in `synchronize'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:132:in `ensure_timeout_thread_created'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/3.2.0/timeout.rb:181:in `timeout'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:515:in `query'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in `query'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in `do_get_block'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in `protect_keep_alive_disconnected'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/httpclient-2.8.3/lib/httpclient.rb:856:in `request'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/httpclient-2.8.3/lib/httpclient.rb:765:in `post'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/winrm-2.3.6/lib/winrm/http/transport.rb:176:in `send_request'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/winrm-2.3.6/lib/winrm/shells/power_shell.rb:42:in `close_shell'
    from /Users/lcentinel/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/winrm-2.3.6/lib/winrm/shells/power_shell.rb:33:in `block in finalize'

kitchen.yml

---
driver:
  name: ec2
  aws_ssh_key_id: kitchen
  spot_price: on-demand
  region: us-east-1
  availability_zone: a
  instance_type: t2.large
  associate_public_ip: true
  interface: public
  subnet_id: MY-SUBNET-ID
  security_group_ids: MY-SG-ID
  user_data: user_data.ps1
  retryable_tries: 120
  metadata_options:
    http_tokens: 'required'
    http_put_response_hop_limit: 1
    instance_metadata_tags: 'enabled'

provisioner:
  name: shell
  log_level: 5
  max_retries: 3
  wait_for_retry: 30
  retry_on_exit_code: # will retry if winrm is unable to connect to the ec2 instance
    - -1 #Generic error during Chef execution 
    - 1 #Generic error during Chef execution

verifier:
  name: shell
  #command: env
  command: env

transport:
  name: winrm
  port: 5986
  winrm_transport: ssl
  ssl: true
  ssh_key: ~/.ssh/kitchen.pem
  max_wait_until_ready: 900
  connect_timeout: 60
  connection_retries: 10
  connection_retry_sleep: 10
  username: Administrator

platforms:
  - name: windows-2019
    driver:
      image_id: ami-0c24dc9d92f3c28ea

suites:
  - name: default

Gemfile

source 'https://rubygems.org'

gem 'test-kitchen'
gem 'serverspec'
gem 'kitchen-ec2'