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: log extended branch summary #22056

Merged
merged 19 commits into from May 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
4 changes: 4 additions & 0 deletions docs/usage/self-hosted-configuration.md
Expand Up @@ -191,6 +191,10 @@ If all projects are managed by Hermit, you can tell Renovate to use the tooling

Tools not on this list fall back to `binarySource=global`.

## branchSummaryExtended

When enabled, will print extra information about the branches and dependency dashboard.

## cacheDir

By default Renovate stores cache data in a temporary directory like `/tmp/renovate/cache`.
Expand Down
8 changes: 8 additions & 0 deletions lib/config/options/index.ts
Expand Up @@ -2634,6 +2634,14 @@ const options: RenovateOptions[] = [
globalOnly: true,
default: [],
},
{
name: 'branchSummaryExtended',
PhilipAbed marked this conversation as resolved.
Show resolved Hide resolved
description: 'Extends the branch summary by printing all',
type: 'boolean',
experimental: true,
globalOnly: true,
default: false,
},
];

export function getOptions(): RenovateOptions[] {
Expand Down
1 change: 1 addition & 0 deletions lib/config/types.ts
Expand Up @@ -262,6 +262,7 @@ export interface RenovateConfig
constraintsFiltering?: ConstraintsFilter;

checkedBranches?: string[];
branchSummaryExtended?: boolean;
}

export interface AllConfig
Expand Down
21 changes: 21 additions & 0 deletions lib/util/cache/repository/types.ts
Expand Up @@ -2,8 +2,10 @@
RepositoryCacheConfig,
RepositoryCacheType,
} from '../../../config/types';
import { UpdateType } from '../../../config/types';

Check failure on line 5 in lib/util/cache/repository/types.ts

View workflow job for this annotation

GitHub Actions / lint

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 5 in lib/util/cache/repository/types.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 5 in lib/util/cache/repository/types.ts

View workflow job for this annotation

GitHub Actions / lint

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 5 in lib/util/cache/repository/types.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
import type { PackageFile } from '../../../modules/manager/types';
import type { RepoInitConfig } from '../../../workers/repository/init/types';
import { PrBlockedBy } from '../../../workers/types';

Check failure on line 8 in lib/util/cache/repository/types.ts

View workflow job for this annotation

GitHub Actions / lint

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 8 in lib/util/cache/repository/types.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 8 in lib/util/cache/repository/types.ts

View workflow job for this annotation

GitHub Actions / lint

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 8 in lib/util/cache/repository/types.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

export interface BaseBranchCache {
sha: string; // branch commit sha
Expand All @@ -17,13 +19,19 @@
currentValue?: string;
datasource?: string;
depName?: string;
depNameLinked?: string;
depType?: string;
displayPending?: string;
fixedVersion?: string;
currentVersion?: string;
packageName?: string;
newDigest?: string;
newValue?: string;
newVersion?: string;
sourceUrl?: string;
packageFile?: string;
remediationNotPossible?: boolean;
updateType?: UpdateType;
}

export interface OnboardingBranchCache {
Expand Down Expand Up @@ -93,6 +101,19 @@
* Object that has PR info
*/
prCache?: PrCache | null;

/**
* Dependency dashboard information
*/
dependencyDashboard?: boolean;
dependencyDashboardApproval?: boolean;
dependencyDashboardPrApproval?: boolean;
dependencyDashboardTitle?: string;
dependencyDashboardFooter?: string;
dependencyDashboardHeader?: string;
prBlockedBy?: PrBlockedBy;
repoProblems?: Set<string>;
result?: string;
}

