opensearch-build: [Bug]: Cannot release opensearch-ruby 3.2.0 because of Jenkins

Describe the bug

The release of Ruby 3.2.0 was first triggered in Feb 2024 and failed with the following error:

/var/jenkins/workspace/opensearch-ruby-gems-release@tmp/durable-aa0447d1/script.sh: line 3: /usr/share/opensearch/.rvm/scripts/rvm: No such file or directory
ERROR:  Error installing opensearch-ruby-3.2.0.gem:
	The last version of faraday-net_http (>= 2.0, < 3.2) to support your Ruby & RubyGems was 3.0.2. Try installing it with `gem install faraday-net_http -v 3.0.2` and then running the current command again
	faraday-net_http requires Ruby version >= 3.0.0. The current ruby version is 2.6.0.0.
Successfully installed multi_json-1.15.0
Successfully installed uri-0.13.0
Successfully installed net-http-0.4.1
Gem 'opensearch-ruby' is not installed
WARNING:  faraday-net_http-3.1.0 is not signed
ERROR:  Error installing opensearch-ruby-3.2.0.gem:
	The last version of faraday-net_http (>= 2.0, < 3.2) to support your Ruby & RubyGems was 3.0.2. Try installing it with `gem install faraday-net_http -v 3.0.2` and then running the current command again
	faraday-net_http requires Ruby version >= 3.0.0. The current ruby version is 2.6.0.0.
Gem 'opensearch-ruby' is not installed

We tried to upgrade the rubyVersion of Jenkins to 3.0.6 but Jenkins still failed with the exact error.

We notice in the error message that RVM could not pick up the correct Ruby version:

/var/jenkins/workspace/opensearch-ruby-gems-release@tmp/durable-aa0447d1/script.sh: line 3: /usr/share/opensearch/.rvm/scripts/rvm: No such file or director

To reproduce

Build and install the gem with Ruby 2.6

https://github.com/opensearch-project/opensearch-ruby/issues/238#issuecomment-2048228954

Additional context

Check out the discussion on the Ruby client repo.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (13 by maintainers)

Most upvoted comments

Closing it as the issue is resolved now!

And our theory is right. Ruby version needs to be switched before the cert is added. Did not think that would make a difference

docker run -u root -it opensearchstaging/ci-runner:release-centos7-clients-v4 /bin/bash
[root@9d94be570f33 ci-runner]# git clone https://github.com/opensearch-project/opensearch-ruby.git
Cloning into 'opensearch-ruby'...
remote: Enumerating objects: 29553, done.
remote: Counting objects: 100% (932/932), done.
remote: Compressing objects: 100% (364/364), done.
remote: Total 29553 (delta 628), reused 793 (delta 553), pack-reused 28621
Receiving objects: 100% (29553/29553), 6.66 MiB | 5.72 MiB/s, done.
Resolving deltas: 100% (20467/20467), done.
[root@9d94be570f33 ci-runner]# cd opensearch-ruby/
[root@9d94be570f33 opensearch-ruby]# gem cert --add .github/opensearch-rubygems.pem
Added '/CN=opensearch/DC=amazon/DC=com'
[root@9d94be570f33 opensearch-ruby]# source /home/ci-runner/.rvm/scripts/rvm
[root@9d94be570f33 opensearch-ruby]# rvm use 3.1.2
Using /home/ci-runner/.rvm/gems/ruby-3.1.2
[root@9d94be570f33 opensearch-ruby]# ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
[root@9d94be570f33 opensearch-ruby]# curl -J -L -H 'Accept: application/octet-stream' -H 'Authorization: Bearer <token>' https://api.github.com/repos/opensearch-project/opensearch-ruby/releases/assets/162445549 -o artifacts.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  140k  100  140k    0     0   131k      0  0:00:01  0:00:01 --:--:--  131k
[root@9d94be570f33 opensearch-ruby]# tar -xvf artifacts.tar.gz
dist/
dist/opensearch-ruby-3.2.0.gem
[root@9d94be570f33 opensearch-ruby]# cd dist/
[root@9d94be570f33 dist]# gemNameWithVersion=$(ls *.gem)
[root@9d94be570f33 dist]# gem install $gemNameWithVersion
Fetching faraday-2.9.0.gem
Fetching faraday-net_http-3.1.0.gem
Fetching multi_json-1.15.0.gem
Successfully installed multi_json-1.15.0
Successfully installed faraday-net_http-3.1.0
Successfully installed faraday-2.9.0
Successfully installed opensearch-ruby-3.2.0
Parsing documentation for multi_json-1.15.0
Installing ri documentation for multi_json-1.15.0
Parsing documentation for faraday-net_http-3.1.0
Installing ri documentation for faraday-net_http-3.1.0
Parsing documentation for faraday-2.9.0
Installing ri documentation for faraday-2.9.0
Parsing documentation for opensearch-ruby-3.2.0
Installing ri documentation for opensearch-ruby-3.2.0
Done installing documentation for multi_json, faraday-net_http, faraday, opensearch-ruby after 22 seconds
4 gems installed
[root@9d94be570f33 dist]# gemName=$(echo $gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem$)/g')
sed: -e expression #1, char 27: unterminated `s' command
[root@9d94be570f33 dist]# gemName=$(echo $gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem$)//g')
[root@9d94be570f33 dist]# gem uninstall $gemName
Remove executables:
	opensearch_ruby_console

in addition to the gem? [Yn]  Y
Removing opensearch_ruby_console
Successfully uninstalled opensearch-ruby-3.2.0
[root@9d94be570f33 dist]# gem install $gemNameWithVersion -P MediumSecurity
ERROR:  While executing gem ... (Gem::Security::Exception)
    root cert /CN=opensearch/DC=amazon/DC=com is not trusted

Will create a PR to fix this.

The above PR merged and will have the image available in 5 hours or so due to the complexity of this image.

We can try to release next week.

Thanks.

Hi @nhtruong please confirm if ruby version 3.1.2 is good for you. I try to build opensearch-rb main branch with that and it seems fine.

Thanks.

Able to build:


[ci-runner@88850ad06f30 opensearch-ruby]$ gem build opensearch-ruby.gemspec
WARNING:  open-ended dependency on multi_json (>= 1.0) is not recommended
  if multi_json is semantically versioned, use:
    add_runtime_dependency 'multi_json', '~> 1.0'
WARNING:  See https://guides.rubygems.org/specification-reference/ for help
  Successfully built RubyGem
  Name: opensearch-ruby
  Version: 3.2.0
  File: opensearch-ruby-3.2.0.gem