Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM ghcr.io/containerbase/devcontainer:13.8.17

# https://github.com/pnpm/pnpm/issues/8971
# renovate: datasource=npm
RUN install-tool pnpm 10.8.1
RUN install-tool pnpm 10.9.0
8 changes: 8 additions & 0 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ Read the docs for your platform for details on syntax and allowed file locations
- [GitLab, Code Owners](https://docs.gitlab.com/ee/user/project/codeowners/)
- [Bitbucket, Set up and use code owners](https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-code-owners/)

<!-- prettier-ignore -->
!!! note
GitLab `CODEOWNERS` files with default owners are _not_ supported. See [#29202](https://github.com/renovatebot/renovate/issues/29202).

## assigneesSampleSize

If configured, Renovate will take a random sample of given size from assignees and assign them only, instead of assigning the entire list of `assignees` you have configured.
Expand Down Expand Up @@ -3970,6 +3974,10 @@ Read the docs for your platform for details on syntax and allowed file locations
- [GitLab, Code Owners](https://docs.gitlab.com/ee/user/project/codeowners/)
- [Bitbucket, Set up and use code owners](https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-code-owners/)

<!-- prettier-ignore -->
!!! note
GitLab `CODEOWNERS` files with default owners are _not_ supported. See [#29202](https://github.com/renovatebot/renovate/issues/29202).

## reviewersSampleSize

## rollback
Expand Down
13 changes: 13 additions & 0 deletions lib/data/replacements.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"replacements:eslint-plugin-vitest-to-scoped",
"replacements:fakerjs-to-scoped",
"replacements:fastify-to-scoped",
"replacements:gradle-wrapper-validation-action",
"replacements:hapi-to-scoped",
"replacements:jade-to-pug",
"replacements:joi-to-scoped",
Expand Down Expand Up @@ -670,6 +671,18 @@
}
]
},
"gradle-wrapper-validation-action": {
"description": "gradle/wrapper-validation-action got renamed to gradle/actions/wrapper-validation",
"packageRules": [
{
"matchCurrentVersion": "/^3/",
"matchDatasources": ["github-actions"],
"matchPackageNames": ["gradle/wrapper-validation-action"],
"replacementName": "gradle/actions/wrapper-validation",
"replacementVersion": "3.5.0"
}
]
},
"hapi-to-scoped": {
"description": "`hapi` became scoped.",
"packageRules": [
Expand Down
51 changes: 30 additions & 21 deletions lib/modules/manager/buildpacks/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { logger } from '../../../logger';
import { regEx } from '../../../util/regex';
import { BuildpacksRegistryDatasource } from '../../datasource/buildpacks-registry';
import { isVersion } from '../../versioning/semver';
import { getDep } from '../dockerfile/extract';
import { getDep as getDockerDep } from '../dockerfile/extract';
import type {
ExtractConfig,
PackageDependency,
Expand All @@ -16,18 +16,18 @@ import {
isBuildpackByURI,
} from './schema';

const dockerPrefix = regEx(/^docker:\/?\//);
export const DOCKER_PREFIX = regEx(/^docker:\/?\//);
const dockerRef = regEx(
/^((?:[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)(?::\d{2,5}\/)?)?[a-z\d]+((\.|_|__|-+)[a-z\d]+)*(\/[a-z\d]+((\.|_|__|-+)[a-z\d]+)*)*(?::(\w[\w.-]{0,127})(?:@sha256:[A-Fa-f\d]{32,})?|@sha256:[A-Fa-f\d]{32,})$/,
);

function isDockerRef(ref: string): boolean {
export function isDockerRef(ref: string): boolean {
if (ref.startsWith('docker:/') || dockerRef.test(ref)) {
return true;
}
return false;
}
const buildpackRegistryPrefix = 'urn:cnb:registry:';
export const BUILDPACK_REGISTRY_PREFIX = 'urn:cnb:registry:';
const buildpackRegistryId = regEx(
/^[a-z0-9\-.]+\/[a-z0-9\-.]+(?:@(?<version>.+))?$/,
);
Expand All @@ -42,8 +42,10 @@ function isBuildpackRegistryId(ref: string): boolean {
return isVersion(bpRegistryMatch.groups.version);
}

function isBuildpackRegistryRef(ref: string): boolean {
return isBuildpackRegistryId(ref) || ref.startsWith(buildpackRegistryPrefix);
export function isBuildpackRegistryRef(ref: string): boolean {
return (
isBuildpackRegistryId(ref) || ref.startsWith(BUILDPACK_REGISTRY_PREFIX)
);
}

function parseProjectToml(
Expand Down Expand Up @@ -79,8 +81,8 @@ export function extractPackageFile(
descriptor.io?.buildpacks?.builder &&
isDockerRef(descriptor.io.buildpacks.builder)
) {
const dep = getDep(
descriptor.io.buildpacks.builder.replace(dockerPrefix, ''),
const dep = getDockerDep(
descriptor.io.buildpacks.builder.replace(DOCKER_PREFIX, ''),
true,
config.registryAliases,
);
Expand All @@ -102,8 +104,8 @@ export function extractPackageFile(
) {
for (const group of descriptor.io.buildpacks.group) {
if (isBuildpackByURI(group) && isDockerRef(group.uri)) {
const dep = getDep(
group.uri.replace(dockerPrefix, ''),
const dep = getDockerDep(
group.uri.replace(DOCKER_PREFIX, ''),
true,
config.registryAliases,
);
Expand All @@ -118,17 +120,8 @@ export function extractPackageFile(

deps.push(dep);
} else if (isBuildpackByURI(group) && isBuildpackRegistryRef(group.uri)) {
const dependency = group.uri.replace(buildpackRegistryPrefix, '');

if (dependency.includes('@')) {
const version = dependency.split('@')[1];
const dep: PackageDependency = {
datasource: BuildpacksRegistryDatasource.id,
currentValue: version,
packageName: dependency.split('@')[0],
autoReplaceStringTemplate:
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
};
const dep = getDep(group.uri.replace(BUILDPACK_REGISTRY_PREFIX, ''));
if (dep) {
deps.push(dep);
}
} else if (isBuildpackByName(group)) {
Expand All @@ -151,3 +144,19 @@ export function extractPackageFile(
}
return { deps };
}

export function getDep(currentFrom: string): PackageDependency | null {
if (currentFrom.includes('@')) {
const dep: PackageDependency = {
datasource: BuildpacksRegistryDatasource.id,
packageName: currentFrom.split('@')[0],
autoReplaceStringTemplate:
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
};
const version = currentFrom.split('@')[1];
dep.currentValue = version;
return dep;
}

return null;
}
21 changes: 15 additions & 6 deletions lib/modules/manager/maven/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ const profileSettingsContent = Fixtures.get('profile.settings.xml');
describe('modules/manager/maven/extract', () => {
describe('extractPackage', () => {
it('returns null for invalid XML', () => {
expect(extractPackage('', 'some-file')).toBeNull();
expect(extractPackage('invalid xml content', 'some-file')).toBeNull();
expect(extractPackage('<foobar></foobar>', 'some-file')).toBeNull();
expect(extractPackage('<project></project>', 'some-file')).toBeNull();
expect(extractPackage('', 'some-file', {})).toBeNull();
expect(extractPackage('invalid xml content', 'some-file', {})).toBeNull();
expect(extractPackage('<foobar></foobar>', 'some-file', {})).toBeNull();
expect(extractPackage('<project></project>', 'some-file', {})).toBeNull();
});

it('extract dependencies from any XML position', () => {
const res = extractPackage(simpleContent, 'some-file');
const res = extractPackage(simpleContent, 'some-file', {});
expect(res).toMatchObject({
datasource: 'maven',
deps: [
Expand Down Expand Up @@ -238,14 +238,19 @@ describe('modules/manager/maven/extract', () => {
extractPackage(
'<?xml version="1.0" encoding="UTF-8"?> \r\n',
'some-file',
{},
);
expect(logger.logger.warn).toHaveBeenCalledWith(
'Your pom.xml contains windows line endings. This is not supported and may result in parsing issues.',
);
});

it('tries minimum manifests', () => {
const res = extractPackage(Fixtures.get('minimum.pom.xml'), 'some-file');
const res = extractPackage(
Fixtures.get('minimum.pom.xml'),
'some-file',
{},
);
expect(res).toEqual({
datasource: 'maven',
deps: [],
Expand All @@ -259,6 +264,7 @@ describe('modules/manager/maven/extract', () => {
const res = extractPackage(
Fixtures.get(`minimum_snapshot.pom.xml`),
'some-file',
{},
);
expect(res).toEqual({
datasource: 'maven',
Expand All @@ -275,6 +281,7 @@ describe('modules/manager/maven/extract', () => {
const packages = extractPackage(
Fixtures.get('recursive_props.pom.xml'),
'some-file',
{},
);
const [{ deps }] = resolveParents([packages!]);
expect(deps).toMatchObject([
Expand All @@ -289,6 +296,7 @@ describe('modules/manager/maven/extract', () => {
const packages = extractPackage(
Fixtures.get('multiple_usages_props.pom.xml'),
'some-file',
{},
);
const [{ deps }] = resolveParents([packages!]);
expect(deps).toMatchObject([
Expand All @@ -303,6 +311,7 @@ describe('modules/manager/maven/extract', () => {
const packages = extractPackage(
Fixtures.get('infinite_recursive_props.pom.xml'),
'some-file',
{},
);
const [{ deps }] = resolveParents([packages!]);
expect(deps).toMatchObject([
Expand Down
15 changes: 11 additions & 4 deletions lib/modules/manager/maven/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ function applyPropsInternal(
return substr;
});

const depName = replaceAll(dep.depName!);
let depName = dep.depName;
if (dep.depName) {
depName = replaceAll(dep.depName);
}

const registryUrls = dep.registryUrls!.map((url) => replaceAll(url));

let fileReplacePosition = dep.fileReplacePosition;
Expand Down Expand Up @@ -293,6 +297,7 @@ interface MavenInterimPackageFile extends PackageFile {
export function extractPackage(
rawContent: string,
packageFile: string,
_config: ExtractConfig,
): PackageFile | null {
if (!rawContent) {
return null;
Expand Down Expand Up @@ -504,7 +509,9 @@ function cleanResult(packageFiles: MavenInterimPackageFile[]): PackageFile[] {
packageFile.deps.forEach((dep) => {
delete dep.propSource;
//Add Registry From SuperPom
dep.registryUrls!.push(MAVEN_REPO);
if (dep.datasource === MavenDatasource.id) {
dep.registryUrls!.push(MAVEN_REPO);
}
});
});
return packageFiles;
Expand Down Expand Up @@ -535,7 +542,7 @@ export function extractExtensions(
}

export async function extractAllPackageFiles(
_config: ExtractConfig,
config: ExtractConfig,
packageFiles: string[],
): Promise<PackageFile[]> {
const packages: PackageFile[] = [];
Expand Down Expand Up @@ -564,7 +571,7 @@ export async function extractAllPackageFiles(
logger.trace({ packageFile }, 'can not read extensions');
}
} else {
const pkg = extractPackage(content, packageFile);
const pkg = extractPackage(content, packageFile, config);
if (pkg) {
packages.push(pkg);
} else {
Expand Down
21 changes: 11 additions & 10 deletions lib/modules/manager/maven/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ describe('modules/manager/maven/index', () => {
it('should update an existing dependency', () => {
const newValue = '9.9.9.9-final';

const { deps } = extractPackage(simpleContent, 'some-file')!;
const { deps } = extractPackage(simpleContent, 'some-file', {})!;
const dep = selectDep(deps);
const updatedContent = updateDependency({
fileContent: simpleContent,
upgrade: { ...dep, newValue },
})!;

const updatedDep = selectDep(
extractPackage(updatedContent, 'some-file')!.deps,
extractPackage(updatedContent, 'some-file', {})!.deps,
);
expect(updatedDep?.currentValue).toEqual(newValue);
});
Expand All @@ -42,8 +42,8 @@ describe('modules/manager/maven/index', () => {
const newValue = '9.9.9.9-final';

const packages = resolveParents([
extractPackage(parentPomContent, 'parent.pom.xml')!,
extractPackage(childPomContent, 'child.pom.xml')!,
extractPackage(parentPomContent, 'parent.pom.xml', {})!,
extractPackage(childPomContent, 'child.pom.xml', {})!,
]);
const [{ deps }] = packages;
const dep = selectDep(deps, 'org.example:quux');
Expand All @@ -53,16 +53,16 @@ describe('modules/manager/maven/index', () => {
})!;

const [updatedPkg] = resolveParents([
extractPackage(updatedContent, 'parent.pom.xml')!,
extractPackage(childPomContent, 'child.pom.xml')!,
extractPackage(updatedContent, 'parent.pom.xml', {})!,
extractPackage(childPomContent, 'child.pom.xml', {})!,
]);
const updatedDep = selectDep(updatedPkg.deps, 'org.example:quux');
expect(updatedDep?.registryUrls).toContain('http://example.com/');
expect(updatedDep?.currentValue).toEqual(newValue);
});

it('should not touch content if new and old versions are equal', () => {
const { deps } = extractPackage(simpleContent, 'some-file')!;
const { deps } = extractPackage(simpleContent, 'some-file', {})!;
const dep = selectDep(deps);
const updatedContent = updateDependency({
fileContent: simpleContent,
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('modules/manager/maven/index', () => {
});

it('should return null if current versions in content and upgrade are not same', () => {
const { deps } = extractPackage(simpleContent, 'some-file')!;
const { deps } = extractPackage(simpleContent, 'some-file', {})!;
const dep = selectDep(deps);

const updatedContent = updateDependency({
Expand All @@ -144,14 +144,15 @@ describe('modules/manager/maven/index', () => {
const newValue = '[1.2.3]';
const select = (depSet: PackageFileContent) =>
selectDep(depSet.deps, 'org.example:hard-range');
const oldContent = extractPackage(simpleContent, 'some-file');
const oldContent = extractPackage(simpleContent, 'some-file', {});
const dep = select(oldContent!);
const newContent = extractPackage(
updateDependency({
fileContent: simpleContent,
upgrade: { ...dep, newValue },
})!,
'some-file',
{},
);
const newDep = select(newContent!);
expect(newDep?.currentValue).toEqual(newValue);
Expand All @@ -160,7 +161,7 @@ describe('modules/manager/maven/index', () => {
it('should preserve ranges', () => {
const select = (depSet: PackageFileContent) =>
depSet?.deps ? selectDep(depSet.deps, 'org.example:hard-range') : null;
const oldContent = extractPackage(simpleContent, 'some-file');
const oldContent = extractPackage(simpleContent, 'some-file', {});
const dep = select(oldContent!);
expect(dep).not.toBeNull();

Expand Down
4 changes: 0 additions & 4 deletions lib/modules/platform/gitlab/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,12 @@ We refer to personal access tokens, project access tokens and group access token
For real runs, give the access token these scopes:

- `api`
- `write_repository`
- `read_registry` (only if Renovate needs to access the [GitLab Container registry](https://docs.gitlab.com/ee/user/packages/container_registry/))

#### Permissions for access tokens on dry runs

For dry runs, give the access token these scopes:

- `read_api`
- `read_repository`
- `read_registry` (only if Renovate needs to access the [GitLab Container registry](https://docs.gitlab.com/ee/user/packages/container_registry/))

#### Letting Renovate use your access token

Expand Down
Loading
Loading