From d1e1ca7cf715b3408dacf1f665e7779ab6d266bd Mon Sep 17 00:00:00 2001 From: Manuel Laug Date: Fri, 2 Feb 2024 12:29:04 +0100 Subject: [PATCH] Fix/add missing settings migration (#112) * fix(migration): add missing settings category migration * fix(bundler): pin version to support used ruby version * fix(tests): Update dependent plugins and add fix for failing minitest * feat(tests): Add foreman >= 3.5 versions to test matrix --- .github/workflows/ci.yml | 48 +++++++++++++++---- ...x_wreckingball_settings_category_to_dsl.rb | 11 +++++ 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20240201094513_fix_wreckingball_settings_category_to_dsl.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af2d7a5..75187d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,17 @@ jobs: strategy: fail-fast: false matrix: - foreman-core-branch: [3.1-stable, 3.2-stable, 3.3-stable, 3.4-stable, develop] + foreman-core-branch: + - 3.1-stable + - 3.2-stable + - 3.3-stable + - 3.4-stable + - 3.5-stable + - 3.6-stable + - 3.7-stable + - 3.8-stable + - 3.9-stable + - develop ruby-version: [2.7] node-version: [14] include: @@ -26,14 +36,29 @@ jobs: foreman-puppet-version: 3.0.7 foreman-tasks-version: 6.0.3 - foreman-core-branch: 3.3-stable - foreman-puppet-version: 4.0.3 - foreman-tasks-version: 7.0.0 + foreman-puppet-version: 4.0.4 + foreman-tasks-version: 7.2.1 - foreman-core-branch: 3.4-stable - foreman-puppet-version: 4.0.3 - foreman-tasks-version: 7.0.0 + foreman-puppet-version: 4.1.1 + foreman-tasks-version: 7.2.1 + - foreman-core-branch: 3.5-stable + foreman-puppet-version: 5.1.3 + foreman-tasks-version: 7.2.1 + - foreman-core-branch: 3.6-stable + foreman-puppet-version: 5.1.3 + foreman-tasks-version: 7.2.1 + - foreman-core-branch: 3.7-stable + foreman-puppet-version: 6.2.0 + foreman-tasks-version: 8.3.3 + - foreman-core-branch: 3.8-stable + foreman-puppet-version: 6.2.0 + foreman-tasks-version: 8.3.3 + - foreman-core-branch: 3.9-stable + foreman-puppet-version: 6.2.0 + foreman-tasks-version: 9.0.2 - foreman-core-branch: develop - foreman-puppet-version: 4.0.3 - foreman-tasks-version: 7.0.0 + foreman-puppet-version: 6.2.0 + foreman-tasks-version: 9.0.2 steps: - name: Install dependencies run: | @@ -60,6 +85,11 @@ jobs: git cherry-pick -n a439e1e92e9f98f3dbc8ed2f204bd53cc861565e # pin rack-test to < 2.0 (see https://github.com/theforeman/foreman/pull/9288) git cherry-pick -n c3c697fa131aa54c11918bcc563a7789f3c08ef7 # drop rack-test and bump show_me_the_cookies to ~ 6.0 (see https://github.com/theforeman/foreman/pull/9353) working-directory: foreman + - name: Apply patches for Foreman >= 3.2 and <= 3.7 + if: ${{ contains(fromJson('["3.2-stable", "3.3-stable", "3.4-stable", "3.5-stable", "3.6-stable", "3.7-stable"]'), matrix.foreman-core-branch) }} + run: | + git cherry-pick -n 1c3a4155f286352e0abbf0d0b298e47e81c2d6c5 # Pin minitest < 5.19 to resolve test failures (see https://github.com/theforeman/foreman/pull/9781) + working-directory: foreman - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -68,7 +98,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} + node-version: ${{ matrix.node-version }} - name: Add foreman_puppet working-directory: foreman run: echo "gem 'foreman_puppet', '~> ${{ matrix.foreman-puppet-version }}'" > bundler.d/foreman_puppet.local.rb @@ -79,7 +109,7 @@ jobs: working-directory: foreman run: | echo "gem 'foreman_wreckingball', path: '../foreman_wreckingball'" > bundler.d/foreman_wreckingball.local.rb - gem install bundler + gem install bundler -v 2.4.22 bundle config path vendor/bundle bundle config set without journald development console mysql2 sqlite bundle lock --update diff --git a/db/migrate/20240201094513_fix_wreckingball_settings_category_to_dsl.rb b/db/migrate/20240201094513_fix_wreckingball_settings_category_to_dsl.rb new file mode 100644 index 0000000..91188e5 --- /dev/null +++ b/db/migrate/20240201094513_fix_wreckingball_settings_category_to_dsl.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class FixWreckingballSettingsCategoryToDsl < ActiveRecord::Migration[6.0] + class MigrationSettings < ActiveRecord::Base + self.table_name = :settings + end + + def up + MigrationSettings.where(category: 'Setting::Wreckingball').update_all(category: 'Setting') if column_exists?(:settings, :category) + end +end