Skip to content

Commit

Permalink
Controller: update Ruby to 3.3 for HEAD/Uyuni/Uyuni Podman/5.x (#1248)
Browse files Browse the repository at this point in the history
* Controller: update Ruby to 3.3

This will
- update the Ruby version on the controller to 3.3
- build Twopence from source since there is no way we can build it in OBS with Ruby 3 on openSUSE Leap 15.5/15.6
- add the `product_version` variable to the controller grain, that we will use, to still be able to use Ruby 2.5 on 4.3
- fix the CI tests by including the checked `product_version` as a variable
- update the `cucumber-html-reporter` version

See SUSE/spacewalk#17431

Signed-off-by: Dominik Gedon <dominik.gedon@suse.com>

* Remove Twopence
* Use Ruby 3.1 due to new `net-ssh` dependency
* Revert "Use Ruby 3.1 due to new `net-ssh` dependency"
This reverts commit d6558ea.
  • Loading branch information
nodeg authored Sep 12, 2024
1 parent 489b2a7 commit 5501010
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-validation/salt-client-validation
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ osrelease_info: [15, 5]
# Set grain values in such a way that covers as many conditions as possible
hostname: sumaform-test-client
product_version: head
install_salt_bundle: true
gpg_keys: ['testkey.pub']
domain: tf.local
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-validation/salt-controller-validation
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ osrelease_info: [15, 5]
# Set grain values in such a way that covers as many conditions as possible
hostname: sumaform-test-ctl
product_version: head
install_salt_bundle: true
gpg_keys: ['testkey.pub']
domain: tf.local
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-validation/salt-minion-validation
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ osrelease_info: [15, 5]
# Set grain values in such a way that covers as many conditions as possible
hostname: sumaform-test-minion
product_version: head
install_salt_bundle: true
gpg_keys: ['testkey.pub']
domain: tf.local
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-validation/salt-mirror-validation
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ osrelease_info: [15, 5]
# Set grain values in such a way that covers as many conditions as possible
hostname: sumaform-test-mirror
product_version: head
install_salt_bundle: true
gpg_keys: ['testkey.pub']
domain: tf.local
Expand Down
1 change: 1 addition & 0 deletions modules/controller/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module "controller" {
git_repo = var.git_repo
branch = var.branch == "default" ? var.testsuite-branch[var.server_configuration["product_version"]] : var.branch
mirror = var.no_mirror == true ? null : var.base_configuration["mirror"]
product_version = var.product_version

server = var.server_configuration["hostname"]
proxy = var.proxy_configuration["hostname"]
Expand Down
5 changes: 5 additions & 0 deletions modules/controller/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -755,3 +755,8 @@ variable "server_instance_id" {
description = "Server instance ID"
default = null
}

variable "product_version" {
description = "A valid SUSE Manager version (eg. 4.3-nightly, head) see README_ADVANCED.md"
default = "released"
}
1 change: 1 addition & 0 deletions modules/cucumber_testsuite/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ module "controller" {
server_http_proxy = var.server_http_proxy
custom_download_endpoint = var.custom_download_endpoint
swap_file_size = null
product_version = var.product_version

additional_repos = lookup(local.additional_repos, "controller", {})
additional_repos_only = lookup(local.additional_repos_only, "controller", false)
Expand Down
6 changes: 6 additions & 0 deletions salt/controller/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ export CATCH_TIMEOUT_MESSAGE="{{ grains.get('catch_timeout_message') }}"
export SERVER_INSTANCE_ID="{{ grains.get('server_instance_id') }}"
export BETA_ENABLED="{{ grains.get('beta_enabled') }}"

# Ruby specific settings
# For 4.3 we currently still use Ruby 2.5
{% if '4.3' not in grains.get('product_version') %}
export GEM_PATH="/usr/lib64/ruby/gems/3.3.0"
{% endif %}

#### Generate certificates for Google Chrome
if [ ! -f /etc/pki/trust/anchors/$SERVER.cert ]; then
wget http://$SERVER/pub/RHN-ORG-TRUSTED-SSL-CERT -O /etc/pki/trust/anchors/$SERVER.cert
Expand Down
78 changes: 74 additions & 4 deletions salt/controller/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ authorized_keys_controller:
- source: salt://controller/id_rsa.pub
- makedirs: True

{% if '4.3' in grains.get('product_version') %}
cucumber_requisites:
pkg.installed:
- pkgs:
Expand Down Expand Up @@ -56,6 +57,65 @@ cucumber_requisites:
- rubygem-twopence
- require:
- sls: repos
{% else %}

cucumber_requisites:
pkg.installed:
- pkgs:
- gcc
- make
- wget
- libssh-devel
- python-devel
- ruby3.3
- ruby3.3-devel
- autoconf
- ca-certificates-mozilla
- automake
- libtool
- apache2-worker
- cantarell-fonts
- git-core
- aaa_base-extras
- zlib-devel
- libxslt-devel
- mozilla-nss-tools
- postgresql-devel
- unzip
- require:
- sls: repos

/usr/bin/ruby:
file.symlink:
- target: /usr/bin/ruby.ruby3.3
- force: True

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

/usr/bin/irb:
file.symlink:
- target: /usr/bin/irb.ruby3.3
- force: True

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

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

ruby_set_rdoc_version:
cmd.run:
- name: update-alternatives --set rdoc /usr/bin/rdoc.ruby.ruby3.3

ruby_set_ri_version:
cmd.run:
- name: update-alternatives --set ri /usr/bin/ri.ruby.ruby3.3
{% endif %}

install_chromium:
pkg.installed:
Expand All @@ -75,17 +135,27 @@ create_syslink_for_chromedriver:
- target: ../lib64/chromium/chromedriver
- force: True

install_npm:
pkg.installed:
- name: npm-default

{% if '4.3' in grains.get('product_version') %}
install_gems_via_bundle:
cmd.run:
- name: bundle.ruby2.5 install --gemfile Gemfile
- cwd: /root/spacewalk/testsuite
- require:
- pkg: cucumber_requisites
- cmd: spacewalk_git_repository

install_npm:
pkg.installed:
- name: npm-default
{% else %}
install_gems_via_bundle:
cmd.run:
- name: bundle.ruby3.3 install --gemfile Gemfile
- cwd: /root/spacewalk/testsuite
- require:
- pkg: cucumber_requisites
- cmd: spacewalk_git_repository
{% endif %}

# https://github.com/gkushang/cucumber-html-reporter
install_cucumber_html_reporter_via_npm:
Expand Down
3 changes: 3 additions & 0 deletions salt/repos/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ include:
- repos.testsuite
- repos.tools
- repos.jenkins
{% if '4.3' not in grains.get('product_version') %}
- repos.ruby
{% endif %}
{% 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.5/
- 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.5/
- refresh: True
- gpgautoimport: True

{% endif %}

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

0 comments on commit 5501010

Please sign in to comment.