Skip to content

Commit

Permalink
Controller: update Ruby to 3.1
Browse files Browse the repository at this point in the history
This will update the Ruby version on the controller from 2.5.9 to 3.1.

See SUSE/spacewalk#17431

Signed-off-by: Dominik Gedon <dgedon@suse.de>
  • Loading branch information
nodeg committed Jul 20, 2023
1 parent e5ca6d0 commit dc49999
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 11 deletions.
1 change: 1 addition & 0 deletions salt/controller/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export PROVIDER="{{ grains.get('provider') }}"
{% if grains.get('container_runtime') | default(false, true) %}export CONTAINER_RUNTIME="{{ grains.get('container_runtime') }}" {% else %}# no CONTAINER_RUNTIME used {% endif %}
{% if 'build_image' not in grains.get('product_version') | default('', true) %}export IS_USING_BUILD_IMAGE="{{ grains.get('is_using_build_image') }}" {% endif %}
export IS_USING_SCC_REPOSITORIES="{{ grains.get('is_using_scc_repositories') }}"
export GEM_PATH="/usr/lib64/ruby/gems/3.1.0"

#### Generate certificates for Google Chrome
if [ ! -f /etc/pki/trust/anchors/$SERVER.cert ]; then
Expand Down
49 changes: 38 additions & 11 deletions salt/controller/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ cucumber_requisites:
- gcc
- make
- wget
- ruby
- ruby-devel
- libssh-devel
- ruby3.1
- ruby3.1-devel
- autoconf
- ca-certificates-mozilla
- automake
Expand All @@ -45,17 +46,42 @@ cucumber_requisites:
- libxslt-devel
- mozilla-nss-tools
- postgresql-devel
# packaged ruby gems
- ruby2.5-rubygem-bundler
- twopence
- python-twopence
- twopence-devel
- twopence-shell-client
- twopence-test-server
- rubygem-twopence
#- twopence
#- python-twopence
- python-devel
#- twopence-devel
#- twopence-shell-client
#- twopence-test-server
#- rubygem-twopence
- require:
- sls: repos

/usr/bin/gem:
file.symlink:
- target: /usr/bin/gem.ruby3.1
- force: True

ruby_set_rake_version:
cmd.run:
- name: update-alternatives --set rake /usr/bin/rake.ruby.ruby3.1

ruby_set_bundle_version:
cmd.run:
- name: update-alternatives --set bundle /usr/bin/bundle.ruby.ruby3.1

# workaround until twopence is adjusted for Ruby 3.x
twopence_install_from_source:
cmd.run:
- name: |
git clone https://github.com/nodeg/twopence.git /root/twopence
cd /root/twopence
git checkout update-ruby
make
make install
- creates: /root/twopence
- require:
- pkg: cucumber_requisites

install_chromium:
pkg.installed:
- name: chromium
Expand All @@ -72,10 +98,11 @@ create_syslink_for_chromedriver:

install_gems_via_bundle:
cmd.run:
- name: bundle.ruby2.5 install --gemfile Gemfile
- name: bundle.ruby3.1 install --gemfile Gemfile
- cwd: /root/spacewalk/testsuite
- require:
- pkg: cucumber_requisites
- cmd: twopence_install_from_source
- cmd: spacewalk_git_repository

install_npm:
Expand Down
1 change: 1 addition & 0 deletions salt/repos/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ include:
- repos.tools
- repos.jenkins
- repos.server_containerized
- repos.ruby
{% endif %}
- repos.additional

Expand Down
21 changes: 21 additions & 0 deletions salt/repos/ruby.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% if grains['os'] == 'SUSE' and ('controller' in grains.get('roles')) %}

ruby_add_devel_repository:
pkgrepo.managed:
- name: Ruby devel
- baseurl: http://download.opensuse.org/repositories/devel:/languages:/ruby/15.4/
- refresh: True
- gpgautoimport: True

ruby_gems_add_devel_repository:
pkgrepo.managed:
- name: Ruby devel extensions
- baseurl: http://download.opensuse.org/repositories/devel:/languages:/ruby:/extensions/15.4/
- refresh: True
- gpgautoimport: True

{% endif %}

# WORKAROUND: see github:saltstack/salt#10852
{{ sls }}_nop:
test.nop: []

0 comments on commit dc49999

Please sign in to comment.