Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: renovatebot/renovate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 37.424.1
Choose a base ref
...
head repository: renovatebot/renovate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 37.424.2
Choose a head ref
  • 4 commits
  • 5 files changed
  • 2 contributors

Commits on Jul 5, 2024

  1. refactor: Lookup filtering of unstable releases (#30054)

    zharinov authored Jul 5, 2024
    Copy the full SHA
    d88f6a4 View commit details
  2. chore(deps): update actions/download-artifact action to v4.1.8 (#30056)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jul 5, 2024
    Copy the full SHA
    d724f1e View commit details
  3. chore(deps): update actions/upload-artifact action to v4.3.4 (#30057)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jul 5, 2024
    Copy the full SHA
    8f99648 View commit details
  4. fix(deps): update ghcr.io/renovatebot/base-image docker tag to v2.24.1 (

    #30060)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jul 5, 2024
    Copy the full SHA
    f5dfe3f View commit details
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -404,7 +404,7 @@ jobs:
- name: Save coverage artifacts
if: (success() || failure()) && github.event.pull_request.draft != true && matrix.coverage
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: ${{ matrix.upload-artifact-name }}
path: |
@@ -424,7 +424,7 @@ jobs:
show-progress: false

- name: Download coverage reports
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: coverage-*
path: coverage
@@ -460,7 +460,7 @@ jobs:
os: ${{ runner.os }}

- name: Download coverage reports
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: coverage-*
path: coverage
@@ -560,7 +560,7 @@ jobs:
run: pnpm test-e2e:pack

- name: Upload
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: renovate-package
path: renovate-0.0.0-semantic-release.tgz
@@ -591,7 +591,7 @@ jobs:
run: pnpm test:docs

- name: Upload
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: docs
path: tmp/docs/
@@ -620,7 +620,7 @@ jobs:
node-version: ${{ env.NODE_VERSION_TEST }}

- name: Download package
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: renovate-package

2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: 'Upload artifact'
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: SARIF file
path: results.sarif
78 changes: 51 additions & 27 deletions lib/workers/repository/process/lookup/filter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
import { partial } from '../../../../../test/util';
import type { Release } from '../../../../modules/datasource/types';
import * as allVersioning from '../../../../modules/versioning';
import { filterVersions } from './filter';
import type { FilterConfig } from './types';

const versioning = allVersioning.get('semver');

const releases = [
{
version: '1.0.1',
releaseTimestamp: '2021-01-01T00:00:01.000Z',
},
{
version: '1.2.0',
releaseTimestamp: '2021-01-03T00:00:00.000Z',
},
{
version: '2.0.0',
releaseTimestamp: '2021-01-05T00:00:00.000Z',
},
{
version: '2.1.0',
releaseTimestamp: '2021-01-07T00:00:00.000Z',
},
// for coverage
{
version: 'invalid.version',
releaseTimestamp: '2021-01-07T00:00:00.000Z',
},
];

describe('workers/repository/process/lookup/filter', () => {
describe('.filterVersions()', () => {
it('should filter versions allowed by semver syntax when allowedVersions is not valid version, range or pypi syntax', () => {
const releases = [
{
version: '1.0.1',
releaseTimestamp: '2021-01-01T00:00:01.000Z',
},
{
version: '1.2.0',
releaseTimestamp: '2021-01-03T00:00:00.000Z',
},
{
version: '2.0.0',
releaseTimestamp: '2021-01-05T00:00:00.000Z',
},
{
version: '2.1.0',
releaseTimestamp: '2021-01-07T00:00:00.000Z',
},
// for coverage
{
version: 'invalid.version',
releaseTimestamp: '2021-01-07T00:00:00.000Z',
},
] satisfies Release[];

const config = partial<FilterConfig>({
ignoreUnstable: false,
ignoreDeprecated: false,
@@ -41,9 +42,6 @@ describe('workers/repository/process/lookup/filter', () => {
const currentVersion = '1.0.0';
const latestVersion = '2.0.0';

jest.spyOn(versioning, 'isVersion').mockReturnValue(true);
jest.spyOn(versioning, 'isGreaterThan').mockReturnValue(true);

const filteredVersions = filterVersions(
config,
currentVersion,
@@ -57,5 +55,31 @@ describe('workers/repository/process/lookup/filter', () => {
{ version: '2.1.0', releaseTimestamp: '2021-01-07T00:00:00.000Z' },
]);
});

it('allows unstable major upgrades', () => {
const nodeVersioning = allVersioning.get('node');

const releases = [
{ version: '1.0.0-alpha' },
{ version: '1.2.3-beta' },
] satisfies Release[];

const config = partial<FilterConfig>({
ignoreUnstable: true,
ignoreDeprecated: true,
});
const currentVersion = '1.0.0-alpha';
const latestVersion = '1.2.3-beta';

const filteredVersions = filterVersions(
config,
currentVersion,
latestVersion,
releases,
nodeVersioning,
);

expect(filteredVersions).toEqual([{ version: '1.2.3-beta' }]);
});
});
});
30 changes: 19 additions & 11 deletions lib/workers/repository/process/lookup/filter.ts
Original file line number Diff line number Diff line change
@@ -78,7 +78,11 @@ export function filterVersions(
);
filteredReleases = filteredReleases.filter((r) =>
semver.satisfies(
semver.valid(r.version) ? r.version : semver.coerce(r.version)!,
semver.valid(r.version)
? r.version
: /* istanbul ignore next: not reachable, but it's safer to preserve it */ semver.coerce(
r.version,
)!,
allowedVersions,
),
);
@@ -126,24 +130,28 @@ export function filterVersions(
return filteredReleases.filter((r) => isReleaseStable(r, versioning));
}

// if current is unstable then allow unstable in the current major only
// Allow unstable only in current major
const currentMajor = versioning.getMajor(currentVersion);
const currentMinor = versioning.getMinor(currentVersion);
const currentPatch = versioning.getPatch(currentVersion);

return filteredReleases.filter((r) => {
if (isReleaseStable(r, versioning)) {
return true;
}
if (
versioning.getMajor(r.version) !== versioning.getMajor(currentVersion)
) {

const major = versioning.getMajor(r.version);

if (major !== currentMajor) {
return false;
}
// istanbul ignore if: test passes without touching this

if (versioning.allowUnstableMajorUpgrades) {
return true;
}
return (
versioning.getMinor(r.version) === versioning.getMinor(currentVersion) &&
versioning.getPatch(r.version) === versioning.getPatch(currentVersion)
);

const minor = versioning.getMinor(r.version);
const patch = versioning.getPatch(r.version);

return minor === currentMinor && patch === currentPatch;
});
}
6 changes: 3 additions & 3 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,17 +3,17 @@ ARG BASE_IMAGE_TYPE=slim
# --------------------------------------
# slim image
# --------------------------------------
FROM ghcr.io/renovatebot/base-image:2.24.0@sha256:f659e0c7589ef608805887ab0d668f67c4b5d5ce0612e62538b17322a92f928d AS slim-base
FROM ghcr.io/renovatebot/base-image:2.24.1@sha256:3ce9895bce94ae22146e4399d49af8a820ec24ec247252c7a4c08fc10badb143 AS slim-base

# --------------------------------------
# full image
# --------------------------------------
FROM ghcr.io/renovatebot/base-image:2.24.0-full@sha256:323eb53c3a1706e6bf87d4e8ebf5a2d15de4509b75dab613c7b32ddc5826b49a AS full-base
FROM ghcr.io/renovatebot/base-image:2.24.1-full@sha256:a3ea4cb6d8c804113e1c724427abcc96ec9b447e3cae9e31c1b575ff595ef799 AS full-base

# --------------------------------------
# build image
# --------------------------------------
FROM --platform=$BUILDPLATFORM ghcr.io/renovatebot/base-image:2.24.0@sha256:f659e0c7589ef608805887ab0d668f67c4b5d5ce0612e62538b17322a92f928d AS build
FROM --platform=$BUILDPLATFORM ghcr.io/renovatebot/base-image:2.24.1@sha256:3ce9895bce94ae22146e4399d49af8a820ec24ec247252c7a4c08fc10badb143 AS build

ARG TARGETPLATFORM
ARG BUILDPLATFORM