From 0d81cbb0ec0d6250500c077a221a9e75431493f6 Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Sun, 21 Apr 2024 08:30:31 -0400 Subject: [PATCH] Convert jobs to rbenv --- .../pipelines/deploy/website.groovy | 11 ++--- theforeman.org/pipelines/lib/foreman.groovy | 32 +++++-------- .../pipelines/lib/nightly_packaging.groovy | 19 +++----- theforeman.org/pipelines/lib/rbenv.groovy | 8 ++-- theforeman.org/pipelines/lib/rvm.groovy | 48 ------------------- .../release/source/foreman-installer.groovy | 14 ++---- .../pipelines/release/source/foreman.groovy | 40 +++++++--------- .../release/source/hammer-cli-x.groovy | 11 ++--- .../pipelines/release/source/katello.groovy | 27 ++++------- .../release/source/smart-proxy.groovy | 11 ++--- .../pipelines/release/tarballsRelease.groovy | 13 ++--- .../pipelines/test/smart-proxy.groovy | 23 +++------ .../vars/katello-master-release.groovy | 2 +- .../yaml/builders/smart-proxy-plugin.yaml | 13 ++--- theforeman.org/yaml/jobs/deploy_web.yaml | 1 - .../pipeline/candlepin-release-pipelines.yaml | 1 - .../foreman-nightly-deb-pipeline.yaml | 1 - .../foreman-nightly-rpm-pipeline.yaml | 1 - .../pipeline/foreman-release-pipelines.yaml | 3 -- .../pipeline/foreman-stable-pipelines.yaml | 1 - .../pipeline/pulpcore-release-pipelines.yaml | 1 - .../foreman-develop-package-release.yaml | 1 - ...man-installer-develop-package-release.yaml | 1 - ...reman-selinux-develop-package-release.yaml | 1 - ...er-cli-foreman-master-package-release.yaml | 1 - ...er-cli-katello-master-package-release.yaml | 1 - .../hammer-cli-master-package-release.yaml | 1 - .../katello-master-package-release.yaml | 1 - .../smart-proxy-develop-source-release.yaml | 1 - .../foreman-develop-source-release.yaml | 1 - .../foreman-installer-source-release.yaml | 1 - .../foreman-selinux-source-release.yaml | 1 - ...mer-cli-foreman-master-source-release.yaml | 1 - ...mer-cli-katello-master-source-release.yaml | 1 - .../hammer-cli-master-source-release.yaml | 1 - .../source/katello-master-source-release.yaml | 1 - .../smart-proxy-develop-source-release.yaml | 1 - .../yaml/jobs/release/tarballs-release.yaml | 1 - .../jobs/smart-proxy-plugin-pull-request.yaml | 2 +- .../yaml/jobs/smart-proxy-plugin.yaml | 2 +- .../jobs/tests/foreman-installer-pr-test.yaml | 1 - .../tests/smart-proxy-plugin-pr-test.yaml | 1 - .../yaml/jobs/tests/smart-proxy-pr-test.yaml | 1 - 43 files changed, 81 insertions(+), 224 deletions(-) delete mode 100644 theforeman.org/pipelines/lib/rvm.groovy diff --git a/theforeman.org/pipelines/deploy/website.groovy b/theforeman.org/pipelines/deploy/website.groovy index 6311a456..b3791833 100644 --- a/theforeman.org/pipelines/deploy/website.groovy +++ b/theforeman.org/pipelines/deploy/website.groovy @@ -9,7 +9,7 @@ pipeline { } environment { - ruby_version = '2.7' + ruby = '2.7.6' // Sync to the pivot-point on the web node target_path = 'website@web01.osuosl.theforeman.org:rsync_cache/' rsync_log = 'deploy-website.log' @@ -21,13 +21,8 @@ pipeline { git url: 'https://github.com/theforeman/theforeman.org', branch: 'gh-pages' script { - try { - configureRVM(ruby_version) - withRVM(['bundle install --jobs=5 --retry=5'], ruby_version) - withRVM(['bundle exec jekyll build'], ruby_version) - } finally { - cleanupRVM(ruby_version) - } + bundleInstall(ruby) + bundleExec(ruby, "jekyll build") } sshagent(['deploy-website']) { diff --git a/theforeman.org/pipelines/lib/foreman.groovy b/theforeman.org/pipelines/lib/foreman.groovy index 56c597f1..7f52a03d 100644 --- a/theforeman.org/pipelines/lib/foreman.groovy +++ b/theforeman.org/pipelines/lib/foreman.groovy @@ -14,27 +14,19 @@ def addSettings(settings) { sh "cp config/settings.yaml.example config/settings.yaml" } -def configureDatabase(ruby, name = '') { - withRVM(['bundle install --without=development --jobs=5 --retry=5'], ruby, name) +def configureDatabase(ruby) { + bundleInstall(ruby, '--without=development') archiveArtifacts(artifacts: 'Gemfile.lock') - withRVM(['bundle exec rake db:drop >/dev/null 2>/dev/null || true'], ruby, name) - withRVM(['bundle exec rake db:create --trace'], ruby, name) - withRVM(['RAILS_ENV=production bundle exec rake db:create --trace'], ruby, name) - withRVM(['bundle exec rake db:migrate --trace'], ruby, name) + bundleExec(ruby, 'rake db:drop >/dev/null 2>/dev/null || true') + bundleExec(ruby, 'rake db:create --trace') + bundleExec(ruby, 'rake db:create --trace RAILS_ENV=production') + bundleExec(ruby, 'rake db:migrate --trace') } -def cleanup(ruby, name = '') { - try { - - withRVM(['bundle exec rake db:drop RAILS_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=true >/dev/null 2>/dev/null || true'], ruby, name) - withRVM(['bundle exec rake db:drop RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=true >/dev/null 2>/dev/null || true'], ruby, name) - withRVM(['bundle exec rake db:drop RAILS_ENV=development DISABLE_DATABASE_ENVIRONMENT_CHECK=true >/dev/null 2>/dev/null || true'], ruby, name) - - } finally { - - cleanupRVM(ruby, name) - - } +def cleanup(ruby) { + bundleExec(ruby, 'rake db:drop RAILS_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=true >/dev/null 2>/dev/null || true') + bundleExec(ruby, 'rake db:drop RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=true >/dev/null 2>/dev/null || true') + bundleExec(ruby, 'rake db:drop RAILS_ENV=development DISABLE_DATABASE_ENVIRONMENT_CHECK=true >/dev/null 2>/dev/null || true') } def postgresqlTemplate(id) { @@ -68,7 +60,7 @@ production: """ } -def filter_package_json(ruby, gemset = '') { +def filter_package_json(ruby) { if (env.NODE_LABELS.contains('el8')) { python = 'python3.11' } else { @@ -77,7 +69,7 @@ def filter_package_json(ruby, gemset = '') { sh "${python} script/filter-package-json.py" - withRVM(["bundle exec ruby script/plugin_webpack_directories.rb > plugin_webpack.json"], ruby, gemset) + bundleExec(ruby, "ruby script/plugin_webpack_directories.rb > plugin_webpack.json") def plugin_webpack = readJSON file: 'plugin_webpack.json' plugin_webpack['plugins'].each { plugin, config -> sh "${python} script/filter-package-json.py --package-json ${config['root']}/package.json" diff --git a/theforeman.org/pipelines/lib/nightly_packaging.groovy b/theforeman.org/pipelines/lib/nightly_packaging.groovy index 40f4169b..87f7b962 100644 --- a/theforeman.org/pipelines/lib/nightly_packaging.groovy +++ b/theforeman.org/pipelines/lib/nightly_packaging.groovy @@ -1,28 +1,23 @@ def generate_sourcefiles(args) { def sourcefile_paths = [] def project_name = args.project_name - def ruby_version = args.ruby_version ?: '2.7' + def ruby_version = args.ruby_version ?: '2.7.6' def source_type = args.source_type dir(project_name) { echo source_type if (source_type == 'gem') { - withRVM(["gem build *.gemspec"], ruby_version) + withRuby(ruby_version, "gem build *.gemspec") sourcefiles = list_files('./').findAll { "${it}".endsWith('.gem') } archiveArtifacts(artifacts: sourcefiles.join(',')) sourcefile_paths = sourcefiles.collect { "${pwd()}/${it}" } } else { - try { - configureRVM(ruby_version) - withRVM(["bundle install --jobs 5 --retry 5"], ruby_version) - withRVM(["bundle exec rake pkg:generate_source"], ruby_version) - archiveArtifacts(artifacts: 'pkg/*') - sourcefile_paths = list_files('pkg/').collect { - "${pwd()}/pkg/${it}" - } - } finally { - cleanupRVM(ruby_version) + bundleInstall(ruby_version) + bundleExec(ruby_version, "rake pkg:generate_source") + archiveArtifacts(artifacts: 'pkg/*') + sourcefile_paths = list_files('pkg/').collect { + "${pwd()}/pkg/${it}" } } } diff --git a/theforeman.org/pipelines/lib/rbenv.groovy b/theforeman.org/pipelines/lib/rbenv.groovy index b6ffc7f4..986fe027 100644 --- a/theforeman.org/pipelines/lib/rbenv.groovy +++ b/theforeman.org/pipelines/lib/rbenv.groovy @@ -1,8 +1,8 @@ -def bundleInstall(version, gemfile=null) { - command = "bundle install" +def bundleInstall(version, options=null) { + command = "bundle install --jobs 5 --retry 5" - if (gemfile) { - command = "${command} --gemfile=${gemfile}" + if (options) { + command = "${command} ${options}" } withRuby(version, "bundle config set path ~/.rubygems") diff --git a/theforeman.org/pipelines/lib/rvm.groovy b/theforeman.org/pipelines/lib/rvm.groovy deleted file mode 100644 index 6df27d45..00000000 --- a/theforeman.org/pipelines/lib/rvm.groovy +++ /dev/null @@ -1,48 +0,0 @@ -def gemset(name = null) { - - def base_name = "${JOB_NAME}-${BUILD_NUMBER}" - - if (EXECUTOR_NUMBER != '0') { - base_name += '-' + EXECUTOR_NUMBER - } - - if (name) { - base_name += '-' + name.replace(".", "-") - } - - base_name -} - -def configureRVM(ruby, name = '', bundler_version = null) { - emptyGemset(ruby, name) - - if (ruby == '2.7') { - bundler_version = '2.4.22' - } - - if (bundler_version) { - withRVM(["gem install bundler -v '${bundler_version}' --no-document"], ruby, name) - } else { - withRVM(["gem install bundler --no-document"], ruby, name) - } -} - -def emptyGemset(ruby, name = '') { - withRVM(["rvm gemset empty ${gemset(name)} --force"], ruby, name) -} - -def cleanupRVM(ruby, name = '') { - withRVM(["rvm gemset delete ${gemset(name)} --force"], ruby, name) -} - -def withRVM(commands, ruby, name = '') { - - commands = commands.join("\n") - echo commands.toString() - - sh(script: """#!/bin/bash -l - set -e - rvm use ruby-${ruby}@${gemset(name)} --create - ${commands} - """, label: "${commands}") -} diff --git a/theforeman.org/pipelines/release/source/foreman-installer.groovy b/theforeman.org/pipelines/release/source/foreman-installer.groovy index 18113ea1..97cbd3bc 100644 --- a/theforeman.org/pipelines/release/source/foreman-installer.groovy +++ b/theforeman.org/pipelines/release/source/foreman-installer.groovy @@ -19,7 +19,7 @@ pipeline { } stage("test ruby 2.7 & puppet 7") { steps { - run_test(ruby: '2.7', puppet: '7') + run_test(ruby: '2.7.6', puppet: '7') } } stage('Build and Archive Source') { @@ -55,14 +55,8 @@ pipeline { def run_test(args) { def ruby = args.ruby def puppet = args.puppet - def gemset = "ruby-${ruby}-puppet-${puppet}" - try { - configureRVM(ruby, gemset) - withRVM(["PUPPET_VERSION='${puppet}' bundle install --without=development --jobs=5 --retry=5"], ruby, gemset) - archiveArtifacts(artifacts: 'Gemfile.lock') - withRVM(["PUPPET_VERSION='${puppet}' bundle exec rake spec"], ruby, gemset) - } finally { - cleanupRVM(ruby, gemset) - } + withRuby(ruby, "PUPPET_VERSION='${puppet}' bundle install --without=development --jobs=5 --retry=5") + archiveArtifacts(artifacts: 'Gemfile.lock') + withRuby(ruby, "PUPPET_VERSION='${puppet}' bundle exec rake spec") } diff --git a/theforeman.org/pipelines/release/source/foreman.groovy b/theforeman.org/pipelines/release/source/foreman.groovy index a5d3dbf3..a24ead68 100644 --- a/theforeman.org/pipelines/release/source/foreman.groovy +++ b/theforeman.org/pipelines/release/source/foreman.groovy @@ -14,8 +14,7 @@ pipeline { stage('ruby-2.7-postgres') { agent { label 'fast' } environment { - RUBY_VER = '2.7' - GEMSET = 'ruby2.7' + RUBY_VER = '2.7.6' } stages { stage("setup-2.7-postgres") { @@ -24,14 +23,13 @@ pipeline { script { archive_git_hash() } - configureRVM(env.RUBY_VER, env.GEMSET) - databaseFile(gemset(env.GEMSET)) - configureDatabase(env.RUBY_VER, env.GEMSET) + databaseFile("${env.JOB_NAME}-${env.BUILD_ID}") + configureDatabase(env.RUBY_VER) } } stage("unit-tests-2.7-postgres") { steps { - withRVM(['bundle exec rake jenkins:unit TESTOPTS="-v" --trace'], env.RUBY_VER, env.GEMSET) + bundleExec(env.RUBY_VER, 'rake jenkins:unit TESTOPTS="-v" --trace') } } } @@ -40,7 +38,7 @@ pipeline { junit(testResults: 'jenkins/reports/unit/*.xml') } cleanup { - cleanup(env.RUBY_VER, env.GEMSET) + cleanup(env.RUBY_VER) deleteDir() } } @@ -48,23 +46,21 @@ pipeline { stage('ruby-2.7-postgres-integrations') { agent { label 'fast' } environment { - RUBY_VER = '2.7' - GEMSET = 'ruby2.7-ui' + RUBY_VER = '2.7.6' } stages { stage("setup-2.7-postgres-ui") { steps { git url: git_url, branch: git_ref - configureRVM(env.RUBY_VER, env.GEMSET) - databaseFile(gemset(env.GEMSET)) - configureDatabase(env.RUBY_VER, env.GEMSET) - withRVM(['npm install --no-audit'], env.RUBY_VER, env.GEMSET) + databaseFile("${env.JOB_NAME}-${env.BUILD_ID}-ui") + configureDatabase(env.RUBY_VER) + withRuby(env.RUBY_VER, 'npm install --no-audit') archiveArtifacts(artifacts: 'package-lock.json') } } stage("integration-tests-2.7-postgres-ui") { steps { - withRVM(['bundle exec rake jenkins:integration TESTOPTS="-v" --trace'], env.RUBY_VER, env.GEMSET) + bundleExec(env.RUBY_VER, 'rake jenkins:integration TESTOPTS="-v" --trace') } } } @@ -73,7 +69,7 @@ pipeline { junit(testResults: 'jenkins/reports/unit/*.xml') } cleanup { - cleanup(env.RUBY_VER, env.GEMSET) + cleanup(env.RUBY_VER) deleteDir() } } @@ -81,29 +77,27 @@ pipeline { stage('ruby-2.7-nulldb-assets') { agent { label 'fast' } environment { - RUBY_VER = '2.7' - GEMSET = 'ruby2.7-assets' + RUBY_VER = '2.7.6' } stages { stage("setup-2.7-nulldb") { steps { git url: git_url, branch: git_ref - configureRVM(env.RUBY_VER, env.GEMSET) - withRVM(['bundle install --without=development --jobs=5 --retry=5'], env.RUBY_VER, env.GEMSET) + bundleInstall(env.RUBY_VER, '--without=development') sh "cp db/schema.rb.nulldb db/schema.rb" - filter_package_json(env.RUBY_VER, env.GEMSET) - withRVM(['npm install --no-audit'], env.RUBY_VER, env.GEMSET) + filter_package_json(env.RUBY_VER) + withRuby(env.RUBY_VER, 'npm install --no-audit') } } stage("assets-precompile-2.7-nulldb") { steps { - withRVM(['bundle exec rake assets:precompile RAILS_ENV=production DATABASE_URL=nulldb://nohost'], env.RUBY_VER, env.GEMSET) + bundleExec(env.RUBY_VER, 'rake assets:precompile RAILS_ENV=production DATABASE_URL=nulldb://nohost') } } } post { cleanup { - cleanup(env.RUBY_VER, env.GEMSET) + cleanup(env.RUBY_VER) deleteDir() } } diff --git a/theforeman.org/pipelines/release/source/hammer-cli-x.groovy b/theforeman.org/pipelines/release/source/hammer-cli-x.groovy index 05f32379..b124d652 100644 --- a/theforeman.org/pipelines/release/source/hammer-cli-x.groovy +++ b/theforeman.org/pipelines/release/source/hammer-cli-x.groovy @@ -20,7 +20,7 @@ pipeline { } stage("test-ruby-2.7") { steps { - run_test(ruby: '2.7') + run_test(ruby: '2.7.6') } } stage('Build and Archive Source') { @@ -63,16 +63,13 @@ def add_hammer_cli_git_repos(repos = []) { def run_test(args) { def ruby = args.ruby - def gemset = "ruby-${ruby}" try { - configureRVM(ruby, gemset) - withRVM(['bundle install --without=development --jobs=5 --retry=5'], ruby, gemset) + bundleInstall(ruby, '--without=development') archiveArtifacts(artifacts: 'Gemfile.lock') - withRVM(['bundle show'], ruby, gemset) - withRVM(['bundle exec rake ci:setup:minitest test TESTOPTS="-v"'], ruby, gemset) + withRuby(ruby, 'bundle show') + bundleExec(ruby, 'rake ci:setup:minitest test TESTOPTS="-v"') } finally { - cleanupRVM(ruby, gemset) junit(testResults: 'test/reports/*.xml') } } diff --git a/theforeman.org/pipelines/release/source/katello.groovy b/theforeman.org/pipelines/release/source/katello.groovy index 104829a1..daeb0d15 100644 --- a/theforeman.org/pipelines/release/source/katello.groovy +++ b/theforeman.org/pipelines/release/source/katello.groovy @@ -22,19 +22,12 @@ pipeline { } } } - stage("Setup RVM") { - steps { - - configureRVM(ruby) - - } - } stage('Configure Environment') { steps { dir('foreman') { addGem() - databaseFile(gemset()) + databaseFile("${env.JOB_NAME}-${env.BUILD_ID}") } } @@ -51,8 +44,8 @@ pipeline { stage('Install Foreman npm packages') { steps { dir('foreman') { - withRVM(["bundle exec npm install --package-lock-only --no-audit"], ruby) - withRVM(["bundle exec npm ci --no-audit"], ruby) + bundleExec(ruby, "npm install --package-lock-only --no-audit") + bundleExec(ruby, "npm ci --no-audit") } } } @@ -61,14 +54,14 @@ pipeline { stage('tests') { steps { dir('foreman') { - withRVM(['bundle exec rake jenkins:katello TESTOPTS="-v" --trace'], ruby) + bundleExec(ruby, 'rake jenkins:katello TESTOPTS="-v" --trace') } } } stage('rubocop') { steps { dir('foreman') { - withRVM(['bundle exec rake katello:rubocop TESTOPTS="-v" --trace'], ruby) + bundleExec(ruby, 'rake katello:rubocop TESTOPTS="-v" --trace') } } } @@ -102,7 +95,7 @@ pipeline { stage('assets-precompile') { steps { dir('foreman') { - withRVM(["bundle exec rake plugin:assets:precompile[${project_name}] RAILS_ENV=production --trace"], ruby) + bundleExec(ruby, "rake plugin:assets:precompile[${project_name}] RAILS_ENV=production --trace") } } } @@ -121,10 +114,10 @@ pipeline { dir('foreman') { - withRVM(['bundle exec rake db:drop RAILS_ENV=test >/dev/null 2>/dev/null || true'], ruby) - withRVM(['bundle exec rake db:create RAILS_ENV=test'], ruby) - withRVM(['bundle exec rake db:migrate RAILS_ENV=test'], ruby) - withRVM(['bundle exec rake db:seed RAILS_ENV=test'], ruby) + bundleExec(ruby, 'rake db:drop RAILS_ENV=test >/dev/null 2>/dev/null || true') + bundleExec(ruby, 'rake db:create RAILS_ENV=test') + bundleExec(ruby, 'rake db:migrate RAILS_ENV=test') + bundleExec(ruby, 'rake db:seed RAILS_ENV=test') } diff --git a/theforeman.org/pipelines/release/source/smart-proxy.groovy b/theforeman.org/pipelines/release/source/smart-proxy.groovy index 27df82bc..5746a11f 100644 --- a/theforeman.org/pipelines/release/source/smart-proxy.groovy +++ b/theforeman.org/pipelines/release/source/smart-proxy.groovy @@ -15,7 +15,7 @@ pipeline { axes { axis { name 'ruby' - values '2.7', '3.0', '3.1' + values '2.7.6', '3.0.4', '3.1.0' } } stages { @@ -77,16 +77,13 @@ pipeline { def run_test(args) { def ruby = args.ruby - def gemset = "ruby-${ruby}" try { - configureRVM(ruby, gemset) - withRVM(["cp config/settings.yml.example config/settings.yml"], ruby, gemset) - withRVM(["bundle install --without=development --jobs=5 --retry=5"], ruby, gemset) + sh "cp config/settings.yml.example config/settings.yml" + bundleInstall(ruby, "--without=development") archiveArtifacts(artifacts: 'Gemfile.lock') - withRVM(["bundle exec rake jenkins:unit --trace"], ruby, gemset) + bundleExec(ruby, "rake jenkins:unit --trace") } finally { - cleanupRVM(ruby, gemset) junit(testResults: 'jenkins/reports/unit/*.xml') } } diff --git a/theforeman.org/pipelines/release/tarballsRelease.groovy b/theforeman.org/pipelines/release/tarballsRelease.groovy index c141b55e..35732385 100644 --- a/theforeman.org/pipelines/release/tarballsRelease.groovy +++ b/theforeman.org/pipelines/release/tarballsRelease.groovy @@ -11,7 +11,7 @@ pipeline { environment { version = env.getProperty('version') major_version = env.getProperty('major_version') - ruby_ver = '2.7' + ruby_ver = '2.7.6' } stages { @@ -71,8 +71,6 @@ void build_tarball(project, version, ruby_ver) { changelog: false, poll: false - configureRVM(ruby_ver, project) - if (project == 'foreman') { sh "cat config/settings.yaml.example > config/settings.yaml" sh "cat config/database.yml.example > config/database.yml" @@ -81,20 +79,17 @@ void build_tarball(project, version, ruby_ver) { env.setProperty('DEBUG_RESOLVER', '1') if (fileExists("Gemfile")) { - withRVM(["bundle install --without=development --jobs=5 --retry=5"], ruby_ver, project) - rake = "bundle exec rake" + bundleInstall(ruby_ver, "--without=development") } if (project == 'foreman-installer') { - withRVM(["${rake} clean"], ruby_ver, project) + bundleExec(ruby_ver, "rake clean") } - withRVM(["${rake} pkg:generate_source"], ruby_ver, project) + bundleExec(ruby_ver, "rake pkg:generate_source") sshagent(['deploy-downloads']) { sh "rsync -v --ignore-existing pkg/* downloads@web01.osuosl.theforeman.org:${base_dir}/" } - - cleanupRVM(ruby_ver, project) } } diff --git a/theforeman.org/pipelines/test/smart-proxy.groovy b/theforeman.org/pipelines/test/smart-proxy.groovy index 77296c5a..6ffc1133 100644 --- a/theforeman.org/pipelines/test/smart-proxy.groovy +++ b/theforeman.org/pipelines/test/smart-proxy.groovy @@ -22,6 +22,7 @@ pipeline { agent any environment { BUNDLE_WITHOUT = 'bmc:development:dhcp_isc_inotify:dhcp_isc_kqueue:journald:krb5:libvirt:puppetca_token_whitelisting:realm_freeipa:windows' + RUBY_VERSION = '2.7.6' } stages { @@ -32,19 +33,14 @@ pipeline { } } } - stage('Setup RVM') { - steps { - configureRVM('2.7') - } - } stage('Install dependencies') { steps { - withRVM(['bundle install'], '2.7') + bundleInstall(RUBY_VERSION) } } stage('Run Rubocop') { steps { - withRVM(['bundle exec rubocop --format progress --out rubocop.log --format progress'], '2.7') + bundleExec(RUBY_VERSION, 'rubocop --format progress --out rubocop.log --format progress') } post { always { @@ -55,7 +51,6 @@ pipeline { } post { always { - cleanupRVM('2.7') deleteDir() } } @@ -67,7 +62,7 @@ pipeline { axes { axis { name 'ruby' - values '2.7', '3.0', '3.1' + values '2.7.6', '3.0.4', '3.1.0' } } environment { @@ -81,14 +76,9 @@ pipeline { } } } - stage('Setup RVM') { - steps { - configureRVM(ruby) - } - } stage('Install dependencies') { steps { - withRVM(['bundle install'], ruby) + bundleInstall(ruby) } } stage('Run Tests') { @@ -100,7 +90,7 @@ pipeline { MINITEST_REPORTERS_REPORTS_DIR = 'jenkins/reports/unit' } steps { - withRVM(['bundle exec rake jenkins:unit'], ruby) + bundleExec(ruby, 'rake jenkins:unit') } post { always { @@ -112,7 +102,6 @@ pipeline { post { always { archiveArtifacts artifacts: 'Gemfile.lock' - cleanupRVM(ruby) deleteDir() } } diff --git a/theforeman.org/pipelines/vars/katello-master-release.groovy b/theforeman.org/pipelines/vars/katello-master-release.groovy index bde17923..dbb5096c 100644 --- a/theforeman.org/pipelines/vars/katello-master-release.groovy +++ b/theforeman.org/pipelines/vars/katello-master-release.groovy @@ -5,4 +5,4 @@ def project_name = 'katello' def build_rpm = true def build_deb = false def source_type = 'gem' -def ruby = '2.7' +def ruby = '2.7.6' diff --git a/theforeman.org/yaml/builders/smart-proxy-plugin.yaml b/theforeman.org/yaml/builders/smart-proxy-plugin.yaml index 0a0abb53..0efaeb18 100644 --- a/theforeman.org/yaml/builders/smart-proxy-plugin.yaml +++ b/theforeman.org/yaml/builders/smart-proxy-plugin.yaml @@ -4,16 +4,10 @@ - shell: |+ #!/bin/bash -ex - set +x - # RVM Ruby environment - . /etc/profile.d/rvm.sh - # Use a gemset unique to each executor to enable parallel builds - gemset=$(echo ${JOB_NAME} | cut -d/ -f1)-${EXECUTOR_NUMBER} - rvm use ruby-${ruby}@${gemset} --create - rvm gemset empty --force - set -x + export PATH="$HOME/.rbenv/shims:$PATH" + export RBENV_VERSION=${ruby} - if [ "${ruby}" = '2.7' ] + if [ "${ruby}" = '2.7.6' ] then gem install bundler -v 2.4.22 --no-document else @@ -22,4 +16,3 @@ bundle install --retry 5 --jobs 5 bundle exec rake TESTOPTS="--verbose" - diff --git a/theforeman.org/yaml/jobs/deploy_web.yaml b/theforeman.org/yaml/jobs/deploy_web.yaml index 78256da9..deba169f 100644 --- a/theforeman.org/yaml/jobs/deploy_web.yaml +++ b/theforeman.org/yaml/jobs/deploy_web.yaml @@ -15,4 +15,3 @@ dsl: !include-raw: - pipelines/deploy/website.groovy - - pipelines/lib/rvm.groovy diff --git a/theforeman.org/yaml/jobs/pipeline/candlepin-release-pipelines.yaml b/theforeman.org/yaml/jobs/pipeline/candlepin-release-pipelines.yaml index 5c247add..bf871f3e 100644 --- a/theforeman.org/yaml/jobs/pipeline/candlepin-release-pipelines.yaml +++ b/theforeman.org/yaml/jobs/pipeline/candlepin-release-pipelines.yaml @@ -8,7 +8,6 @@ !include-raw: - 'pipelines/vars/candlepin/{version}.groovy' - 'pipelines/release/pipelines/candlepin.groovy{empty}' - - 'pipelines/lib/rvm.groovy{empty}' - 'pipelines/lib/ansible.groovy{empty}' - 'pipelines/lib/obal.groovy{empty}' - 'pipelines/lib/packaging.groovy{empty}' diff --git a/theforeman.org/yaml/jobs/pipeline/foreman-nightly-deb-pipeline.yaml b/theforeman.org/yaml/jobs/pipeline/foreman-nightly-deb-pipeline.yaml index e72f1a4e..c5d6778e 100644 --- a/theforeman.org/yaml/jobs/pipeline/foreman-nightly-deb-pipeline.yaml +++ b/theforeman.org/yaml/jobs/pipeline/foreman-nightly-deb-pipeline.yaml @@ -9,6 +9,5 @@ - pipelines/vars/foreman/nightly.groovy - pipelines/release/pipelines/foreman-deb.groovy - pipelines/lib/release.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/ansible.groovy - pipelines/lib/foreman_infra.groovy diff --git a/theforeman.org/yaml/jobs/pipeline/foreman-nightly-rpm-pipeline.yaml b/theforeman.org/yaml/jobs/pipeline/foreman-nightly-rpm-pipeline.yaml index ae3d7ce7..bd803bb5 100644 --- a/theforeman.org/yaml/jobs/pipeline/foreman-nightly-rpm-pipeline.yaml +++ b/theforeman.org/yaml/jobs/pipeline/foreman-nightly-rpm-pipeline.yaml @@ -9,7 +9,6 @@ - pipelines/vars/foreman/nightly.groovy - pipelines/release/pipelines/foreman-rpm.groovy - pipelines/lib/release.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/ansible.groovy - pipelines/lib/foreman_infra.groovy - pipelines/lib/packaging.groovy diff --git a/theforeman.org/yaml/jobs/pipeline/foreman-release-pipelines.yaml b/theforeman.org/yaml/jobs/pipeline/foreman-release-pipelines.yaml index c4b92164..2a1f2cb7 100644 --- a/theforeman.org/yaml/jobs/pipeline/foreman-release-pipelines.yaml +++ b/theforeman.org/yaml/jobs/pipeline/foreman-release-pipelines.yaml @@ -14,7 +14,6 @@ - 'pipelines/lib/release.groovy{empty}' - 'pipelines/lib/obal.groovy{empty}' - 'pipelines/lib/packaging.groovy{empty}' - - 'pipelines/lib/rvm.groovy{empty}' - 'pipelines/lib/ansible.groovy{empty}' - 'pipelines/lib/foreman_infra.groovy{empty}' @@ -30,7 +29,6 @@ !include-raw: - 'pipelines/vars/foreman/{version}.groovy' - 'pipelines/release/pipelines/client.groovy{empty}' - - 'pipelines/lib/rvm.groovy{empty}' - 'pipelines/lib/ansible.groovy{empty}' - 'pipelines/lib/obal.groovy{empty}' - 'pipelines/lib/packaging.groovy{empty}' @@ -47,7 +45,6 @@ !include-raw: - 'pipelines/vars/foreman/{version}.groovy' - 'pipelines/release/pipelines/plugins.groovy{empty}' - - 'pipelines/lib/rvm.groovy{empty}' - 'pipelines/lib/ansible.groovy{empty}' - 'pipelines/lib/obal.groovy{empty}' - 'pipelines/lib/packaging.groovy{empty}' diff --git a/theforeman.org/yaml/jobs/pipeline/foreman-stable-pipelines.yaml b/theforeman.org/yaml/jobs/pipeline/foreman-stable-pipelines.yaml index 260c19ac..03bfefc8 100644 --- a/theforeman.org/yaml/jobs/pipeline/foreman-stable-pipelines.yaml +++ b/theforeman.org/yaml/jobs/pipeline/foreman-stable-pipelines.yaml @@ -10,7 +10,6 @@ - 'pipelines/vars/foreman/{version}.groovy' - 'pipelines/lib/stable/smart-proxy.groovy{empty}' - 'pipelines/test/smart-proxy.groovy{empty}' - - 'pipelines/lib/rvm.groovy{empty}' - project: name: foreman-stable diff --git a/theforeman.org/yaml/jobs/pipeline/pulpcore-release-pipelines.yaml b/theforeman.org/yaml/jobs/pipeline/pulpcore-release-pipelines.yaml index 630f081a..433d76b1 100644 --- a/theforeman.org/yaml/jobs/pipeline/pulpcore-release-pipelines.yaml +++ b/theforeman.org/yaml/jobs/pipeline/pulpcore-release-pipelines.yaml @@ -8,7 +8,6 @@ !include-raw: - 'pipelines/vars/pulpcore/{version}.groovy' - 'pipelines/release/pipelines/pulpcore.groovy{empty}' - - 'pipelines/lib/rvm.groovy{empty}' - 'pipelines/lib/ansible.groovy{empty}' - 'pipelines/lib/obal.groovy{empty}' - 'pipelines/lib/packaging.groovy{empty}' diff --git a/theforeman.org/yaml/jobs/release/package/foreman-develop-package-release.yaml b/theforeman.org/yaml/jobs/release/package/foreman-develop-package-release.yaml index ffb0480e..b1ea3b66 100644 --- a/theforeman.org/yaml/jobs/release/package/foreman-develop-package-release.yaml +++ b/theforeman.org/yaml/jobs/release/package/foreman-develop-package-release.yaml @@ -14,7 +14,6 @@ - pipelines/vars/foreman/nightly.groovy - pipelines/release/foreman-x-develop-release.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/obal.groovy - pipelines/lib/git.groovy - pipelines/lib/ansible.groovy diff --git a/theforeman.org/yaml/jobs/release/package/foreman-installer-develop-package-release.yaml b/theforeman.org/yaml/jobs/release/package/foreman-installer-develop-package-release.yaml index 46884f2e..61a3896c 100644 --- a/theforeman.org/yaml/jobs/release/package/foreman-installer-develop-package-release.yaml +++ b/theforeman.org/yaml/jobs/release/package/foreman-installer-develop-package-release.yaml @@ -14,7 +14,6 @@ - pipelines/vars/foreman/nightly.groovy - pipelines/release/foreman-x-develop-release.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/ansible.groovy - pipelines/lib/obal.groovy - pipelines/lib/git.groovy diff --git a/theforeman.org/yaml/jobs/release/package/foreman-selinux-develop-package-release.yaml b/theforeman.org/yaml/jobs/release/package/foreman-selinux-develop-package-release.yaml index 3f62343f..b1be452e 100644 --- a/theforeman.org/yaml/jobs/release/package/foreman-selinux-develop-package-release.yaml +++ b/theforeman.org/yaml/jobs/release/package/foreman-selinux-develop-package-release.yaml @@ -14,7 +14,6 @@ - pipelines/vars/foreman/nightly.groovy - pipelines/release/foreman-x-develop-release.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/obal.groovy - pipelines/lib/ansible.groovy - pipelines/lib/git.groovy diff --git a/theforeman.org/yaml/jobs/release/package/hammer-cli-foreman-master-package-release.yaml b/theforeman.org/yaml/jobs/release/package/hammer-cli-foreman-master-package-release.yaml index 7043198d..88f886e3 100644 --- a/theforeman.org/yaml/jobs/release/package/hammer-cli-foreman-master-package-release.yaml +++ b/theforeman.org/yaml/jobs/release/package/hammer-cli-foreman-master-package-release.yaml @@ -11,7 +11,6 @@ - pipelines/vars/hammer-cli-foreman-master.groovy - pipelines/release/foreman-x-develop-release.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/obal.groovy - pipelines/lib/git.groovy - pipelines/lib/ansible.groovy diff --git a/theforeman.org/yaml/jobs/release/package/hammer-cli-katello-master-package-release.yaml b/theforeman.org/yaml/jobs/release/package/hammer-cli-katello-master-package-release.yaml index 90c7478c..6260e0bf 100644 --- a/theforeman.org/yaml/jobs/release/package/hammer-cli-katello-master-package-release.yaml +++ b/theforeman.org/yaml/jobs/release/package/hammer-cli-katello-master-package-release.yaml @@ -11,7 +11,6 @@ - pipelines/vars/hammer-cli-katello-master.groovy - pipelines/release/foreman-x-develop-release.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/obal.groovy - pipelines/lib/git.groovy - pipelines/lib/ansible.groovy diff --git a/theforeman.org/yaml/jobs/release/package/hammer-cli-master-package-release.yaml b/theforeman.org/yaml/jobs/release/package/hammer-cli-master-package-release.yaml index a15e0bfa..1d1fdae0 100644 --- a/theforeman.org/yaml/jobs/release/package/hammer-cli-master-package-release.yaml +++ b/theforeman.org/yaml/jobs/release/package/hammer-cli-master-package-release.yaml @@ -13,7 +13,6 @@ - pipelines/vars/hammer-cli-master.groovy - pipelines/release/foreman-x-develop-release.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/obal.groovy - pipelines/lib/git.groovy - pipelines/lib/ansible.groovy diff --git a/theforeman.org/yaml/jobs/release/package/katello-master-package-release.yaml b/theforeman.org/yaml/jobs/release/package/katello-master-package-release.yaml index db1e804f..497c2c9d 100644 --- a/theforeman.org/yaml/jobs/release/package/katello-master-package-release.yaml +++ b/theforeman.org/yaml/jobs/release/package/katello-master-package-release.yaml @@ -11,7 +11,6 @@ - pipelines/vars/katello-master-release.groovy - pipelines/release/foreman-x-develop-release.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/obal.groovy - pipelines/lib/git.groovy - pipelines/lib/ansible.groovy diff --git a/theforeman.org/yaml/jobs/release/package/smart-proxy-develop-source-release.yaml b/theforeman.org/yaml/jobs/release/package/smart-proxy-develop-source-release.yaml index 2bc5e9d3..1978f551 100644 --- a/theforeman.org/yaml/jobs/release/package/smart-proxy-develop-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/package/smart-proxy-develop-source-release.yaml @@ -12,7 +12,6 @@ - pipelines/vars/foreman/nightly.groovy - pipelines/release/foreman-x-develop-release.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/obal.groovy - pipelines/lib/git.groovy - pipelines/lib/ansible.groovy diff --git a/theforeman.org/yaml/jobs/release/source/foreman-develop-source-release.yaml b/theforeman.org/yaml/jobs/release/source/foreman-develop-source-release.yaml index 223a5866..fb4f467a 100644 --- a/theforeman.org/yaml/jobs/release/source/foreman-develop-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/source/foreman-develop-source-release.yaml @@ -14,6 +14,5 @@ - pipelines/release/source/foreman.groovy - pipelines/lib/nightly_packaging.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/git.groovy - pipelines/lib/foreman.groovy diff --git a/theforeman.org/yaml/jobs/release/source/foreman-installer-source-release.yaml b/theforeman.org/yaml/jobs/release/source/foreman-installer-source-release.yaml index 0e5e6026..34a36b13 100644 --- a/theforeman.org/yaml/jobs/release/source/foreman-installer-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/source/foreman-installer-source-release.yaml @@ -16,5 +16,4 @@ - pipelines/release/source/foreman-installer.groovy - pipelines/lib/nightly_packaging.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/git.groovy diff --git a/theforeman.org/yaml/jobs/release/source/foreman-selinux-source-release.yaml b/theforeman.org/yaml/jobs/release/source/foreman-selinux-source-release.yaml index 8df5f1b5..1c6a8888 100644 --- a/theforeman.org/yaml/jobs/release/source/foreman-selinux-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/source/foreman-selinux-source-release.yaml @@ -15,5 +15,4 @@ - pipelines/release/source/foreman-selinux.groovy - pipelines/lib/nightly_packaging.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/git.groovy diff --git a/theforeman.org/yaml/jobs/release/source/hammer-cli-foreman-master-source-release.yaml b/theforeman.org/yaml/jobs/release/source/hammer-cli-foreman-master-source-release.yaml index 0bd4d70c..62d78178 100644 --- a/theforeman.org/yaml/jobs/release/source/hammer-cli-foreman-master-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/source/hammer-cli-foreman-master-source-release.yaml @@ -15,5 +15,4 @@ - pipelines/release/source/hammer-cli-x.groovy - pipelines/lib/nightly_packaging.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/git.groovy diff --git a/theforeman.org/yaml/jobs/release/source/hammer-cli-katello-master-source-release.yaml b/theforeman.org/yaml/jobs/release/source/hammer-cli-katello-master-source-release.yaml index b97181d7..2dbf53db 100644 --- a/theforeman.org/yaml/jobs/release/source/hammer-cli-katello-master-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/source/hammer-cli-katello-master-source-release.yaml @@ -15,5 +15,4 @@ - pipelines/release/source/hammer-cli-x.groovy - pipelines/lib/nightly_packaging.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/git.groovy diff --git a/theforeman.org/yaml/jobs/release/source/hammer-cli-master-source-release.yaml b/theforeman.org/yaml/jobs/release/source/hammer-cli-master-source-release.yaml index cc642b03..4e2f6b72 100644 --- a/theforeman.org/yaml/jobs/release/source/hammer-cli-master-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/source/hammer-cli-master-source-release.yaml @@ -15,5 +15,4 @@ - pipelines/release/source/hammer-cli-x.groovy - pipelines/lib/nightly_packaging.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/git.groovy diff --git a/theforeman.org/yaml/jobs/release/source/katello-master-source-release.yaml b/theforeman.org/yaml/jobs/release/source/katello-master-source-release.yaml index ecd6206c..8e2366ce 100644 --- a/theforeman.org/yaml/jobs/release/source/katello-master-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/source/katello-master-source-release.yaml @@ -14,6 +14,5 @@ - pipelines/release/source/katello.groovy - pipelines/lib/nightly_packaging.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/git.groovy - pipelines/lib/foreman.groovy diff --git a/theforeman.org/yaml/jobs/release/source/smart-proxy-develop-source-release.yaml b/theforeman.org/yaml/jobs/release/source/smart-proxy-develop-source-release.yaml index 6fe96656..8644286a 100644 --- a/theforeman.org/yaml/jobs/release/source/smart-proxy-develop-source-release.yaml +++ b/theforeman.org/yaml/jobs/release/source/smart-proxy-develop-source-release.yaml @@ -15,7 +15,6 @@ - pipelines/release/source/smart-proxy.groovy - pipelines/lib/nightly_packaging.groovy - pipelines/lib/foreman_infra.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/git.groovy publishers: - ircbot_freenode diff --git a/theforeman.org/yaml/jobs/release/tarballs-release.yaml b/theforeman.org/yaml/jobs/release/tarballs-release.yaml index bf2fbb43..b6181ff7 100644 --- a/theforeman.org/yaml/jobs/release/tarballs-release.yaml +++ b/theforeman.org/yaml/jobs/release/tarballs-release.yaml @@ -13,4 +13,3 @@ dsl: !include-raw: - pipelines/release/tarballsRelease.groovy - - pipelines/lib/rvm.groovy diff --git a/theforeman.org/yaml/jobs/smart-proxy-plugin-pull-request.yaml b/theforeman.org/yaml/jobs/smart-proxy-plugin-pull-request.yaml index 9c20699b..63ff7b1b 100644 --- a/theforeman.org/yaml/jobs/smart-proxy-plugin-pull-request.yaml +++ b/theforeman.org/yaml/jobs/smart-proxy-plugin-pull-request.yaml @@ -28,7 +28,7 @@ type: user-defined name: ruby values: - - '2.7' + - '2.7.6' builders: - smart-proxy-plugin publishers: diff --git a/theforeman.org/yaml/jobs/smart-proxy-plugin.yaml b/theforeman.org/yaml/jobs/smart-proxy-plugin.yaml index a5532fd3..5a5cb8e3 100644 --- a/theforeman.org/yaml/jobs/smart-proxy-plugin.yaml +++ b/theforeman.org/yaml/jobs/smart-proxy-plugin.yaml @@ -28,7 +28,7 @@ type: user-defined name: ruby values: - - '2.7' + - '2.7.6' builders: - smart-proxy-plugin publishers: diff --git a/theforeman.org/yaml/jobs/tests/foreman-installer-pr-test.yaml b/theforeman.org/yaml/jobs/tests/foreman-installer-pr-test.yaml index 8b256846..b58c039d 100644 --- a/theforeman.org/yaml/jobs/tests/foreman-installer-pr-test.yaml +++ b/theforeman.org/yaml/jobs/tests/foreman-installer-pr-test.yaml @@ -12,6 +12,5 @@ dsl: !include-raw: - pipelines/lib/git.groovy - - pipelines/lib/rvm.groovy - pipelines/lib/rbenv.groovy - pipelines/test/foreman-installer.groovy diff --git a/theforeman.org/yaml/jobs/tests/smart-proxy-plugin-pr-test.yaml b/theforeman.org/yaml/jobs/tests/smart-proxy-plugin-pr-test.yaml index 3f98af4b..5c446578 100644 --- a/theforeman.org/yaml/jobs/tests/smart-proxy-plugin-pr-test.yaml +++ b/theforeman.org/yaml/jobs/tests/smart-proxy-plugin-pr-test.yaml @@ -13,7 +13,6 @@ dsl: !include-raw: - pipelines/lib/git.groovy{empty} - - pipelines/lib/rvm.groovy{empty} - pipelines/test/smart-proxy.groovy{empty} - project: diff --git a/theforeman.org/yaml/jobs/tests/smart-proxy-pr-test.yaml b/theforeman.org/yaml/jobs/tests/smart-proxy-pr-test.yaml index 37bba09e..1ab974ca 100644 --- a/theforeman.org/yaml/jobs/tests/smart-proxy-pr-test.yaml +++ b/theforeman.org/yaml/jobs/tests/smart-proxy-pr-test.yaml @@ -12,5 +12,4 @@ dsl: !include-raw: - pipelines/lib/git.groovy - - pipelines/lib/rvm.groovy - pipelines/test/smart-proxy.groovy