fix e2e tag paging, bump fallback versions

This commit is contained in:
Ron Rennick 2021-08-19 11:02:30 -03:00
parent c364a13c71
commit 36563390bc
3 changed files with 20 additions and 15 deletions

View File

@ -8,6 +8,9 @@
- `downloadZip( fileUrl, downloadPath )` downloads a plugin zip file from a remote location to the provided path.
- Added `getLatestReleaseZipUrl( owner, repository, getPrerelease, perPage )` util function to get the latest release zip from a GitHub repository.
- Added `DEFAULT_TIMEOUT_OVERRIDE` that allows passing in a time in milliseconds to override the default Jest and Puppeteer timeouts.
- Fix latest version tag search paging logic
- Bump PHP fallback version to 7.4.22
- Bump MariahDB fallback version to 10.6.4
# 0.2.2

View File

@ -19,7 +19,7 @@ if [[ $1 ]]; then
if [[ $TRAVIS_PHP_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
export DC_PHP_VERSION=$TRAVIS_PHP_VERSION
else
export DC_PHP_VERSION="7.4.9"
export DC_PHP_VERSION="7.4.22"
fi
if ! [[ $TRAVIS_MARIADB_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
@ -28,7 +28,7 @@ if [[ $1 ]]; then
if [[ $TRAVIS_MARIADB_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then
export DC_MARIADB_VERSION=$TRAVIS_MARIADB_VERSION
else
export DC_MARIADB_VERSION="10.5.5"
export DC_MARIADB_VERSION="10.6.4"
fi
if [[ $1 == 'up' ]]; then

View File

@ -84,21 +84,23 @@ function findLatestVersion( image, nameSearch ) {
// Repeat the requests until we've read as many pages as necessary.
const paginationFn = function ( result ) {
// We can save on unnecessarily loading every page by short-circuiting when
// the number of days between the first recorded version and the
// one from this page becomes excessive.
const lastUpdate = Date.parse( result.latestTag.last_updated );
if ( ! earliestUpdated ) {
earliestUpdated = lastUpdate;
} else {
const daysSinceEarliestUpdate = ( earliestUpdated - lastUpdate ) / ( 1000 * 3600 * 24 );
if ( daysSinceEarliestUpdate > 15 ) {
result.isLastPage = true;
if ( result.latestTag ) {
// We can save on unnecessarily loading every page by short-circuiting when
// the number of days between the first recorded version and the
// one from this page becomes excessive.
const lastUpdate = Date.parse( result.latestTag.last_updated );
if ( ! earliestUpdated ) {
earliestUpdated = lastUpdate;
} else {
const daysSinceEarliestUpdate = ( earliestUpdated - lastUpdate ) / ( 1000 * 3600 * 24 );
if ( daysSinceEarliestUpdate > 15 ) {
result.isLastPage = true;
}
}
}
if ( ! latestVersion || semver.gt( result.latestTag.semver, latestVersion ) ) {
latestVersion = result.latestTag.semver;
if ( ! latestVersion || semver.gt( result.latestTag.semver, latestVersion ) ) {
latestVersion = result.latestTag.semver;
}
}
if ( ! result.isLastPage ) {