Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow packageScope in template compilation and add packageScope in maven datasource #27925

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`modules/datasource/clojure/index falls back to next registry url 1`] =
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://clojars.org/repo",
"releases": [
{
Expand Down Expand Up @@ -53,6 +54,7 @@ exports[`modules/datasource/clojure/index returns releases from custom repositor
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://custom.registry.renovatebot.com",
"releases": [
{
Expand Down Expand Up @@ -80,6 +82,7 @@ exports[`modules/datasource/clojure/index skips registry with invalid XML 1`] =
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://clojars.org/repo",
"releases": [
{
Expand Down Expand Up @@ -107,6 +110,7 @@ exports[`modules/datasource/clojure/index skips registry with invalid metadata s
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://clojars.org/repo",
"releases": [
{
Expand Down
6 changes: 6 additions & 0 deletions lib/modules/datasource/maven/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`modules/datasource/maven/index falls back to next registry url 1`] = `
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://repo.maven.apache.org/maven2",
"releases": [
{
Expand Down Expand Up @@ -53,6 +54,7 @@ exports[`modules/datasource/maven/index removes authentication header after redi
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://frontend_for_private_s3_repository/maven2",
"releases": [
{
Expand Down Expand Up @@ -89,6 +91,7 @@ exports[`modules/datasource/maven/index returns releases 1`] = `
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://repo.maven.apache.org/maven2",
"releases": [
{
Expand Down Expand Up @@ -116,6 +119,7 @@ exports[`modules/datasource/maven/index returns releases from custom repository
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://custom.registry.renovatebot.com",
"releases": [
{
Expand Down Expand Up @@ -143,6 +147,7 @@ exports[`modules/datasource/maven/index skips registry with invalid XML 1`] = `
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://repo.maven.apache.org/maven2",
"releases": [
{
Expand Down Expand Up @@ -170,6 +175,7 @@ exports[`modules/datasource/maven/index skips registry with invalid metadata str
"group": "org.example",
"homepage": "https://package.example.org/about",
"name": "package",
"packageScope": "org.example",
"registryUrl": "https://repo.maven.apache.org/maven2",
"releases": [
{
Expand Down
4 changes: 4 additions & 0 deletions lib/modules/datasource/maven/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ describe('modules/datasource/maven/index', () => {
group: 'org.example',
homepage: 'https://package.example.org/about',
name: 'package',
packageScope: 'org.example',
registryUrl: 'https://repo.maven.apache.org/maven2',
releases: [
{
Expand Down Expand Up @@ -268,6 +269,7 @@ describe('modules/datasource/maven/index', () => {
group: 'org.example',
homepage: 'https://package.example.org/about',
name: 'package',
packageScope: 'org.example',
registryUrl: 'https://repo.maven.apache.org/maven2',
releases: [
{ version: '1.0.0', releaseTimestamp: '2021-02-22T14:43:00.000Z' },
Expand Down Expand Up @@ -484,6 +486,7 @@ describe('modules/datasource/maven/index', () => {
group: 'org.example',
homepage: 'https://package.example.org/about',
name: 'package',
packageScope: 'org.example',
registryUrl:
'artifactregistry://maven.pkg.dev/some-project/some-repository',
releases: [
Expand Down Expand Up @@ -535,6 +538,7 @@ describe('modules/datasource/maven/index', () => {
group: 'org.example',
homepage: 'https://package.example.org/about',
name: 'package',
packageScope: 'org.example',
registryUrl:
'artifactregistry://maven.pkg.dev/some-project/some-repository',
releases: [
Expand Down
5 changes: 5 additions & 0 deletions lib/modules/datasource/maven/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,11 @@ export async function getDependencyInfo(
}
}

const groupId = pomContent.valueWithPath('groupId');
if (groupId) {
result.packageScope = groupId;
}

const parent = pomContent.childNamed('parent');
if (recursionLimit > 0 && parent && (!result.sourceUrl || !result.homepage)) {
// if we found a parent and are missing some information
Expand Down
1 change: 1 addition & 0 deletions lib/modules/datasource/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export interface ReleaseResult {
replacementName?: string;
replacementVersion?: string;
lookupName?: string;
packageScope?: string;
}

export type RegistryStrategy = 'first' | 'hunt' | 'merge';
Expand Down
1 change: 1 addition & 0 deletions lib/util/template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const allowedFields = {
packageFileDir:
'The directory with full path where the packageFile was found',
packageName: 'The full name that was used to look up the dependency',
packageScope: 'The scope of the package name',
lyonlai marked this conversation as resolved.
Show resolved Hide resolved
parentDir:
'The name of the directory that the dependency was found in, without full path',
platform: 'VCS platform in use, e.g. "github", "gitlab", etc.',
Expand Down
1 change: 1 addition & 0 deletions lib/workers/repository/process/lookup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export async function lookupUpdates(
'changelogUrl',
'dependencyUrl',
'lookupName',
'packageScope',
]);

const latestVersion = dependency.tags?.latest;
Expand Down