Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins authored Apr 9, 2024
2 parents 3a9fee6 + c848116 commit 1b94e71
Show file tree
Hide file tree
Showing 17 changed files with 443 additions and 271 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/containerbase/devcontainer:10.3.11
FROM ghcr.io/containerbase/devcontainer:10.3.13
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ jobs:
os: ${{ runner.os }}

- name: Lint markdown
uses: DavidAnson/markdownlint-cli2-action@510b996878fc0d1a46c8a04ec86b06dbfba09de7 # v15.0.0
uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16.0.0

- name: Lint fenced code blocks
run: pnpm doc-fence-check
Expand Down Expand Up @@ -377,7 +377,7 @@ jobs:
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 3
if: (success() || failure()) && github.event.pull_request.draft != true
if: (success() || failure()) && github.event_name != 'merge_group' && github.event.pull_request.draft != true
steps:
- name: Checkout code
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
Expand All @@ -392,10 +392,11 @@ jobs:
merge-multiple: true

- name: Codecov
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 # v4.2.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage/lcov
fail_ci_if_error: true
fail_ci_if_error: github.event_name != 'pull_request'
verbose: true

coverage-threshold:
Expand Down Expand Up @@ -606,7 +607,7 @@ jobs:
filter: blob:none # we don't need all blobs, only the full tree

- name: docker-config
uses: containerbase/internal-tools@f0688a5eb6490c252e57e4b0805ad5a57391f28c # v3.0.72
uses: containerbase/internal-tools@4fc221aabfbaa2e0a61bf8b4e9f2dbe4783fd1cc # v3.0.74
with:
command: docker-config

Expand Down
10 changes: 0 additions & 10 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,6 @@ Solutions:

## branchName

<!-- prettier-ignore -->
!!! warning
We strongly recommended that you avoid configuring this field directly.
Use at your own risk.

If you truly need to configure this then it probably means either:

