Skip to content

Commit

Permalink
Merge branch 'master' into rhel8
Browse files Browse the repository at this point in the history
  • Loading branch information
GbArc authored Jul 11, 2022
2 parents 87c20db + 04a1963 commit f8c9e04
Show file tree
Hide file tree
Showing 47 changed files with 1,057 additions and 88 deletions.
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def data
end

def set_up_config(match_data)
@build = build(match_data[:build])
@build = build(match_data[:build].to_i)
@job_number = match_data[:job].to_i - 1
@compile_config = @build.jobs[@job_number].config
end
Expand Down
6 changes: 2 additions & 4 deletions lib/travis/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ def config
module_function :config

def top
@top ||= Pathname.new(
`git rev-parse --show-toplevel 2>/dev/null`.strip
)
::Travis::Vcs::Git::top
end

module_function :top

class << self
def version
return @version if @version
@version ||= `git describe --always --dirty --tags 2>/dev/null`.strip
@version ||= ::Travis::Vcs::Git::version
@version = nil unless $?.success?
@version ||= ENV.fetch('BUILD_SLUG_COMMIT', nil)
@version ||= top.join('VERSION').read if top.join('VERSION').exist?
Expand Down
1 change: 1 addition & 0 deletions lib/travis/build/addons/apt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Apt < Base
xenial
bionic
focal
jammy
).freeze

attr_reader :safelisted, :disallowed_while_sudo
Expand Down
3 changes: 2 additions & 1 deletion lib/travis/build/addons/artifacts/env.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
require 'core_ext/hash/deep_symbolize_keys'
require 'active_support/core_ext/hash/slice'
require 'travis/vcs.rb'

module Travis
module Build
class Addons
class Artifacts < Base
class Env
DEFAULT = {
paths: '$(git ls-files -o | tr "\n" ":")',
paths: ::Travis::Vcs::paths,
log_format: 'multiline'
}

Expand Down
4 changes: 2 additions & 2 deletions lib/travis/build/addons/chrome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def export_source_url
sh.elif "$(uname) = 'Darwin'" do
case version
when 'stable'
pkg_url = "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
pkg_url = "https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg"
when 'beta'
pkg_url = "https://dl.google.com/chrome/mac/beta/googlechrome.dmg"
pkg_url = "https://dl.google.com/chrome/mac/universal/beta/googlechromebeta.dmg "
end
sh.export 'CHROME_SOURCE_URL', pkg_url
end
Expand Down
6 changes: 3 additions & 3 deletions lib/travis/build/addons/deploy/script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ def build_gem_locally_from(source, branch)
sh.echo "Building dpl gem locally with source #{source} and branch #{branch}", ansi: :yellow
cmd("gem uninstall -aIx dpl >& /dev/null", echo: false, assert: !allow_failure, timing: false)
sh.cmd("pushd /tmp >& /dev/null", echo: false, assert: !allow_failure, timing: true)
sh.cmd("git clone https://github.com/#{source} #{source}", echo: true, assert: !allow_failure, timing: true)
sh.cmd(::Travis::Vcs::Git::clone_cmd('https://github.com',source), echo: true, assert: !allow_failure, timing: true)
sh.cmd("pushd #{source} >& /dev/null", echo: false, assert: !allow_failure, timing: true)
sh.cmd("git checkout #{branch}", echo: true, assert: !allow_failure, timing: true)
sh.cmd("git rev-parse HEAD", echo: true, assert: !allow_failure, timing: true)
sh.cmd(::Travis::Vcs::Git::checkout_cmd(branch), echo: true, assert: !allow_failure, timing: true)
sh.cmd(::Travis::Vcs::Git::revision_cmd, echo: true, assert: !allow_failure, timing: true)
cmd("gem build dpl.gemspec", echo: true, assert: !allow_failure, timing: true)
sh.raw "for f in dpl-*.gemspec; do"
sh.raw " base=${f%*.gemspec}"
Expand Down
2 changes: 1 addition & 1 deletion lib/travis/build/addons/mariadb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def after_prepare
sh.else do
sh.cmd "apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 #{MARIADB_GPG_KEY_NEW}", sudo: true
end
sh.cmd 'add-apt-repository "deb http://%p/mariadb/repo/%p/ubuntu $TRAVIS_DIST main"' % [MARIADB_MIRROR, mariadb_version], sudo: true
sh.cmd 'add-apt-repository --yes "deb http://%p/mariadb/repo/%p/ubuntu $TRAVIS_DIST main"' % [MARIADB_MIRROR, mariadb_version], sudo: true
sh.cmd 'travis_apt_get_update', retry: true, echo: true
sh.cmd "PACKAGES='mariadb-server-#{mariadb_version}'", echo: true
sh.cmd "if [[ $(lsb_release -cs) = 'precise' ]]; then PACKAGES=\"${PACKAGES} libmariadbclient-dev\"; fi", echo: true
Expand Down
1 change: 1 addition & 0 deletions lib/travis/build/addons/snaps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Snaps < Base
xenial
bionic
focal
jammy
).freeze

