Skip to content

Commit

Permalink
Merge branch 'main' into fix/host-rules-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh committed Apr 27, 2023
2 parents 056a77d + de3cb95 commit 8ea2539
Show file tree
Hide file tree
Showing 57 changed files with 1,041 additions and 143 deletions.
11 changes: 6 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
@@ -1,13 +1,14 @@
name: Bug report
description: Bug reports require a minimal reproduction and should be preceded by a Discussion first.
labels: ['type:bug', 'status:requirements', 'priority-5-triage']
description: Bug reports are only for maintainers. If you are a Renovate user, create a Discussion instead.
labels:
['type:bug', 'status:requirements', 'priority-5-triage', 'needs-discussion']
body:
- type: markdown
attributes:
value: |
Don't create a Bug Report like this without a GitHub Discussion and [minimal reproduction](https://github.com/renovatebot/renovate/blob/main/docs/development/minimal-reproductions.md) first.
Invalid bug reports waste the time of maintainers and can confuse other users so they will closed, locked and deleted.
You are always welcome to create Discussions and new users should always do that instead.
STOP! Only create a Bug Report if you're a maintainer of Renovate.
If you're a user of Renovate, please create a GitHub Discussion.
Please go back a step and select Discussion instead of Issue.
- type: dropdown
id: how-are-you-running-renovate
Expand Down
4 changes: 2 additions & 2 deletions .github/label-actions.yml
Expand Up @@ -188,10 +188,10 @@
**Please create a GitHub Discussion instead of this issue.**
As this issue has been labeled as `needs-discussion` by a maintainer it is being automatically closed and locked. It will later be deleted to avoid polluting repository searches with duplicate or incorrect content.
We only want Renovate maintainers to create new Issues. If needed, a Renovate maintainer will create an Issue after your Discussion been triaged and confirmed. As a Renovate user, please create a GitHub Discussion in this repo instead.
This doesn't necessarily mean that what you've reported isn't a problem or a reasonable idea, but it does mean that it should be raised as a Discussion first and not an Issue. Please create a Discussion now, assuming you still wish to discuss it.
This Issue will now be closed and locked. We may later batch-delete this issue. This way we keep Issues actionable, and free of duplicates or wrong bug reports.
Thanks, The Renovate team
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -30,7 +30,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2.3.0
uses: github/codeql-action/init@8662eabe0e9f338a07350b7fd050732745f93848 # v2.3.1
with:
languages: javascript

Expand All @@ -40,7 +40,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2.3.0
uses: github/codeql-action/autobuild@8662eabe0e9f338a07350b7fd050732745f93848 # v2.3.1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -54,4 +54,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2.3.0
uses: github/codeql-action/analyze@8662eabe0e9f338a07350b7fd050732745f93848 # v2.3.1
2 changes: 1 addition & 1 deletion docs/development/local-development.md
Expand Up @@ -11,7 +11,7 @@ For example, if you think anything is unclear, or you think something needs to b
You need the following dependencies for local development:

- Git `>=2.33.0`
- Node.js `>=18.12.0`
- Node.js `^18.12.0 || >=20.0.0`
- Yarn `^1.22.5`
- C++ compiler

Expand Down
4 changes: 4 additions & 0 deletions docs/usage/configuration-options.md
Expand Up @@ -2554,6 +2554,10 @@ A list of commands that are executed after Renovate has updated a dependency but

