Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHEL8 #2012

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

RHEL8 #2012

Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/travis/build/addons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'travis/build/addons/apt'
require 'travis/build/addons/apt_packages'
require 'travis/build/addons/apt_retries'
require 'travis/build/addons/yum'
require 'travis/build/addons/snaps'
require 'travis/build/addons/artifacts'
require 'travis/build/addons/chrome'
Expand Down
68 changes: 68 additions & 0 deletions lib/travis/build/addons/yum.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
require 'travis/build/addons/base'
require 'shellwords'

module Travis
module Build
class Addons
class Yum < Base
SUPPORTED_OPERATING_SYSTEMS = %w[
linux
/^linux.*/
].freeze

SUPPORTED_DISTS = %w(
rhel
).freeze

def before_prepare?
SUPPORTED_OPERATING_SYSTEMS.any? do |os_match|
data[:config][:os].to_s == os_match
end
end

def before_prepare
return if config_yum.empty?
sh.newline
sh.fold('yum') do
install_yum
end
sh.newline
end

def before_configure?
config
end

def before_configure
sh.echo "Configuring default yum options", ansi: :yellow
tmp_dest = "${TRAVIS_TMPDIR}/99-travis-yum-conf"
sh.file tmp_dest, <<~YUM_CONF
assumeyes=1
retries=5
timeout=30
YUM_CONF
sh.cmd %Q{sudo mv #{tmp_dest} ${TRAVIS_ROOT}/usr/local/etc/yum.conf}
end

def config
@config ||= Hash(super)
end

def install_yum
sh.echo "Installing #{config_yum.count} packages", ansi: :yellow

packages = config_yum.map{|v| Shellwords.escape(v)}.join(' ')
sh.cmd "sudo yum install -y #{packages}", echo: true, timing: true, assert: true
end

def config_yum
@config_yum ||= Array(config[:packages]).flatten.compact
rescue TypeError => e
if e.message =~ /no implicit conversion of Symbol into Integer/
raise Travis::Build::YumConfigError.new
end
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/travis/build/appliances/disable_initramfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Build
module Appliances
class DisableInitramfs < Base
def apply
sh.raw "if [ ! $(uname|egrep 'Darwin|FreeBSD') ]; then echo update_initramfs=no | sudo tee -a /etc/initramfs-tools/update-initramfs.conf > /dev/null; fi"
sh.raw "if [[ ! $(uname|egrep 'Darwin|FreeBSD') && ! -f /etc/redhat-release ]]; then echo update_initramfs=no | sudo tee -a /etc/initramfs-tools/update-initramfs.conf > /dev/null; fi"
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/travis/build/bash/travis_setup_postgresql.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ travis_setup_postgresql() {
focal)
version='12'
;;
rhel8)
version='12'
;;
*)
echo -e "${ANSI_RED}Unrecognized operating system.${ANSI_CLEAR}"
;;
Expand Down
11 changes: 11 additions & 0 deletions lib/travis/build/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ def doc_path
'/user/installing-dependencies'
end
end


class YumConfigError < CompilationError
def initialize(msg = "\\`yum\\` should be a list.")
super
end

def doc_path
'/user/installing-dependencies'
end
end

class GithubAppsTokenFetchError < CompilationError
def initialize(msg = "Unable to fetch GitHub Apps Token. GitHub may be unavailable. " \
Expand Down
2 changes: 1 addition & 1 deletion spec/build/script/shared/appliances/disable_initramfs.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shared_examples_for 'disables updating initramfs' do
let(:disable_initramfs) { %(if [ ! $(uname|egrep 'Darwin|FreeBSD') ]; then echo update_initramfs=no | sudo tee -a /etc/initramfs-tools/update-initramfs.conf > /dev/null; fi) }
let(:disable_initramfs) { %(if [[ ! $(uname|egrep 'Darwin|FreeBSD') && ! -f /etc/redhat-release ]]; then echo update_initramfs=no | sudo tee -a /etc/initramfs-tools/update-initramfs.conf > /dev/null; fi) }

it 'disables updating initramfs' do
should include_sexp [:raw, disable_initramfs]
Expand Down