Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 3d45f598 authored by Philippe Virouleau's avatar Philippe Virouleau
Browse files

Support for ruby 3.1

parent 2e459e91
No related branches found
No related tags found
1 merge request!551Introduce support for ruby 3.1 (14905)
Pipeline #867474 skipped
...@@ -16,8 +16,21 @@ include: ...@@ -16,8 +16,21 @@ include:
# Import g5k default stages # Import g5k default stages
- '/g5k-default-stages.yml' - '/g5k-default-stages.yml'
.template-refrepo:
extends: .template-test
parallel:
matrix:
- DEBIAN_VERSION: [bullseye, bookworm]
image: debian:$DEBIAN_VERSION
before_script:
# This cache is configured in '.base'
- export APT_CACHE_DIR=`pwd`/vendor/apt && mkdir -pv $APT_CACHE_DIR
- apt-get update && apt-get -o dir::cache::archives="$APT_CACHE_DIR" -y --no-install-recommends install build-essential wget git ruby ruby-dev bundler rake gpg clustershell graphviz
# Call the original before_script section
- !reference [.base, before_script]
validate-data: validate-data:
extends: .test-for-bullseye extends: .template-refrepo
stage: validate stage: validate
script: script:
# Add G5K CA certificate # Add G5K CA certificate
...@@ -27,15 +40,17 @@ validate-data: ...@@ -27,15 +40,17 @@ validate-data:
- bundle exec rake valid:duplicates - bundle exec rake valid:duplicates
wikigen: wikigen:
extends: .test-for-bullseye extends: .template-test
stage: validate stage: validate
allow_failure: true allow_failure: true
parallel: parallel:
matrix: matrix:
- GENERATOR: [cpu_parameters, disk_reservation, environments, group_storage, hardware, kwollect_metrics, oar_properties, status] - GENERATOR: [cpu_parameters, disk_reservation, environments, group_storage, hardware, kwollect_metrics, oar_properties, status]
SITE: global SITE: global
DEBIAN_VERSION: [bullseye, bookworm]
- GENERATOR: [site_hardware, site_network] - GENERATOR: [site_hardware, site_network]
SITE: [grenoble, lille, luxembourg, lyon, nancy, nantes, rennes, sophia, toulouse] SITE: [grenoble, lille, luxembourg, lyon, nancy, nantes, rennes, sophia, toulouse]
DEBIAN_VERSION: [bullseye, bookworm]
script: script:
- echo "$GRID5000_API" > "${HOME}/.grid5000_api.yml" - echo "$GRID5000_API" > "${HOME}/.grid5000_api.yml"
- bundle exec rake gen:wiki NAME=${GENERATOR} SITE=${SITE} DO=diff - bundle exec rake gen:wiki NAME=${GENERATOR} SITE=${SITE} DO=diff
...@@ -44,7 +59,7 @@ wikigen: ...@@ -44,7 +59,7 @@ wikigen:
- master - master
generate-reference-api: generate-reference-api:
extends: .test-for-bullseye extends: .template-refrepo
stage: generate stage: generate
script: script:
- export TZ=Europe/Paris - export TZ=Europe/Paris
...@@ -63,14 +78,14 @@ deploy: ...@@ -63,14 +78,14 @@ deploy:
rspec: rspec:
stage: deploy # we use 'deploy' here to avoid blocking on this when updating the ref-repo stage: deploy # we use 'deploy' here to avoid blocking on this when updating the ref-repo
extends: .test-for-bullseye extends: .template-refrepo
script: script:
- export TZ=Europe/Paris - export TZ=Europe/Paris
- bundle exec rspec - bundle exec rspec
valid-homogeneity: valid-homogeneity:
stage: deploy stage: deploy
extends: .test-for-bullseye extends: .template-refrepo
script: script:
- wget --no-check-certificate -q https://www.grid5000.fr/certs/ca2019.grid5000.fr.crt -O /usr/local/share/ca-certificates/ca2019.grid5000.fr.crt - wget --no-check-certificate -q https://www.grid5000.fr/certs/ca2019.grid5000.fr.crt -O /usr/local/share/ca-certificates/ca2019.grid5000.fr.crt
- /usr/sbin/update-ca-certificates - /usr/sbin/update-ca-certificates
......
ruby-2.7.4 ruby-3.1.0
...@@ -16,14 +16,21 @@ def load_yaml_file_hierarchy(directory = File.expand_path("../../input/grid5000/ ...@@ -16,14 +16,21 @@ def load_yaml_file_hierarchy(directory = File.expand_path("../../input/grid5000/
# => List deepest files first as they have lowest priority when hash keys are duplicated. # => List deepest files first as they have lowest priority when hash keys are duplicated.
list_of_yaml_files = Dir['**/*.y*ml', '**/*.y*ml.erb'].sort_by { |x| -x.count('/') } list_of_yaml_files = Dir['**/*.y*ml', '**/*.y*ml.erb'].sort_by { |x| -x.count('/') }
load_args = {}
if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new("3.1.0")
# Fix compatibility with ruby 3.1
load_args[:permitted_classes] = [Date, Time]
load_args[:aliases] = true
end
list_of_yaml_files.each { |filename| list_of_yaml_files.each { |filename|
begin begin
# Load YAML # Load YAML
if /\.y.*ml\.erb$/.match(filename) if /\.y.*ml\.erb$/.match(filename)
# For files with .erb.yaml extensions, process the template before loading the YAML. # For files with .erb.yaml extensions, process the template before loading the YAML.
file_hash = YAML::load(ERB.new(File.read(filename)).result(binding)) file_hash = YAML::load(ERB.new(File.read(filename)).result(binding), **load_args)
else else
file_hash = YAML::load_file(filename) file_hash = YAML::load_file(filename, **load_args)
end end
if not file_hash if not file_hash
raise StandardError.new("loaded hash is empty") raise StandardError.new("loaded hash is empty")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment