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 all 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
2 changes: 1 addition & 1 deletion lib/travis/build/appliances/enable_i386.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Build
module Appliances
class EnableI386 < Base
def apply
sh.if "$(uname -m) == x86_64 && $(command -v lsb_release) && $(lsb_release -cs) != precise" do
sh.if "$(uname -m) == x86_64 && $(command -v lsb_release) && $(lsb_release -cs) != precise && $(lsb_release -cs) != Ootpa" do
sh.cmd 'dpkg --add-architecture i386', echo: false, assert: false, sudo: true
end
end
Expand Down
8 changes: 7 additions & 1 deletion lib/travis/build/bash/travis_setup_postgresql.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ travis_setup_postgresql() {
focal)
version='12'
;;
Ootpa)
version='12'
;;
jammy)
version='14'
;;
*)
echo -e "${ANSI_RED}Unrecognized operating system.${ANSI_CLEAR}"
echo -e "${ANSI_RED}Unrecognized operating system ${TRAVIS_DIST}.${ANSI_CLEAR}"
;;
esac
fi
Expand All @@ -34,6 +37,9 @@ travis_setup_postgresql() {
if [[ "${TRAVIS_INIT}" == upstart ]]; then
start_cmd="sudo service postgresql start ${version}"
stop_cmd="sudo service postgresql stop"
elif [[ "${TRAVIS_DIST}" == Ootpa ]]; then
start_cmd="sudo systemctl start postgresql-${version}"
stop_cmd="sudo systemctl stop postgresql"
elif [[ "${TRAVIS_INIT}" == systemd ]]; then
start_cmd="sudo systemctl start postgresql@${version}-main"
stop_cmd="sudo systemctl stop postgresql"
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