mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-04 09:43:08 +02:00
Use pre-built images from Docker Hub when the container definition has not changed.
Downloading an image is quite a bit faster than building a new image from scratch and saves minutes per test run in CI.
This commit is contained in:
parent
8568622a6f
commit
1862630629
@ -37,7 +37,7 @@ before_install:
|
||||
install:
|
||||
- |
|
||||
# User Configuration
|
||||
sudo adduser --ingroup=${USER?} --disabled-password --gecos "" pgbackrest
|
||||
sudo adduser --ingroup=${USER?} --uid=5001 --disabled-password --gecos "" pgbackrest
|
||||
umask 0022
|
||||
cd ~ && pwd && whoami && umask && groups
|
||||
mv ${TRAVIS_BUILD_DIR?} pgbackrest
|
||||
|
@ -89,6 +89,10 @@
|
||||
</release-improvement-list>
|
||||
|
||||
<release-development-list>
|
||||
<release-item>
|
||||
<p>Use pre-built images from Docker Hub when the container definition has not changed. Downloading an image is quite a bit faster than building a new image from scratch and saves minutes per test run in CI.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Refactor the <code>common/log</code> tests to not depend on <code>common/harnessLog</code>. <code>common/harnessLog</code> was not ideally suited for general testing and made all the tests quite awkward. Instead, move all code used to test the <code>common/log</code> module into the <code>logTest</code> module and repurpose <code>common/harnessLog</code> to do log expect testing for all other tests in a cleaner way. Add a few exceptions for config testing since the log levels are reset by default in <code>config/parse</code>.</p>
|
||||
</release-item>
|
||||
|
5
test/Vagrantfile
vendored
5
test/Vagrantfile
vendored
@ -5,10 +5,10 @@ Vagrant.configure(2) do |config|
|
||||
end
|
||||
|
||||
config.vm.box = "ubuntu/bionic64"
|
||||
config.vm.box_version = "20180531.0.0"
|
||||
config.vm.box_version = "20180719.0.0"
|
||||
|
||||
# vagrant plugin install vagrant-disksize
|
||||
# config.disksize.size = '64GB'
|
||||
config.disksize.size = '64GB'
|
||||
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
vb.name = "pgbackrest-test"
|
||||
@ -91,7 +91,6 @@ Vagrant.configure(2) do |config|
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
echo 'Create Postgres Group & pgBackRest User' && date
|
||||
groupadd -g5000 postgres
|
||||
adduser --uid=5001 --ingroup=vagrant --disabled-password --gecos "" pgbackrest
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
|
11
test/container.yaml
Normal file
11
test/container.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
# **********************************************************************************************************************************
|
||||
# Container Cache
|
||||
#
|
||||
# Contains hashes for containers that are available on Docker hub. If present, the container can be pulled instead of being built
|
||||
# locally which saves a lot of time. Note: these are hashes of the Dockerfile not the actually binary image.
|
||||
# **********************************************************************************************************************************
|
||||
20180721A:
|
||||
co6: 0ce34e42667499721f9f02c1b9e886f5f331b4e4
|
||||
co7: 58b1f8e80553ea197d54c6b51479d29029a0468d
|
||||
u12: 6892bee5d0584c45d12273f687230fbec0b27982
|
||||
u18: 5e966399a1352880e5bb97a35cda162766da0409
|
@ -120,7 +120,7 @@ sub process
|
||||
"install:\n" .
|
||||
" - |\n" .
|
||||
" # User Configuration\n" .
|
||||
" sudo adduser --ingroup=\${USER?} --disabled-password --gecos \"\" " . BACKREST_USER . "\n" .
|
||||
" sudo adduser --ingroup=\${USER?} --uid=5001 --disabled-password --gecos \"\" " . BACKREST_USER . "\n" .
|
||||
" umask 0022\n" .
|
||||
" cd ~ && pwd && whoami && umask && groups\n" .
|
||||
" mv \${TRAVIS_BUILD_DIR?} " . BACKREST_EXE . "\n" .
|
||||
|
@ -12,6 +12,7 @@ use Carp qw(confess longmess);
|
||||
use English '-no_match_vars';
|
||||
|
||||
use Cwd qw(abs_path);
|
||||
use Digest::SHA qw(sha1_hex);
|
||||
use Exporter qw(import);
|
||||
our @EXPORT = qw();
|
||||
use File::Basename qw(dirname);
|
||||
@ -30,9 +31,9 @@ use pgBackRestTest::Common::VmTest;
|
||||
####################################################################################################################################
|
||||
use constant POSTGRES_GROUP => 'postgres';
|
||||
push @EXPORT, qw(POSTGRES_GROUP);
|
||||
use constant POSTGRES_GROUP_ID => getgrnam(POSTGRES_GROUP) . '';
|
||||
use constant POSTGRES_GROUP_ID => 5000;
|
||||
use constant POSTGRES_USER => POSTGRES_GROUP;
|
||||
use constant POSTGRES_USER_ID => POSTGRES_GROUP_ID;
|
||||
use constant POSTGRES_USER_ID => 5000;
|
||||
|
||||
use constant TEST_GROUP => getgrgid($UID) . '';
|
||||
push @EXPORT, qw(TEST_GROUP);
|
||||
@ -74,6 +75,11 @@ use constant CONTAINER_DEBUG => false;
|
||||
####################################################################################################################################
|
||||
use constant CONTAINER_S3_SERVER_TAG => 's3-server-20180612A';
|
||||
|
||||
####################################################################################################################################
|
||||
# Store cache container checksums
|
||||
####################################################################################################################################
|
||||
my $hContainerCache;
|
||||
|
||||
####################################################################################################################################
|
||||
# Generate Devel::Cover package name
|
||||
####################################################################################################################################
|
||||
@ -120,14 +126,41 @@ sub containerWrite
|
||||
my $bForce = shift;
|
||||
|
||||
my $strTag = containerRepo() . ":${strImage}";
|
||||
&log(INFO, "Building ${strTag} image...");
|
||||
|
||||
$strScript =
|
||||
"# ${strTitle} Container\n" .
|
||||
"FROM ${strImageParent}\n\n" .
|
||||
(defined($strCopy) ? "${strCopy}\n\n" : '') .
|
||||
"RUN echo '" . (CONTAINER_DEBUG ? 'DEBUG' : 'OPTIMIZED') . " BUILD'" .
|
||||
$strScript;
|
||||
"FROM ${strImageParent}" .
|
||||
(defined($strCopy) ? "\n\n${strCopy}\n\n" : '') .
|
||||
(defined($strScript) && $strScript ne ''?
|
||||
"\n\nRUN echo '" . (CONTAINER_DEBUG ? 'DEBUG' : 'OPTIMIZED') . " BUILD'" . $strScript : '');
|
||||
|
||||
# Search for the image in the cache
|
||||
my $strScriptSha1;
|
||||
my $bCached = false;
|
||||
|
||||
if ($strImage =~ /\-base$/)
|
||||
{
|
||||
$strScriptSha1 = sha1_hex($strScript);
|
||||
|
||||
foreach my $strBuild (reverse(keys(%{$hContainerCache})))
|
||||
{
|
||||
if (defined($hContainerCache->{$strBuild}{$strOS}) && $hContainerCache->{$strBuild}{$strOS} eq $strScriptSha1)
|
||||
{
|
||||
&log(INFO, "Using cached ${strTag}-${strBuild} image (${strScriptSha1}) ...");
|
||||
|
||||
$strScript =
|
||||
"# ${strTitle} Container\n" .
|
||||
"FROM ${strTag}-${strBuild}";
|
||||
|
||||
$bCached = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$bCached)
|
||||
{
|
||||
&log(INFO, "Building ${strTag} image" . (defined($strScriptSha1) ? " (${strScriptSha1})" : '') . ' ...');
|
||||
}
|
||||
|
||||
# Write the image
|
||||
$oStorageDocker->put("${strTempPath}/${strImage}", trim($strScript) . "\n");
|
||||
@ -179,25 +212,44 @@ sub sshSetup
|
||||
my $strGroup = shift;
|
||||
my $bControlMaster = shift;
|
||||
|
||||
my $strUserPath = $strUser eq 'root' ? "/${strUser}" : "/home/${strUser}";
|
||||
|
||||
my $strScript = sectionHeader() .
|
||||
"# Setup SSH\n" .
|
||||
" mkdir /home/${strUser}/.ssh && \\\n" .
|
||||
" cp /root/.ssh/id_rsa /home/${strUser}/.ssh/id_rsa && \\\n" .
|
||||
" cp /root/.ssh/authorized_keys /home/${strUser}/.ssh/authorized_keys && \\\n" .
|
||||
" cp /root/.ssh/config /home/${strUser}/.ssh/config && \\\n";
|
||||
" mkdir ${strUserPath}/.ssh && \\\n" .
|
||||
" echo '-----BEGIN RSA PRIVATE KEY-----' > ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'MIICXwIBAAKBgQDR0yJsZW5d5LcqteiOtv8d+FFeFFHDPI0VTcTOdMn1iDiIP1ou' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'X3Q2OyNjsBaDbsRJd+sp9IRq1LKX3zsBcgGZANwm0zduuNEPEU94ajS/uRoejIqY' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo '/XkKOpnEF6ZbQ2S7TaE4sWeGLvba7kUFs0QTOO+N+nV2dMbdqZf6C8lazwIDAQAB' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'AoGBAJXa6xzrnFVmwgK5BKzYuX/YF5TPgk2j80ch0ct50buQXH/Cb0/rUH5i4jWS' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'T6Hy/DFUehnuzpvV6O9auTOhDs3BhEKFRuRLn1nBwTtZny5Hh+cw7azUCEHFCJlz' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'makCrVbgawtno6oU/pFgQm1FcxD0f+Me5ruNcLHqUZsPQwkRAkEA+8pG+ckOlz6R' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'AJLIHedmfcrEY9T7sfdo83bzMOz8H5soUUP4aOTLJYCla1LO7JdDnXMGo0KxaHBP' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'l8j5zDmVewJBANVVPDJr1w37m0FBi37QgUOAijVfLXgyPMxYp2uc9ddjncif0063' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo '0Wc0FQefoPszf3CDrHv/RHvhHq97jXDwTb0CQQDgH83NygoS1r57pCw9chzpG/R0' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'aMEiSPhCvz757fj+qT3aGIal2AJ7/2c/gRZvwrWNETZ3XIZOUKqIkXzJLPjBAkEA' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'wnP799W2Y8d4/+VX2pMBkF7lG7sSviHEq1sP2BZtPBRQKSQNvw3scM7XcGh/mxmY' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'yx0qpqfKa8SKbNgI1+4iXQJBAOlg8MJLwkUtrG+p8wf69oCuZsnyv0K6UMDxm6/8' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'cbvfmvODulYFaIahaqHWEZoRo5CLYZ7gN43WHPOrKxdDL78=' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo '-----END RSA PRIVATE KEY-----' >> ${strUserPath}/.ssh/id_rsa && \\\n" .
|
||||
" echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDR0yJsZW5d5LcqteiOtv8d+FFeFFHDPI0VTcTOdMn1iDiIP1ouX3Q2OyNjsBaDbsRJd+sp9I" .
|
||||
"Rq1LKX3zsBcgGZANwm0zduuNEPEU94ajS/uRoejIqY/XkKOpnEF6ZbQ2S7TaE4sWeGLvba7kUFs0QTOO+N+nV2dMbdqZf6C8lazw== " .
|
||||
"user\@pgbackrest-test' > ${strUserPath}/.ssh/authorized_keys && \\\n" .
|
||||
" echo 'Host *' > ${strUserPath}/.ssh/config && \\\n" .
|
||||
" echo ' StrictHostKeyChecking no' >> ${strUserPath}/.ssh/config && \\\n";
|
||||
|
||||
if ($bControlMaster)
|
||||
{
|
||||
$strScript .=
|
||||
" echo ' ControlMaster auto' >> /home/${strUser}/.ssh/config && \\\n" .
|
||||
" echo ' ControlPath /tmp/\%r\@\%h:\%p' >> /home/${strUser}/.ssh/config && \\\n" .
|
||||
" echo ' ControlPersist 30' >> /home/${strUser}/.ssh/config && \\\n";
|
||||
" echo ' ControlMaster auto' >> ${strUserPath}/.ssh/config && \\\n" .
|
||||
" echo ' ControlPath /tmp/\%r\@\%h:\%p' >> ${strUserPath}/.ssh/config && \\\n" .
|
||||
" echo ' ControlPersist 30' >> ${strUserPath}/.ssh/config && \\\n";
|
||||
}
|
||||
|
||||
$strScript .=
|
||||
" chown -R ${strUser}:${strGroup} /home/${strUser}/.ssh && \\\n" .
|
||||
" chmod 700 /home/${strUser}/.ssh && \\\n" .
|
||||
" chmod 600 /home/${strUser}/.ssh/*";
|
||||
" chown -R ${strUser}:${strGroup} ${strUserPath}/.ssh && \\\n" .
|
||||
" chmod 700 ${strUserPath}/.ssh && \\\n" .
|
||||
" chmod 600 ${strUserPath}/.ssh/*";
|
||||
|
||||
return $strScript;
|
||||
}
|
||||
@ -272,6 +324,31 @@ sub s3ServerSetup
|
||||
return $strScript;
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
# Entry point setup
|
||||
####################################################################################################################################
|
||||
sub entryPointSetup
|
||||
{
|
||||
my $strOS = shift;
|
||||
|
||||
my $strScript =
|
||||
"\n\n# Start SSH when container starts\n" .
|
||||
'ENTRYPOINT ';
|
||||
|
||||
my $oVm = vmGet();
|
||||
|
||||
if ($oVm->{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL || $strOS eq VM_U12)
|
||||
{
|
||||
$strScript .= '/usr/sbin/sshd -D';
|
||||
}
|
||||
else
|
||||
{
|
||||
$strScript .= 'service ssh restart && bash';
|
||||
}
|
||||
|
||||
return $strScript;
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
# Build containers
|
||||
####################################################################################################################################
|
||||
@ -285,6 +362,12 @@ sub containerBuild
|
||||
my $strTempPath = $oStorageDocker->pathGet('test/.vagrant/docker');
|
||||
$oStorageDocker->pathCreate($strTempPath, {strMode => '0770', bIgnoreExists => true, bCreateParent => true});
|
||||
|
||||
# Load container definitions from yaml
|
||||
require YAML::XS;
|
||||
YAML::XS->import(qw(Load));
|
||||
|
||||
$hContainerCache = Load(${$oStorageDocker->get($oStorageDocker->pathGet('test/container.yaml'))});
|
||||
|
||||
# Remove old images on force
|
||||
if ($bVmForce)
|
||||
{
|
||||
@ -299,18 +382,6 @@ sub containerBuild
|
||||
imageRemove("${strRegExp}.*");
|
||||
}
|
||||
|
||||
# Create SSH key (if it does not already exist)
|
||||
if (-e "${strTempPath}/id_rsa")
|
||||
{
|
||||
&log(INFO, "SSH key already exists");
|
||||
}
|
||||
else
|
||||
{
|
||||
&log(INFO, "Building SSH keys...");
|
||||
|
||||
executeTest("ssh-keygen -f ${strTempPath}/id_rsa -t rsa -b 1024 -N ''", {bSuppressStdErr => true});
|
||||
}
|
||||
|
||||
# VM Images
|
||||
################################################################################################################################
|
||||
my $oVm = vmGet();
|
||||
@ -327,12 +398,7 @@ sub containerBuild
|
||||
###########################################################################################################################
|
||||
my $strImageParent = "$$oVm{$strOS}{&VM_IMAGE}";
|
||||
my $strImage = "${strOS}-base";
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
my $strCopy =
|
||||
"# Copy root SSH keys\n" .
|
||||
"COPY id_rsa /root/.ssh/id_rsa\n" .
|
||||
"COPY id_rsa.pub /root/.ssh/authorized_keys";
|
||||
my $strCopy = undef;
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
my $strScript = sectionHeader() .
|
||||
@ -345,7 +411,7 @@ sub containerBuild
|
||||
" yum -y update && \\\n" .
|
||||
" yum -y install openssh-server openssh-clients wget sudo python-pip build-essential valgrind git \\\n" .
|
||||
" perl perl-Digest-SHA perl-DBD-Pg perl-XML-LibXML perl-IO-Socket-SSL perl-YAML-LibYAML \\\n" .
|
||||
" gcc make perl-ExtUtils-MakeMaker perl-Test-Simple openssl-devel perl-ExtUtils-Embed";
|
||||
" gcc make perl-ExtUtils-MakeMaker perl-Test-Simple openssl-devel perl-ExtUtils-Embed rpm-build zlib-devel";
|
||||
|
||||
if ($strOS eq VM_CO6)
|
||||
{
|
||||
@ -366,7 +432,8 @@ sub containerBuild
|
||||
" python /root/get-pip.py && \\\n" .
|
||||
" apt-get -y install openssh-server wget sudo python-pip build-essential valgrind git \\\n" .
|
||||
" libdbd-pg-perl libhtml-parser-perl libio-socket-ssl-perl libxml-libxml-perl libssl-dev libperl-dev \\\n" .
|
||||
" libyaml-libyaml-perl tzdata";
|
||||
" libyaml-libyaml-perl tzdata devscripts lintian libxml-checker-perl txt2man debhelper \\\n" .
|
||||
" libppi-html-perl libtemplate-perl libtest-differences-perl zlib1g-dev";
|
||||
|
||||
if ($strOS eq VM_U12)
|
||||
{
|
||||
@ -384,25 +451,6 @@ sub containerBuild
|
||||
" rm -f /etc/ssh/ssh_host_rsa_key* && \\\n" .
|
||||
" ssh-keygen -t rsa -b 1024 -f /etc/ssh/ssh_host_rsa_key";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Fix SSH permissions\n" .
|
||||
" chmod 700 /root/.ssh && \\\n" .
|
||||
" chmod 600 /root/.ssh/*";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Disable strict host key checking (so tests will run without a prior logon)\n" .
|
||||
" echo 'Host *' > /root/.ssh/config && \\\n" .
|
||||
" echo ' StrictHostKeyChecking no' >> /root/.ssh/config";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Create banner to make sure pgBackRest ignores it\n" .
|
||||
" echo '***********************************************' > /etc/issue.net && \\\n" .
|
||||
" echo 'Sample banner to make sure banners are skipped.' >> /etc/issue.net && \\\n" .
|
||||
" echo '' >> /etc/issue.net && \\\n" .
|
||||
" echo 'More banner after a blank line.' >> /etc/issue.net && \\\n" .
|
||||
" echo '***********************************************' >> /etc/issue.net && \\\n" .
|
||||
" echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config";
|
||||
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
|
||||
{
|
||||
$strScript .= sectionHeader() .
|
||||
@ -424,29 +472,6 @@ sub containerBuild
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strScript .= certSetup();
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strScript .= sectionHeader() .
|
||||
"# Create test user\n" .
|
||||
' ' . groupCreate($strOS, TEST_GROUP, TEST_GROUP_ID) . " && \\\n" .
|
||||
' ' . userCreate($strOS, TEST_USER, TEST_USER_ID, TEST_GROUP) . " && \\\n" .
|
||||
' mkdir -m 750 /home/' . TEST_USER . "/test && \\\n" .
|
||||
' chown ' . TEST_USER . ':' . TEST_GROUP . ' /home/' . TEST_USER . "/test";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Configure sudo\n";
|
||||
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL)
|
||||
{
|
||||
$strScript .=
|
||||
" echo '%" . TEST_GROUP . " ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/" . TEST_GROUP . " && \\\n" .
|
||||
" sed -i 's/^Defaults requiretty\$/\\# Defaults requiretty/' /etc/sudoers";
|
||||
}
|
||||
else
|
||||
{
|
||||
$strScript .=
|
||||
" echo '%" . TEST_GROUP . " ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if (!$bDeprecated)
|
||||
{
|
||||
@ -456,22 +481,33 @@ sub containerBuild
|
||||
' ' . userCreate($strOS, POSTGRES_USER, POSTGRES_USER_ID, POSTGRES_GROUP);
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Install Postgresql packages\n";
|
||||
"# Install PostgreSQL packages\n";
|
||||
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL)
|
||||
{
|
||||
if ($strOS eq VM_CO6)
|
||||
{
|
||||
$strScript .=
|
||||
" rpm -ivh http://yum.postgresql.org/9.0/redhat/rhel-6-x86_64/pgdg-centos90-9.0-5.noarch.rpm \\\n" .
|
||||
" rpm -ivh \\\n" .
|
||||
" http://yum.postgresql.org/9.0/redhat/rhel-6-x86_64/pgdg-centos90-9.0-5.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-6.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-8.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm";
|
||||
" http://yum.postgresql.org/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/10/redhat/rhel-6-x86_64/pgdg-centos10-10-2.noarch.rpm";
|
||||
}
|
||||
elsif ($strOS eq VM_CO7)
|
||||
{
|
||||
$strScript .=
|
||||
" rpm -ivh http://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm";
|
||||
" rpm -ivh \\\n" .
|
||||
" http://yum.postgresql.org/9.2/redhat/rhel-7-x86_64/pgdg-centos92-9.2-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm \\\n" .
|
||||
" http://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm";
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -490,7 +526,7 @@ sub containerBuild
|
||||
if (defined($oOS->{&VM_DB}) && @{$oOS->{&VM_DB}} > 0)
|
||||
{
|
||||
$strScript .= sectionHeader() .
|
||||
"# Install Postgresql\n";
|
||||
"# Install PostgreSQL\n";
|
||||
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL)
|
||||
{
|
||||
@ -525,10 +561,7 @@ sub containerBuild
|
||||
$strScript .= sectionHeader() .
|
||||
"# Install AWS CLI\n" .
|
||||
" pip install --upgrade --no-cache-dir pip==9.0.3 && \\\n" .
|
||||
" pip install --upgrade awscli && \\\n" .
|
||||
' sudo -i -u ' . TEST_USER . " aws configure set region us-east-1 && \\\n" .
|
||||
' sudo -i -u ' . TEST_USER . " aws configure set aws_access_key_id accessKey1 && \\\n" .
|
||||
' sudo -i -u ' . TEST_USER . " aws configure set aws_secret_access_key verySecretKey1";
|
||||
" pip install --upgrade awscli";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
@ -537,21 +570,8 @@ sub containerBuild
|
||||
$strScript .= s3ServerSetup($strOS);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strScript .=
|
||||
"\n\n# Start SSH when container starts\n" .
|
||||
'ENTRYPOINT ';
|
||||
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL || $strOS eq VM_U12)
|
||||
{
|
||||
$strScript .= '/usr/sbin/sshd -D';
|
||||
}
|
||||
else
|
||||
{
|
||||
$strScript .= 'service ssh restart && bash';
|
||||
}
|
||||
|
||||
containerWrite($oStorageDocker, $strTempPath, $strOS, 'Base', $strImageParent, $strImage, $strCopy, $strScript, $bVmForce);
|
||||
containerWrite(
|
||||
$oStorageDocker, $strTempPath, $strOS, 'Base', $strImageParent, $strImage, $strCopy, $strScript, $bVmForce);
|
||||
|
||||
# Build image
|
||||
###########################################################################################################################
|
||||
@ -562,14 +582,14 @@ sub containerBuild
|
||||
my $strPkgDevelCover = packageDevelCover($oVm->{$strOS}{&VM_ARCH});
|
||||
my $bPkgDevelCoverBuild = vmCoverage($strOS) && !$oStorageDocker->exists("test/package/${strOS}-${strPkgDevelCover}");
|
||||
|
||||
$strScript = sectionHeader() .
|
||||
"# Create test user\n" .
|
||||
' ' . groupCreate($strOS, TEST_GROUP, TEST_GROUP_ID) . " && \\\n" .
|
||||
' ' . userCreate($strOS, TEST_USER, TEST_USER_ID, TEST_GROUP);
|
||||
|
||||
# Install Perl packages
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
|
||||
{
|
||||
$strScript = sectionHeader() .
|
||||
"# Install package build tools\n" .
|
||||
" apt-get install -y devscripts lintian libxml-checker-perl txt2man debhelper \\\n" .
|
||||
" libpod-coverage-perl libppi-html-perl libtemplate-perl libtest-differences-perl";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Install pgBackRest package source\n" .
|
||||
" git clone https://salsa.debian.org/postgresql/pgbackrest.git /root/package-src";
|
||||
@ -588,10 +608,6 @@ sub containerBuild
|
||||
}
|
||||
else
|
||||
{
|
||||
$strScript = sectionHeader() .
|
||||
"# Install package build tools\n" .
|
||||
" yum install -y rpm-build";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Install pgBackRest package source\n" .
|
||||
" mkdir /root/package-src && \\\n" .
|
||||
@ -603,6 +619,8 @@ sub containerBuild
|
||||
"f=rpm/redhat/master/pgbackrest/master/pgbackrest.spec;hb=refs/heads/master'";
|
||||
}
|
||||
|
||||
$strScript .= entryPointSetup($strOS);
|
||||
|
||||
containerWrite($oStorageDocker, $strTempPath, $strOS, 'Build', $strImageParent, $strImage, $strCopy,$strScript, $bVmForce);
|
||||
|
||||
# Copy Devel::Cover to host so it can be installed in other containers (if it doesn't already exist)
|
||||
@ -627,21 +645,19 @@ sub containerBuild
|
||||
if (!$bDeprecated)
|
||||
{
|
||||
$strImage = "${strOS}-s3-server";
|
||||
$strScript = '';
|
||||
$strCopy = undef;
|
||||
|
||||
if ($strOS ne VM_CO6 && $strOS ne VM_U12)
|
||||
{
|
||||
$strImageParent = containerRepo() . ":${strOS}-base";
|
||||
$strScript = '';
|
||||
$strScript = "\n\nENTRYPOINT npm start --prefix /root/scalitys3";
|
||||
}
|
||||
else
|
||||
{
|
||||
$strImageParent = containerRepo() . ':' . CONTAINER_S3_SERVER_TAG;
|
||||
$strScript = '';
|
||||
}
|
||||
|
||||
$strScript .= "\n\nENTRYPOINT npm start --prefix /root/scalitys3";
|
||||
|
||||
containerWrite(
|
||||
$oStorageDocker, $strTempPath, $strOS, 'S3 Server', $strImageParent, $strImage, $strCopy, $strScript, $bVmForce);
|
||||
}
|
||||
@ -677,6 +693,49 @@ sub containerBuild
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strScript .= sectionHeader() .
|
||||
"# Create banner to make sure pgBackRest ignores it\n" .
|
||||
" echo '***********************************************' > /etc/issue.net && \\\n" .
|
||||
" echo 'Sample banner to make sure banners are skipped.' >> /etc/issue.net && \\\n" .
|
||||
" echo '' >> /etc/issue.net && \\\n" .
|
||||
" echo 'More banner after a blank line.' >> /etc/issue.net && \\\n" .
|
||||
" echo '***********************************************' >> /etc/issue.net && \\\n" .
|
||||
" echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Create test user\n" .
|
||||
' ' . groupCreate($strOS, TEST_GROUP, TEST_GROUP_ID) . " && \\\n" .
|
||||
' ' . userCreate($strOS, TEST_USER, TEST_USER_ID, TEST_GROUP) . " && \\\n" .
|
||||
' mkdir -m 750 /home/' . TEST_USER . "/test && \\\n" .
|
||||
' chown ' . TEST_USER . ':' . TEST_GROUP . ' /home/' . TEST_USER . "/test";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Configure sudo\n";
|
||||
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL)
|
||||
{
|
||||
$strScript .=
|
||||
" echo '%" . TEST_GROUP . " ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/" . TEST_GROUP . " && \\\n" .
|
||||
" sed -i 's/^Defaults requiretty\$/\\# Defaults requiretty/' /etc/sudoers";
|
||||
}
|
||||
else
|
||||
{
|
||||
$strScript .=
|
||||
" echo '%" . TEST_GROUP . " ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers";
|
||||
}
|
||||
|
||||
$strScript .=
|
||||
sshSetup($strOS, TEST_USER, TEST_GROUP, $$oVm{$strOS}{&VM_CONTROL_MASTER});
|
||||
|
||||
if (!$bDeprecated)
|
||||
{
|
||||
$strScript .= sectionHeader() .
|
||||
"# Config AWS CLI\n" .
|
||||
' sudo -i -u ' . TEST_USER . " aws configure set region us-east-1 && \\\n" .
|
||||
' sudo -i -u ' . TEST_USER . " aws configure set aws_access_key_id accessKey1 && \\\n" .
|
||||
' sudo -i -u ' . TEST_USER . " aws configure set aws_secret_access_key verySecretKey1";
|
||||
}
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Create pgbackrest user\n" .
|
||||
' ' . userCreate($strOS, BACKREST_USER, BACKREST_USER_ID, TEST_GROUP);
|
||||
@ -684,13 +743,12 @@ sub containerBuild
|
||||
$strScript .=
|
||||
sshSetup($strOS, BACKREST_USER, TEST_GROUP, $$oVm{$strOS}{&VM_CONTROL_MASTER});
|
||||
|
||||
$strScript .=
|
||||
sshSetup($strOS, TEST_USER, TEST_GROUP, $$oVm{$strOS}{&VM_CONTROL_MASTER});
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Make " . TEST_USER . " home dir readable\n" .
|
||||
' chmod g+r,g+x /home/' . TEST_USER;
|
||||
|
||||
$strScript .= entryPointSetup($strOS);
|
||||
|
||||
containerWrite(
|
||||
$oStorageDocker, $strTempPath, $strOS, 'Test', $strImageParent, $strImage, $strCopy, $strScript, $bVmForce);
|
||||
}
|
||||
|
@ -126,14 +126,19 @@ my $oyVm =
|
||||
[
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
],
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
],
|
||||
},
|
||||
@ -151,6 +156,16 @@ my $oyVm =
|
||||
&VMDEF_DEBUG_INTEGRATION => false,
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
],
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_96,
|
||||
],
|
||||
@ -168,6 +183,20 @@ my $oyVm =
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/x86_64-linux-gnu/perl/5.20.2',
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_84,
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
PG_VERSION_11,
|
||||
],
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_95,
|
||||
],
|
||||
@ -184,7 +213,18 @@ my $oyVm =
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/i386-linux-gnu/perl/5.24.1',
|
||||
|
||||
&VM_DB =>
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
PG_VERSION_11,
|
||||
],
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_96,
|
||||
],
|
||||
@ -202,6 +242,19 @@ my $oyVm =
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/perl/5.14.2',
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_83,
|
||||
PG_VERSION_84,
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
],
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_83,
|
||||
PG_VERSION_84,
|
||||
@ -221,6 +274,20 @@ my $oyVm =
|
||||
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
|
||||
&VMDEF_PERL_ARCH_PATH => '/usr/local/lib/perl/5.18.2',
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_84,
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
PG_VERSION_11,
|
||||
],
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_94,
|
||||
@ -242,8 +309,14 @@ my $oyVm =
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
PG_VERSION_11,
|
||||
],
|
||||
|
||||
&VM_DB_TEST =>
|
||||
@ -268,15 +341,16 @@ my $oyVm =
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
PG_VERSION_11,
|
||||
],
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_10,
|
||||
PG_VERSION_11,
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user