You can use variable templating in your commands if [`allowPostUpgradeCommandTemplating`](https://docs.renovatebot.com/self-hosted-configuration/#allowpostupgradecommandtemplating) is enabled.

<!-- prettier-ignore -->
!!! note
Do not use `git add` in your commands to add new files to be tracked, add them by including them in your [`fileFilters`](https://docs.renovatebot.com/self-hosted-configuration/#filefilters) instead.

### fileFilters

A list of glob-style matchers that determine which files will be included in the final commit made by Renovate.
Expand Down
5 changes: 2 additions & 3 deletions lib/config/massage.ts
@@ -1,5 +1,4 @@
import is from '@sindresorhus/is';
import { clone } from '../util/clone';
import { getOptions } from './options';
import type { PackageRule, RenovateConfig, UpdateType } from './types';

Expand All @@ -17,7 +16,7 @@ export function massageConfig(config: RenovateConfig): RenovateConfig {
}
});
}
const massagedConfig = clone(config);
const massagedConfig = structuredClone(config);
for (const [key, val] of Object.entries(config)) {
if (allowedStrings.includes(key) && is.string(val)) {
massagedConfig[key] = [val];
Expand Down Expand Up @@ -56,7 +55,7 @@ export function massageConfig(config: RenovateConfig): RenovateConfig {
PackageRule
][]) {
if (updateTypes.includes(key)) {
let newRule = clone(rule);
let newRule = structuredClone(rule);
Object.keys(newRule).forEach((newKey) => {
if (!(newKey.startsWith(`match`) || newKey.startsWith('exclude'))) {
delete newRule[newKey];
Expand Down
3 changes: 1 addition & 2 deletions lib/config/presets/index.ts
Expand Up @@ -6,7 +6,6 @@ import {
import { logger } from '../../logger';
import { ExternalHostError } from '../../types/errors/external-host-error';
import * as memCache from '../../util/cache/memory';
import { clone } from '../../util/clone';
import { regEx } from '../../util/regex';
import * as massage from '../massage';
import * as migration from '../migration';
Expand Down Expand Up @@ -274,7 +273,7 @@ export async function resolveConfigPresets(
_ignorePresets?: string[],
existingPresets: string[] = []
): Promise<AllConfig> {
let ignorePresets = clone(_ignorePresets);
let ignorePresets = structuredClone(_ignorePresets);
if (!ignorePresets || ignorePresets.length === 0) {
ignorePresets = inputConfig.ignorePresets ?? [];
}
Expand Down
6 changes: 2 additions & 4 deletions lib/config/utils.ts
@@ -1,5 +1,4 @@
import { logger } from '../logger';
import { clone } from '../util/clone';
import * as options from './options';
import type { RenovateConfig } from './types';

Expand All @@ -11,9 +10,8 @@ export function mergeChildConfig<
if (!child) {
return parent as never;
}
const parentConfig = clone(parent);
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const childConfig = clone(child!);
const parentConfig = structuredClone(parent);
const childConfig = structuredClone(child);
const config: Record<string, any> = { ...parentConfig, ...childConfig };
for (const option of options.getOptions()) {
if (
Expand Down
10 changes: 6 additions & 4 deletions lib/logger/utils.ts
Expand Up @@ -3,7 +3,6 @@ import is from '@sindresorhus/is';
import bunyan from 'bunyan';
import fs from 'fs-extra';
import { RequestError as HttpError } from 'got';
import { clone } from '../util/clone';
import { redactedFields, sanitize } from '../util/sanitize';
import type { BunyanRecord, BunyanStream } from './types';

Expand Down Expand Up @@ -65,7 +64,7 @@ export default function prepareError(err: Error): Record<string, unknown> {
// handle got error
if (err instanceof HttpError) {
const options: Record<string, unknown> = {
headers: clone(err.options.headers),
headers: structuredClone(err.options.headers),
url: err.options.url?.toString(),
hostType: err.options.context.hostType,
};
Expand All @@ -82,8 +81,11 @@ export default function prepareError(err: Error): Record<string, unknown> {
statusCode: err.response?.statusCode,
statusMessage: err.response?.statusMessage,
body:
err.name === 'TimeoutError' ? undefined : clone(err.response.body),
headers: clone(err.response.headers),
// istanbul ignore if: not easily testable
err.name === 'TimeoutError'
? undefined
: structuredClone(err.response.body),
headers: structuredClone(err.response.headers),
httpVersion: err.response.httpVersion,
retryCount: err.response.retryCount,
};
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/datasource/aws-machine-image/index.spec.ts
Expand Up @@ -347,7 +347,7 @@ describe('modules/datasource/aws-machine-image/index', () => {
packageName:
'[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["with one matching image to return that image"]}]',
});
expect(res).toStrictEqual({
expect(res).toEqual({
releases: [
{
isDeprecated: false,
Expand All @@ -366,7 +366,7 @@ describe('modules/datasource/aws-machine-image/index', () => {
packageName:
'[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["with one deprecated matching image to return that image"]}]',
});
expect(res).toStrictEqual({
expect(res).toEqual({
releases: [
{
isDeprecated: true,
Expand All @@ -385,7 +385,7 @@ describe('modules/datasource/aws-machine-image/index', () => {
packageName:
'[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["with 3 matching image to return the newest image"]}]',
});
expect(res).toStrictEqual({
expect(res).toEqual({
releases: [
{
isDeprecated: false,
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/datasource/aws-rds/index.spec.ts
Expand Up @@ -119,7 +119,7 @@ describe('modules/datasource/aws-rds/index', () => {
datasource: AwsRdsDataSource.id,
packageName: '[{"Name":"engine","Values":["mysql"]}]',
});
expect(res).toStrictEqual({
expect(res).toEqual({
releases: [
{
isDeprecated: true,
Expand All @@ -138,7 +138,7 @@ describe('modules/datasource/aws-rds/index', () => {
datasource: AwsRdsDataSource.id,
packageName: '[{"Name":"engine","Values":["mysql"]}]',
});
expect(res).toStrictEqual({
expect(res).toEqual({
releases: [
{
isDeprecated: false,
Expand Down
22 changes: 11 additions & 11 deletions lib/modules/datasource/docker/index.spec.ts
Expand Up @@ -1830,7 +1830,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [
{
Expand Down Expand Up @@ -1881,7 +1881,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [
{
Expand Down Expand Up @@ -1935,7 +1935,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [],
sourceUrl: 'https://github.com/renovatebot/renovate',
Expand All @@ -1962,7 +1962,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [],
});
Expand All @@ -1986,7 +1986,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [],
});
Expand All @@ -2007,7 +2007,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [],
});
Expand Down Expand Up @@ -2048,7 +2048,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [
{
Expand Down Expand Up @@ -2093,7 +2093,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [
{
Expand Down Expand Up @@ -2123,7 +2123,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [],
});
Expand Down Expand Up @@ -2173,7 +2173,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'registry.company.com/node',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://registry.company.com',
releases: [],
});
Expand Down Expand Up @@ -2229,7 +2229,7 @@ describe('modules/datasource/docker/index', () => {
datasource: DockerDatasource.id,
packageName: 'ghcr.io/visualon/drone-git',
});
expect(res).toStrictEqual({
expect(res).toEqual({
registryUrl: 'https://ghcr.io',
sourceUrl: 'https://github.com/visualon/drone-git',
releases: [{ version: '1.0.0' }],
Expand Down
3 changes: 1 addition & 2 deletions lib/modules/datasource/docker/index.ts
@@ -1,4 +1,3 @@
import URL from 'node:url';
import { ECR } from '@aws-sdk/client-ecr';
import type { ECRClientConfig } from '@aws-sdk/client-ecr';
import is from '@sindresorhus/is';
Expand Down Expand Up @@ -911,7 +910,7 @@ export class DockerDatasource extends Datasource {
? `${url}&last=${linkHeader.next.last}`
: null;
} else {
url = linkHeader?.next ? URL.resolve(url, linkHeader.next.url) : null;
url = linkHeader?.next ? new URL(linkHeader.next.url, url).href : null;
}
page += 1;
} while (url && page < 20);
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/jenkins-plugins/index.ts
Expand Up @@ -33,7 +33,7 @@ export class JenkinsPluginsDatasource extends Datasource {
return null;
}

const result = clone(plugin);
const result = structuredClone(plugin);
const versions = await this.getJenkinsPluginVersions();
const releases = versions[packageName];
result.releases = releases ? clone(releases) : [];
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/kubernetes-api/index.spec.ts
Expand Up @@ -16,7 +16,7 @@ describe('modules/datasource/kubernetes-api/index', () => {
packageName: 'CSIStorageCapacity',
});
expect(res).not.toBeNull();
expect(res).toStrictEqual({
expect(res).toEqual({
releases: [
{ version: 'storage.k8s.io/v1beta1' },
{ version: 'storage.k8s.io/v1' },
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/gradle/parser/common.spec.ts
Expand Up @@ -59,7 +59,7 @@ describe('modules/manager/gradle/parser/common', () => {
it('prependNestingDepth', () => {
ctx.tmpNestingDepth = ctx.varTokens = [token];
prependNestingDepth(ctx);
expect(ctx.varTokens).toStrictEqual([token, token]);
expect(ctx.varTokens).toEqual([token, token]);

coalesceVariable(ctx);
expect(ctx).toMatchObject({
Expand Down
3 changes: 1 addition & 2 deletions lib/modules/manager/gradle/parser/common.ts
@@ -1,5 +1,4 @@
import { lexer, parser, query as q } from 'good-enough-parser';
import { clone } from '../../../../util/clone';
import { regEx } from '../../../../util/regex';
import type {
Ctx,
Expand Down Expand Up @@ -52,7 +51,7 @@ export function reduceNestingDepth(ctx: Ctx): Ctx {
}

export function prependNestingDepth(ctx: Ctx): Ctx {
ctx.varTokens = [...clone(ctx.tmpNestingDepth), ...ctx.varTokens];
ctx.varTokens = [...structuredClone(ctx.tmpNestingDepth), ...ctx.varTokens];
return ctx;
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8ea2539

Please sign in to comment.