- You are hopefully mistaken, and there's a better approach you should use, so open a new "config help" discussion at the [Renovate discussions tab](https://github.com/renovatebot/renovate/discussions) or
Expand Down Expand Up @@ -473,11 +468,6 @@ If you want Renovate to sign off its commits, add the [`:gitSignOff` preset](./p

## commitMessage

<!-- prettier-ignore -->
!!! warning
We deprecated editing the `commitMessage` directly, and we recommend you stop using this config option.
Instead use config options like `commitMessageAction`, `commitMessageExtra`, and so on, to create the commit message you want.

## commitMessageAction

This is used to alter `commitMessage` and `prTitle` without needing to copy/paste the whole string.
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ To get access to the token a custom Renovate Docker image is needed that include
The Dockerfile to create such an image can look like this:
```Dockerfile
FROM renovate/renovate:37.278.1
FROM renovate/renovate:37.280.0
# Include the "Docker tip" which you can find here https://cloud.google.com/sdk/docs/install
# under "Installation" for "Debian/Ubuntu"
RUN ...
Expand Down
10 changes: 8 additions & 2 deletions lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ const options: RenovateOptions[] = [
description:
'Change this value to override the default Renovate sidecar image.',
type: 'string',
default: 'ghcr.io/containerbase/sidecar:10.3.11',
default: 'ghcr.io/containerbase/sidecar:10.3.13',
globalOnly: true,
},
{
Expand Down Expand Up @@ -2065,6 +2065,8 @@ const options: RenovateOptions[] = [
description: 'Branch name template.',
type: 'string',
default: '{{{branchPrefix}}}{{{additionalBranchPrefix}}}{{{branchTopic}}}',
deprecationMsg:
'We strongly recommended that you avoid configuring this field directly. Please edit `branchPrefix`, `additionalBranchPrefix`, or `branchTopic` instead.',
cli: false,
},
{
Expand All @@ -2088,6 +2090,8 @@ const options: RenovateOptions[] = [
type: 'string',
default:
'{{{commitMessagePrefix}}} {{{commitMessageAction}}} {{{commitMessageTopic}}} {{{commitMessageExtra}}} {{{commitMessageSuffix}}}',
deprecationMsg:
'We deprecated editing the `commitMessage` directly, and we recommend you stop using this config option. Instead use config options like `commitMessageAction`, `commitMessageExtra`, and so on, to create the commit message you want.',
cli: false,
},
{
Expand Down Expand Up @@ -2158,9 +2162,11 @@ const options: RenovateOptions[] = [
{
name: 'prTitle',
description:
'Pull Request title template (deprecated). Inherits from `commitMessage` if null.',
'Pull Request title template. Inherits from `commitMessage` if null.',
type: 'string',
default: null,
deprecationMsg:
'Direct editing of `prTitle` is now deprecated. Instead use config options like `commitMessageAction`, `commitMessageExtra`, and so on, as they will be passed through to `prTitle`.',
cli: false,
},
{
Expand Down
2 changes: 1 addition & 1 deletion lib/config/presets/internal/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export const presets: Record<string, Preset> = {
},
pathSemanticCommitType: {
description:
'Use semanticCommitType `{{arg0}}` for all package files matching path `{{arg1}}`.',
'Use semanticCommitType `{{arg1}}` for all package files matching path `{{arg0}}`.',
packageRules: [
{
matchFileNames: ['{{arg0}}'],
Expand Down
5 changes: 5 additions & 0 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ export interface RenovateOptionBase {
experimentalIssues?: number[];

advancedUse?: boolean;

/**
* This is used to add depreciation message in the docs
*/
deprecationMsg?: string;
}

export interface RenovateArrayOption<
Expand Down
23 changes: 23 additions & 0 deletions lib/modules/manager/npm/extract/common/package-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function extractPackageJson(
resolutions: 'resolutions',
packageManager: 'packageManager',
overrides: 'overrides',
pnpm: 'pnpm',
};

for (const depType of Object.keys(depTypes) as (keyof typeof depTypes)[]) {
Expand Down Expand Up @@ -82,6 +83,28 @@ export function extractPackageJson(
val as unknown as NpmManagerData,
),
);
} else if (depType === 'pnpm' && depName === 'overrides') {
for (const [overridesKey, overridesVal] of Object.entries(
val as unknown as NpmPackageDependency,
)) {
if (is.string(overridesVal)) {
dep = {
depName: overridesKey,
depType: 'overrides',
...extractDependency(depName, overridesKey, overridesVal),
};
setNodeCommitTopic(dep);
dep.prettyDepType = depTypes[depName];
deps.push(dep);
} else if (is.object(overridesVal)) {
deps.push(
...extractOverrideDepsRec(
[overridesKey],
overridesVal as unknown as NpmManagerData,
),
);
}
}
} else {
// TODO: fix type #22198
dep = { ...dep, ...extractDependency(depType, depName, val!) };
Expand Down
106 changes: 106 additions & 0 deletions lib/modules/manager/npm/extract/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { codeBlock } from 'common-tags';
import { Fixtures } from '../../../../../test/fixtures';
import { fs } from '../../../../../test/util';
import { logger } from '../../../../logger';
Expand Down Expand Up @@ -293,6 +294,30 @@ describe('modules/manager/npm/extract/index', () => {
).toBeArrayIncludingOnly(['https://registry.example.com']);
});

it('resolves registry URLs using the package name if set', async () => {
fs.readLocalFile.mockImplementation((fileName): Promise<any> => {
if (fileName === '.yarnrc.yml') {
return Promise.resolve(codeBlock`
npmScopes:
yarnpkg:
npmRegistryServer: https://registry.example.com
`);
}
return Promise.resolve(null);
});
const res = await npmExtract.extractPackageFile(
'{"packageManager": "[email protected]"}',
'package.json',
{},
);
expect(res?.deps).toEqual([
expect.objectContaining({
depName: 'yarn',
registryUrls: ['https://registry.example.com'],
}),
]);
});

it('finds complex yarn workspaces', async () => {
fs.readLocalFile.mockImplementation((fileName): Promise<any> => {
return Promise.resolve(null);
Expand Down Expand Up @@ -869,6 +894,87 @@ describe('modules/manager/npm/extract/index', () => {
],
});
});

it('extracts dependencies from pnpm.overrides', async () => {
const content = `{
"devDependencies": {
"@types/react": "18.0.5"
},
"pnpm": {
"overrides": {
"node": "8.9.2",
"@types/react": "18.0.5",
"baz": {
"node": "8.9.2",
"bar": {
"foo": "1.0.0"
}
},
"foo2": {
".": "1.0.0",
"bar2": "1.0.0"
},
"emptyObject":{}
}
}
}`;
const res = await npmExtract.extractPackageFile(
content,
'package.json',
defaultExtractConfig,
);
expect(res).toMatchObject({
deps: [
{
depType: 'devDependencies',
depName: '@types/react',
currentValue: '18.0.5',
datasource: 'npm',
prettyDepType: 'devDependency',
},
{
depType: 'overrides',
depName: 'node',
currentValue: '8.9.2',
datasource: 'npm',
commitMessageTopic: 'Node.js',
prettyDepType: 'overrides',
},
{
depType: 'overrides',
depName: '@types/react',
currentValue: '18.0.5',
datasource: 'npm',
prettyDepType: 'overrides',
},
{
depName: 'node',
managerData: { parents: ['baz'] },
commitMessageTopic: 'Node.js',
currentValue: '8.9.2',
datasource: 'npm',
},
{
depName: 'foo',
managerData: { parents: ['baz', 'bar'] },
currentValue: '1.0.0',
datasource: 'npm',
},
{
depName: 'foo2',
managerData: { parents: ['foo2'] },
currentValue: '1.0.0',
datasource: 'npm',
},
{
depName: 'bar2',
managerData: { parents: ['foo2'] },
currentValue: '1.0.0',
datasource: 'npm',
},
],
});
});
});

describe('.extractAllPackageFiles()', () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/npm/extract/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export async function extractPackageFile(
for (const dep of res.deps) {
if (dep.depName) {
const registryUrlFromYarnConfig = resolveRegistryUrl(
dep.depName,
dep.packageName ?? dep.depName,
yarnConfig,
);
if (registryUrlFromYarnConfig && dep.datasource === NpmDatasource.id) {
Expand Down
30 changes: 17 additions & 13 deletions lib/modules/versioning/poetry/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ import { api as versioning } from '.';
describe('modules/versioning/poetry/index', () => {
describe('equals', () => {
it.each`
a | b | expected
${'1'} | ${'1'} | ${true}
${'1.0'} | ${'1'} | ${true}
${'1.0.0'} | ${'1'} | ${true}
${'1.9.0'} | ${'1.9'} | ${true}
${'1'} | ${'2'} | ${false}
${'1.9.1'} | ${'1.9'} | ${false}
${'1.9-beta'} | ${'1.9'} | ${false}
${'1.9b0'} | ${'1.9'} | ${false}
${'1.9b0'} | ${'1.9.0-beta.0'} | ${true}
${'1.9-0'} | ${'1.9.0-post.0'} | ${true}
${'1.9.0-post'} | ${'1.9.0-post.0'} | ${true}
${'1.9.0dev0'} | ${'1.9.0-dev.0'} | ${true}
a | b | expected
${'1'} | ${'1'} | ${true}
${'1.0'} | ${'1'} | ${true}
${'1.0.0'} | ${'1'} | ${true}
${'1.9.0'} | ${'1.9'} | ${true}
${'1'} | ${'2'} | ${false}
${'1.9.1'} | ${'1.9'} | ${false}
${'1.9-beta'} | ${'1.9'} | ${false}
${'1.9b0'} | ${'1.9'} | ${false}
${'1.9b0'} | ${'1.9.0-beta.0'} | ${true}
${'1.9.01b01'} | ${'1.9.1-beta.1'} | ${true}
${'1.9-0'} | ${'1.9.0-post.0'} | ${true}
${'1.9.0-post'} | ${'1.9.0-post.0'} | ${true}
${'1.9.01-post'} | ${'1.9.1-post.0'} | ${true}
${'1.9.0dev0'} | ${'1.9.0-dev.0'} | ${true}
${'1.9.01pre'} | ${'1.9.1-pre'} | ${true}
${'1.9.pre'} | ${'1.9.pre'} | ${true}
`('equals("$a", "$b") === $expected', ({ a, b, expected }) => {
expect(versioning.equals(a, b)).toBe(expected);
});
Expand Down
6 changes: 6 additions & 0 deletions lib/modules/versioning/poetry/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,18 @@ export function poetry2semver(

const parts = [releaseParts.map((num) => num.toString()).join('.')];
if (pre !== null) {
// trim leading zeros from valid numbers
pre.number = pre.number.replace(regEx(/^0+(\d+)/), '$1');
parts.push(`-${pre.letter}.${pre.number}`);
}
if (post !== null) {
// trim leading zeros from valid numbers
post.number = post.number.replace(regEx(/^0+(\d+)/), '$1');
parts.push(`-${post.letter}.${post.number}`);
}
if (dev !== null) {
// trim leading zeros from valid numbers
dev.number = dev.number.replace(regEx(/^0+(\d+)/), '$1');
parts.push(`-${dev.letter}.${dev.number}`);
}

Expand Down
6 changes: 6 additions & 0 deletions lib/util/cache/package/file.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ describe('util/cache/package/file', () => {
await set('_test-namespace', 'valid', 1234);
await set('_test-namespace', 'expired', 1234, -5);
await cacache.put(cacheFileName, 'invalid', 'not json');
const expiredDigest = (
await cacache.get(cacheFileName, '_test-namespace-expired')
).integrity;
await cleanup();
const entries = await cacache.ls(cacheFileName);
expect(Object.keys(entries)).toEqual(['_test-namespace-valid']);
await expect(
cacache.get.byDigest(cacheFileName, expiredDigest),
).rejects.toThrow('ENOENT');
});
});
2 changes: 2 additions & 0 deletions lib/util/cache/package/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export async function cleanup(): Promise<void> {
deletedCount += 1;
}
}
logger.debug(`Verifying and cleaning cache: ${cacheFileName}`);
await cacache.verify(cacheFileName);
const durationMs = Math.round(Date.now() - startTime);
logger.debug(
`Deleted ${deletedCount} of ${totalCount} file cached entries in ${durationMs}ms`,
Expand Down
Loading

0 comments on commit 1b94e71

Please sign in to comment.