export interface RepoCacheData {
Expand Down
68 changes: 66 additions & 2 deletions lib/workers/repository/cache.ts
@@ -1,7 +1,8 @@
/* istanbul ignore file */

import { nameFromLevel } from 'bunyan';
import { REPOSITORY_CHANGED } from '../../constants/error-messages';
import { logger } from '../../logger';
import { getProblems, logger } from '../../logger';
import { platform } from '../../modules/platform';
import { scm } from '../../modules/platform/scm';
import { getCache } from '../../util/cache/repository';
Expand All @@ -14,6 +15,7 @@
import { getCachedModifiedResult } from '../../util/git/modified-cache';
import { getCachedPristineResult } from '../../util/git/pristine';
import type { BranchConfig, BranchUpgradeConfig } from '../types';
import { PackageFiles } from './package-files';

Check failure on line 18 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 18 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 18 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

Check failure on line 18 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
import { getPrCache } from './update/pr/pr-cache';

function generateBranchUpgradeCache(
Expand All @@ -22,23 +24,39 @@
const {
datasource,
depName,
depNameLinked,
depType,
displayPending,
packageName,
fixedVersion,
currentVersion,
newVersion,
currentValue,
newValue,
currentDigest,
newDigest,
packageFile,
sourceUrl,
remediationNotPossible,
updateType,
} = upgrade;
const result: BranchUpgradeCache = {
datasource,
depName,
depNameLinked,

Check failure on line 46 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'string | undefined'.

Check failure on line 46 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Type 'unknown' is not assignable to type 'string | undefined'.

Check failure on line 46 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'string | undefined'.

Check failure on line 46 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Type 'unknown' is not assignable to type 'string | undefined'.
depType,
displayPending,

Check failure on line 48 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'string | undefined'.

Check failure on line 48 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Type 'unknown' is not assignable to type 'string | undefined'.

Check failure on line 48 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'string | undefined'.

Check failure on line 48 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Type 'unknown' is not assignable to type 'string | undefined'.
fixedVersion,
currentVersion,
currentValue,
newValue,
newVersion,
currentDigest,
newDigest,
packageFile,
sourceUrl,
remediationNotPossible,

Check failure on line 58 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'boolean | undefined'.

Check failure on line 58 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Type 'unknown' is not assignable to type 'boolean | undefined'.

Check failure on line 58 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'boolean | undefined'.

Check failure on line 58 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Type 'unknown' is not assignable to type 'boolean | undefined'.
updateType,
};
if (packageName) {
result.packageName = packageName;
Expand All @@ -49,7 +67,20 @@
async function generateBranchCache(
branch: BranchConfig
): Promise<BranchCache | null> {
const { baseBranch, branchName } = branch;
const {
baseBranch,
branchName,
dependencyDashboard,
dependencyDashboardApproval,
dependencyDashboardFooter,
dependencyDashboardHeader,
dependencyDashboardPrApproval,
dependencyDashboardTitle,
packageFiles,
prBlockedBy,
repository,
result,
} = branch;
try {
const branchSha = await scm.getBranchCommit(branchName);
const baseBranchSha = await scm.getBranchCommit(baseBranch);
Expand Down Expand Up @@ -79,24 +110,57 @@
baseBranchSha
) ?? undefined;
}

const automerge = !!branch.automerge;
const upgrades: BranchUpgradeCache[] = branch.upgrades
? branch.upgrades.map(generateBranchUpgradeCache)
: [];
const branchFingerprint = branch.branchFingerprint;
const prCache = getPrCache(branchName);

// we minimize to packageFile+warnings because that's what getDepWarningsDashboard needs.
const packageFilesMinimized: Partial<PackageFiles> = {};
for (const [fileType, files] of Object.entries(packageFiles)) {

Check failure on line 123 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

No overload matches this call.

Check failure on line 123 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

No overload matches this call.

Check failure on line 123 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

No overload matches this call.

Check failure on line 123 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

No overload matches this call.
packageFilesMinimized[fileType] = files.map((file) => ({

Check failure on line 124 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Partial<PackageFiles>'.

Check failure on line 124 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Partial<PackageFiles>'.

Check failure on line 124 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Partial<PackageFiles>'.

Check failure on line 124 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Partial<PackageFiles>'.
deps: file.deps.map(({ warnings }) => ({ warnings })),
packageFile: file.packageFile,
}));
}

//get repo problems to log into branch summary
const repoProblems = new Set(
getProblems()
.filter(
(problem) =>
problem.repository === repository && !problem.artifactErrors
)
.map(
(problem) =>
`${nameFromLevel[problem.level].toUpperCase()}: ${problem.msg}`
)
);

return {
automerge,
baseBranchSha,
baseBranch,
branchFingerprint,
branchName,
dependencyDashboard,
dependencyDashboardApproval,
dependencyDashboardFooter,
dependencyDashboardHeader,
dependencyDashboardPrApproval,

Check failure on line 153 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'boolean | undefined'.

Check failure on line 153 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Type 'unknown' is not assignable to type 'boolean | undefined'.

Check failure on line 153 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'unknown' is not assignable to type 'boolean | undefined'.

Check failure on line 153 in lib/workers/repository/cache.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Type 'unknown' is not assignable to type 'boolean | undefined'.
dependencyDashboardTitle,
isBehindBase,
isConflicted,
isModified,
prBlockedBy,
pristine,
prCache,
prNo,
repoProblems,
result,
sha: branchSha,
upgrades,
};
Expand Down