def before_prepare?
Expand Down
1 change: 0 additions & 1 deletion lib/travis/build/appliances/agent.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'base64'
require 'travis/build/appliances/base'
require 'travis/build/appliances/agent/jwt'
require 'travis/build/git'

module Travis
module Build
Expand Down
4 changes: 2 additions & 2 deletions lib/travis/build/appliances/checkout.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'travis/build/appliances/base'
require 'travis/build/git'
require 'travis/vcs'

module Travis
module Build
module Appliances
class Checkout < Base
def apply
Git.new(sh, data).checkout
Travis::Vcs.checkout(sh, data)
end

def apply?
Expand Down
1 change: 0 additions & 1 deletion lib/travis/build/appliances/rm_etc_boto_cfg.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'travis/build/appliances/base'
require 'travis/build/git'

module Travis
module Build
Expand Down
1 change: 0 additions & 1 deletion lib/travis/build/appliances/setup_filter.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'travis/build/appliances/base'
require 'travis/build/git'
require 'travis/rollout'

module Travis
Expand Down
2 changes: 2 additions & 0 deletions lib/travis/build/bash/travis_setup_postgresql.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ travis_setup_postgresql() {
;;
rhel8)
version='12'
jammy)
version='14'
;;
*)
echo -e "${ANSI_RED}Unrecognized operating system.${ANSI_CLEAR}"
Expand Down
2 changes: 2 additions & 0 deletions lib/travis/build/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def sc_data
xenial: ENV.fetch('TRAVIS_BUILD_APT_PACKAGE_SAFELIST_XENIAL', ''),
bionic: ENV.fetch('TRAVIS_BUILD_APT_PACKAGE_SAFELIST_BIONIC', ''),
focal: ENV.fetch('TRAVIS_BUILD_APT_PACKAGE_SAFELIST_FOCAL', ''),
jammy: ENV.fetch('TRAVIS_BUILD_APT_PACKAGE_SAFELIST_JAMMY', ''),
},
apt_proxy: ENV.fetch('TRAVIS_BUILD_APT_PROXY', ''),
apt_source_alias_list: {
Expand All @@ -61,6 +62,7 @@ def sc_data
xenial: ENV.fetch('TRAVIS_BUILD_APT_SOURCE_ALIAS_LIST_XENIAL', ''),
bionic: ENV.fetch('TRAVIS_BUILD_APT_SOURCE_ALIAS_LIST_BIONIC', ''),
focal: ENV.fetch('TRAVIS_BUILD_APT_SOURCE_ALIAS_LIST_FOCAL', ''),
jammy: ENV.fetch('TRAVIS_BUILD_APT_SOURCE_ALIAS_LIST_JAMMY', ''),
},
apt_source_alias_list_key_url_template: ENV.fetch(
'TRAVIS_BUILD_APT_SOURCE_ALIAS_LIST_KEY_URL_TEMPLATE',
Expand Down
6 changes: 6 additions & 0 deletions lib/travis/build/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,11 @@ def initialize(msg = "Unable to fetch GitHub Apps Token. GitHub may be unavailab
super
end
end

class UnknownServiceTypeError < StandardError
def initialize(_type)
super
end
end
end
end
2 changes: 1 addition & 1 deletion lib/travis/build/rake_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def file_update_ghc_versions
dest.chmod(0o644)
end

def file_update_sonar_scanner(version: ENV['TRAVIS_BUILD_SONAR_CLOUD_CLI_VERSION'] || '3.0.3.778')
def file_update_sonar_scanner(version: ENV['TRAVIS_BUILD_SONAR_CLOUD_CLI_VERSION'] || '4.7.0.2747')
conn = build_faraday_conn(host: 'repo1.maven.org')
response = conn.get("/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/#{version}/sonar-scanner-cli-#{version}.zip")
raise 'Could not fetch SonarCloud scanner CLI archive' unless response.success?
Expand Down
13 changes: 7 additions & 6 deletions lib/travis/build/script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require 'travis/build/addons'
require 'travis/build/appliances'
require 'travis/build/errors'
require 'travis/build/git'
require 'travis/vcs'
require 'travis/build/helpers'
require 'travis/build/stages'

Expand Down Expand Up @@ -84,13 +84,13 @@ class Script
private_constant :TRAVIS_FUNCTIONS

class << self
def defaults(key)
def defaults(key, server_type)
if key && self::DEFAULTS.key?(key.to_sym)
Git::DEFAULTS.merge self::DEFAULTS[key.to_sym]
Travis::Vcs.defaults(server_type).merge self::DEFAULTS[key.to_sym]
elsif self::DEFAULTS[:default]
Git::DEFAULTS.merge self::DEFAULTS[:default]
Travis::Vcs.defaults(server_type).merge self::DEFAULTS[:default]
else
Git::DEFAULTS.merge self::DEFAULTS
Travis::Vcs.defaults(server_type).merge self::DEFAULTS
end
end
end
Expand All @@ -111,9 +111,10 @@ def defaults(key)
def initialize(data)
@raw_data = data.deep_symbolize_keys
raw_config = @raw_data[:config]
server_type = @raw_data.dig(:repository, :server_type) || 'git'
lang_sym = raw_config.fetch(:language,"").to_sym
@data = Data.new({
config: self.class.defaults(raw_config[:os]),
config: self.class.defaults(raw_config[:os], server_type),
language_default_p: !raw_config[lang_sym]
}.deep_merge(self.raw_data))
@options = {}
Expand Down
32 changes: 16 additions & 16 deletions lib/travis/build/script/php.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,23 @@ def php_5_3_or_older?
def overwrite_pearrc(version)
pear_config = %q(
[
'preferred_state' => "stable",
'temp_dir' => "/tmp/pear/install",
'download_dir' => "/tmp/pear/install",
'bin_dir' => "/home/travis/.phpenv/versions/__VERSION__/bin",
'php_dir' => "/home/travis/.phpenv/versions/__VERSION__/share/pear",
'doc_dir' => "/home/travis/.phpenv/versions/__VERSION__/docs",
'data_dir' => "/home/travis/.phpenv/versions/__VERSION__/data",
'cfg_dir' => "/home/travis/.phpenv/versions/__VERSION__/cfg",
'www_dir' => "/home/travis/.phpenv/versions/__VERSION__/www",
'man_dir' => "/home/travis/.phpenv/versions/__VERSION__/man",
'test_dir' => "/home/travis/.phpenv/versions/__VERSION__/tests",
'__channels' => [
'__uri' => [],
'doc.php.net' => [],
'pecl.php.net' => []
"preferred_state" => "stable",
"temp_dir" => "/tmp/pear/install",
"download_dir" => "/tmp/pear/install",
"bin_dir" => "/home/travis/.phpenv/versions/__VERSION__/bin",
"php_dir" => "/home/travis/.phpenv/versions/__VERSION__/share/pear",
"doc_dir" => "/home/travis/.phpenv/versions/__VERSION__/docs",
"data_dir" => "/home/travis/.phpenv/versions/__VERSION__/data",
"cfg_dir" => "/home/travis/.phpenv/versions/__VERSION__/cfg",
"www_dir" => "/home/travis/.phpenv/versions/__VERSION__/www",
"man_dir" => "/home/travis/.phpenv/versions/__VERSION__/man",
"test_dir" => "/home/travis/.phpenv/versions/__VERSION__/tests",
"__channels" => [
"__uri" => [],
"doc.php.net" => [],
"pecl.php.net" => []
],
'auto_discover' => 1
"auto_discover" => 1
]
).gsub("__VERSION__", version)

Expand Down
72 changes: 72 additions & 0 deletions lib/travis/vcs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
require 'travis/vcs/base.rb'
require 'travis/vcs/git.rb'
require 'travis/vcs/perforce.rb'
require 'travis/vcs/svn.rb'
require 'travis/build/errors.rb'

module Travis
module Vcs
class <<self
def top
"Travis::Vcs::#{provider_name.to_s.camelize}".constantize.top
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new provider_name
end

def version
"Travis::Vcs::#{provider_name.to_s.camelize}".constantize.version
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new provider_name
end

def paths
"Travis::Vcs::#{provider_name.to_s.camelize}".constantize.paths
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new(provider_name)
end

def clone_cmd(endpoint, source)
"Travis::Vcs::#{provider_name.to_s.camelize}".constantize.clone_cmd(endpoint, source)
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new provider_name
end

def checkout_cmd(branch)
"Travis::Vcs::#{provider_name.to_s.camelize}".constantize.checkout_cmd(branch)
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new(provider_name)
end

def revision_cmd
"Travis::Vcs::#{provider_name.to_s.camelize}".constantize.revision_cmd
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new provider_name
end

def checkout(sh,data)
vcs(sh,data).checkout
end

def defaults(server_type)
@provider_name = server_type
"Travis::Vcs::#{provider_name.to_s.camelize}".constantize.defaults
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new provider_name
end

private
def vcs(sh,data)
provider = data[:repository][:server_type] if data.key?(:repository)
provider = provider_name unless provider
@provider_name = provider
"Travis::Vcs::#{provider.to_s.camelize}".constantize.new(sh,data)
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new provider_name
end

def provider_name
@provider_name ||= 'git'
end
end
end
end
34 changes: 34 additions & 0 deletions lib/travis/vcs/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#frozen_string_literal: true
module Travis
module Vcs
class Base
attr_reader :sh, :data

def self.top
raise NotImplementedError
end

def self.version
raise NotImplementedError
end

def self.paths
raise NotImplementedError
end

def self.defaults
raise NotImplementedError
end

def initialize(sh, data)
@sh = sh
@data = data
end

def checkout
raise NotImplementedError
end

end
end
end
Loading

0 comments on commit f8c9e04

Please sign in to comment.