diff --git a/test/lib/pgBackRestTest/Common/ContainerTest.pm b/test/lib/pgBackRestTest/Common/ContainerTest.pm index a03d1272a..5108ede7d 100755 --- a/test/lib/pgBackRestTest/Common/ContainerTest.pm +++ b/test/lib/pgBackRestTest/Common/ContainerTest.pm @@ -546,46 +546,6 @@ sub containerBuild containerWrite( $oStorageDocker, $strTempPath, $strOS, 'Base', $strImageParent, $strImage, $strCopy, $strScript, $bVmForce); - # Build image - ########################################################################################################################### - $strImageParent = containerRepo() . ":${strOS}-base"; - $strImage = "${strOS}-build"; - $strCopy = undef; - - $strScript = sectionHeader() . - "# Create test user\n" . - ' ' . groupCreate($strOS, TEST_GROUP, TEST_GROUP_ID) . " && \\\n" . - ' ' . userCreate($strOS, TEST_USER, TEST_USER_ID, TEST_GROUP); - - # Fetch package source - if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN) - { - $strScript .= sectionHeader() . - "# Install pgBackRest package source\n" . - " git clone https://salsa.debian.org/postgresql/pgbackrest.git /root/package-src"; - } - else - { - # Fetching specific files is fragile but even a shallow clone of the entire pgrpms repo is very expensive. Using - # 'git archive' does not seem to work: access denied or repository not exported: /git/pgrpms.git. - $strScript .= sectionHeader() . - "# Install pgBackRest package source\n" . - " mkdir /root/package-src && \\\n" . - " wget -O /root/package-src/pgbackrest-conf.patch " . - "'https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;" . - "f=rpm/redhat/master/pgbackrest/master/pgbackrest-conf.patch;hb=refs/heads/master' && \\\n" . - " wget -O /root/package-src/pgbackrest-libxmlinclude.patch " . - "'https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;" . - "f=rpm/redhat/master/pgbackrest/master/pgbackrest-libxmlinclude.patch;hb=refs/heads/master' && \\\n" . - " wget -O /root/package-src/pgbackrest.spec " . - "'https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;" . - "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); - # Test image ######################################################################################################################## if (!$bDeprecated) diff --git a/test/test.pl b/test/test.pl index f0634e179..515cac8fb 100755 --- a/test/test.pl +++ b/test/test.pl @@ -785,7 +785,7 @@ eval { executeTest( "docker run -itd -h test-build --name=test-build" . - " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-build", + " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-test", {bSuppressStdErr => true}); } @@ -873,12 +873,17 @@ eval { executeTest( "docker run -itd -h test-build --name=test-build" . - " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-build", + " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-test", {bSuppressStdErr => true}); } $oStorageBackRest->pathCreate($strBuildPath, {bIgnoreExists => true, bCreateParent => true}); + # Clone a copy of the debian package repo + executeTest( + ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . + "bash -c 'git clone https://salsa.debian.org/postgresql/pgbackrest.git /root/package-src 2>&1'"); + executeTest("rsync -r --exclude .vagrant --exclude .git ${strBackRestBase}/ ${strBuildPath}/"); executeTest( ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . @@ -948,10 +953,26 @@ eval { executeTest( "docker run -itd -h test-build --name=test-build" . - " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-build", + " -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-test", {bSuppressStdErr => true}); } + # Fetching specific files is fragile but even a shallow clone of the entire pgrpms repo is very expensive. + # Using 'git archive' does not seem to work: access denied or repository not exported: /git/pgrpms.git. + executeTest( + ($strVm ne VM_NONE ? "docker exec -i test-build " : '') . + "bash -c \"" . + "mkdir /root/package-src && " . + "wget -q -O /root/package-src/pgbackrest-conf.patch " . + "'https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;" . + "f=rpm/redhat/master/pgbackrest/master/pgbackrest-conf.patch;hb=refs/heads/master' && " . + "wget -q -O /root/package-src/pgbackrest-libxmlinclude.patch " . + "'https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;" . + "f=rpm/redhat/master/pgbackrest/master/pgbackrest-libxmlinclude.patch;hb=refs/heads/master' && " . + "wget -q -O /root/package-src/pgbackrest.spec " . + "'https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;" . + "f=rpm/redhat/master/pgbackrest/master/pgbackrest.spec;hb=refs/heads/master'\""); + # Create build directories $oStorageBackRest->pathCreate($strBuildPath, {bIgnoreExists => true, bCreateParent => true}); $oStorageBackRest->pathCreate("${strBuildPath}/SOURCES", {bIgnoreExists => true, bCreateParent => true});