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

Conversation

PhilipAbed
Copy link
Collaborator

Changes

Context

Closes #22013

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@PhilipAbed PhilipAbed closed this May 9, 2023
@PhilipAbed PhilipAbed reopened this May 9, 2023
@PhilipAbed PhilipAbed marked this pull request as draft May 9, 2023 10:57
lib/config/options/index.ts Outdated Show resolved Hide resolved
@PhilipAbed PhilipAbed marked this pull request as ready for review May 9, 2023 11:56
@rarkins
Copy link
Collaborator

rarkins commented May 10, 2023

You can see here the difference:

DEBUG: Branch summary (repository=renovate-tests/nvm22)
       "cacheModified": true,
       "baseBranches": [{"branchName": "main", "sha": "a13b09f204bc48c8eab925730e88b33ba908a676"}],
       "branches": [
         {
           "automerge": false,
           "baseBranch": "main",
           "baseBranchSha": "a13b09f204bc48c8eab925730e88b33ba908a676",
           "branchName": "renovate/node-16.x",
           "branchSha": "0f89057f27e20b870a6e1130b99d161045925313",
           "isModified": false,
           "isPristine": true
         },
         {
           "automerge": false,
           "baseBranch": "main",
           "baseBranchSha": "a13b09f204bc48c8eab925730e88b33ba908a676",
           "branchName": "renovate/node-18.x",
           "branchSha": "fbe15491d28b2d2ed7fd72cc59bdca588cca58f5",
           "isModified": false,
           "isPristine": true
         }
       ],
       "defaultBranch": "main",
       "inactiveBranches": []
DEBUG: Branches info extended (repository=renovate-tests/nvm22)
       "branches": [
         {
           "automerge": false,
           "baseBranchSha": "a13b09f204bc48c8eab925730e88b33ba908a676",
           "baseBranch": "main",
           "branchFingerprint": "baa379f2e0fb2242feeaf5726408d249e01fb8e45462ef2c0da989d838c9904c6804b4db689d4e34178d109f4309835c8876b0f9d303a5c8a8b774a5f93e82e6",
           "branchName": "renovate/node-16.x",
           "dependencyDashboard": false,
           "dependencyDashboardApproval": false,
           "dependencyDashboardFooter": null,
           "dependencyDashboardHeader": "This issue lists Renovate updates and detected dependencies. Read the [Dependency Dashboard](https://docs.renovatebot.com/key-concepts/dashboard/) docs to learn more.",
           "dependencyDashboardPrApproval": false,
           "dependencyDashboardTitle": "Dependency Dashboard",
           "isBehindBase": false,
           "isConflicted": false,
           "isModified": false,
           "pristine": true,
           "prCache": {
             "fingerprint": "c6a62af14de1125814ce63d750e33ace781d9b2c8fcbfb645581261dfd06447a8de5ceaab5026efea09adb8d712220e167daea67fd6897ce741bfd74838bee30",
             "lastEdited": "2023-05-10T05:51:49.260Z"
           },
           "prNo": 1,
           "repoProblems": {},
           "result": "done",
           "sha": "0f89057f27e20b870a6e1130b99d161045925313",
           "upgrades": [
             {
               "datasource": "github-tags",
               "depName": "node",
               "depNameLinked": "[node](https://github.com/nodejs/node)",
               "displayPending": "",
               "fixedVersion": "16.14.0",
               "currentVersion": "16.14.0",
               "currentValue": "16.14.0",
               "newValue": "16.20.0",
               "newVersion": "v16.20.0",
               "packageFile": ".nvmrc",
               "sourceUrl": "https://github.com/nodejs/node",
               "updateType": "minor",
               "packageName": "nodejs/node"
             }
           ],
           "packageFiles": {
             "nvm": [{"deps": [{"warnings": []}], "packageFile": ".nvmrc"}]
           }
         },
         {
           "automerge": false,
           "baseBranchSha": "a13b09f204bc48c8eab925730e88b33ba908a676",
           "baseBranch": "main",
           "branchFingerprint": "87436a64c5de95619daaf312e76735ed033ce075dbc4ec6be524fd5a8f9685aa84b338d4a2c1ebec48e81d5cc626ffc5db5ea702a2ef32f4603d89ba962ab1b8",
           "branchName": "renovate/node-18.x",
           "dependencyDashboard": false,
           "dependencyDashboardApproval": false,
           "dependencyDashboardFooter": null,
           "dependencyDashboardHeader": "This issue lists Renovate updates and detected dependencies. Read the [Dependency Dashboard](https://docs.renovatebot.com/key-concepts/dashboard/) docs to learn more.",
           "dependencyDashboardPrApproval": false,
           "dependencyDashboardTitle": "Dependency Dashboard",
           "isBehindBase": false,
           "isConflicted": false,
           "isModified": false,
           "pristine": true,
           "prCache": {
             "fingerprint": "17239f05d9d8f1e1cbfb29805017c36f96d801a151dba7b6b7e972917be5988a8808d37a6c3989cf9061ad668c46381d7b830e0a27069661fb33aee7949d377f",
             "lastEdited": "2023-05-10T05:51:59.328Z"
           },
           "prNo": 4,
           "repoProblems": {},
           "result": "done",
           "sha": "fbe15491d28b2d2ed7fd72cc59bdca588cca58f5",
           "upgrades": [
             {
               "datasource": "github-tags",
               "depName": "node",
               "depNameLinked": "[node](https://github.com/nodejs/node)",
               "displayPending": "",
               "fixedVersion": "16.14.0",
               "currentVersion": "16.14.0",
               "currentValue": "16.14.0",
               "newValue": "18.16.0",
               "newVersion": "v18.16.0",
               "packageFile": ".nvmrc",
               "sourceUrl": "https://github.com/nodejs/node",
               "updateType": "major",
               "packageName": "nodejs/node"
             }
           ],
           "packageFiles": {
             "nvm": [{"deps": [{"warnings": []}], "packageFile": ".nvmrc"}]
           }
         }
       ]

@rarkins
Copy link
Collaborator

rarkins commented May 10, 2023

Seems like there's now too much info here

@PhilipAbed
Copy link
Collaborator Author

would you prefer if i print the dependency dashboard sections instead in json?

export interface Dashboard {
  awaitingSchedule: Partial<BranchConfig>[];
  prCreationApprovalRequired: Partial<BranchConfig>[];
  editedOrBlocked: Partial<BranchConfig>[];
  errored: Partial<BranchConfig>[];
  ignoredOrBlocked: Partial<BranchConfig>[];
  open: Partial<BranchConfig>[];
  otherBranches: Partial<BranchConfig>[];
  pendingApprovals: Partial<BranchConfig>[];
  pendingAutomerge: Partial<BranchConfig>[];
  pendingStatusChecks: Partial<BranchConfig>[];
  rateLimited: Partial<BranchConfig>[];
  repositoryProblems?: Set<string>;
  header: string;
  warn?: string;
}

@PhilipAbed PhilipAbed requested a review from rarkins May 10, 2023 10:25
@rarkins
Copy link
Collaborator

rarkins commented May 10, 2023

No, I'd like for the branches to be logged with the minimal data necessary to construct the dashboard

@PhilipAbed
Copy link
Collaborator Author

that's because i mixed it up with the Branch Summary,
so all these are not necessary and can be removed from my log

cacheModified
automerge
isModified
isBehindBase
isModified
branchFingerprint
isPristine
DefaultBranch
prCache

@PhilipAbed

This comment was marked as outdated.

@PhilipAbed

This comment was marked as outdated.

@viceice viceice added the auto:format-code Issue or Discussion needs logs or code formatting using markdown label May 10, 2023
@PhilipAbed PhilipAbed removed the auto:format-code Issue or Discussion needs logs or code formatting using markdown label May 11, 2023
@PhilipAbed PhilipAbed marked this pull request as draft May 14, 2023 12:50
@PhilipAbed
Copy link
Collaborator Author

PhilipAbed commented May 14, 2023

DEBUG: Branches info extended (repository=StinkyLord/RenovateTutorial1)
       "branchesInformation": [
         {
           "branchName": "renovate/all",
           "prNo": 7,
           "prTitle": "Update all dependencies",
           "result": "done",
           "upgrades": [
             {
               "datasource": "npm",
               "depName": "@date-io/date-fns",
               "displayPending": "",
               "fixedVersion": "2.10.0",
               "currentVersion": "2.10.0",
               "currentValue": "2.10.0",
               "newValue": "2.16.0",
               "newVersion": "2.16.0",
               "packageFile": "package.json",
               "updateType": "minor",
               "packageName": "@date-io/date-fns"
             },
             {
               "datasource": "npm",
               "depName": "@date-io/moment",
               "displayPending": "",
               "fixedVersion": "2.10.0",
               "currentVersion": "2.10.0",
               "currentValue": "2.10.0",
               "newValue": "2.16.1",
               "newVersion": "2.16.1",
               "packageFile": "package.json",
               "updateType": "minor",
               "packageName": "@date-io/moment"
             },
             {
               "datasource": "npm",
               "depName": "lodash",
               "displayPending": "",
               "fixedVersion": "4.17.20",
               "currentVersion": "4.17.20",
               "currentValue": "4.17.20",
               "newValue": "4.17.21",
               "newVersion": "4.17.21",
               "packageFile": "package.json",
               "updateType": "patch",
               "packageName": "lodash"
             },
             {
               "datasource": "docker",
               "depName": "php",
               "displayPending": "",
               "fixedVersion": "8.0-fpm",
               "currentVersion": "8.0",
               "currentValue": "8.0-fpm",
               "newValue": "8.2-fpm",
               "newVersion": "8.2",
               "packageFile": "Dockerfile",
               "updateType": "minor",
               "packageName": "php"
             }
           ]
         },
         {
           "branchName": "renovate/major-all",
           "prNo": 8,
           "prTitle": "Update dependency commander to v10",
           "result": "done",
           "upgrades": [
             {
               "datasource": "npm",
               "depName": "commander",
               "displayPending": "",
               "fixedVersion": "2.20.3",
               "currentVersion": "2.20.3",
               "currentValue": "^2.20.0",
               "newValue": "^10.0.0",
               "newVersion": "10.0.1",
               "packageFile": "package.json",
               "updateType": "major",
               "packageName": "commander"
             }
           ]
         }
       ],

@rarkins
Copy link
Collaborator

rarkins commented May 14, 2023

  1. Are repo problems not printed/summarized anywhere else before now?
  2. Why is it needed to have packageFilesToPrint and not just rely on packageFiles with updates?

@PhilipAbed
Copy link
Collaborator Author

  1. no, it's just filtering specific errors for the dashboard.
    i've seen a log for it right before we exit too i think
    but it isnt filtered, not sure we can use it see:
    const loggerErrors = getProblems().filter((p) => p.level >= ERROR);
    if (loggerErrors.length) {
    logger.info(
    { loggerErrors },
    'Renovate is exiting with a non-zero code due to the following logged errors'
    );
    return 1;
  2. yes packageFiles with Updates has all the required information! ill delete my extra code.

@rarkins
Copy link
Collaborator

rarkins commented May 14, 2023

  1. This should be logged separately per repo per run, if not already - not part of branch summary

@PhilipAbed
Copy link
Collaborator Author

const loggerErrors = getProblems().filter((p) => p.level >= ERROR);
if (loggerErrors.length) {
logger.info(
{ loggerErrors },
'Renovate is exiting with a non-zero code due to the following logged errors'
);
return 1;

it is logged in here per repo run, but it isn't filtered with !artifactProblem as required in dependency dashboard.

unrelated: i changed the BranchSummaryExtended to logDependencyDashboardInfo
sounds more reasonable wdyt?

@rarkins
Copy link
Collaborator

rarkins commented May 14, 2023

it is logged in here per repo run, but it isn't filtered with !artifactProblem as required in dependency dashboard.

In that case make sure the artifactProblem is logged so that it can be filtered later.

unrelated: i changed the BranchSummaryExtended to logDependencyDashboardInfo sounds more reasonable wdyt?

No, that's the opposite of what I'm after. We're not after a 1:1 relationship between the entire dashboard and a log message, because that locks us into only being able to replicate the dashboard. Instead, there should be a separate log message per section.

@PhilipAbed
Copy link
Collaborator Author

PhilipAbed commented May 14, 2023

  1. ok so once i filter them i log them immediately per repo(inside dependency-dashboard.ts) i would rather not print the whole record(string,any). only print if necessary using if

  2. packgeFilesWithUpdates is everything i need as the secondry input, and the rest is branch information.

  3. i changed it back to branchSummaryExtended then.

@PhilipAbed PhilipAbed marked this pull request as ready for review May 14, 2023 16:11
@viceice viceice changed the title feat:log extended branch summary and export dependency dashboard creation function feat: log extended branch summary and export dependency dashboard creation function May 14, 2023
@nabeelsaabna nabeelsaabna marked this pull request as draft May 15, 2023 14:11
@PhilipAbed PhilipAbed changed the title feat: log extended branch summary and export dependency dashboard creation function feat: log extended branch summary May 15, 2023
@PhilipAbed
Copy link
Collaborator Author

PhilipAbed commented May 15, 2023

Summary:
I rolled back the refactored function. im changing the title.
i rolled back the new parameter for logs its not needed.
The code will now Print

  1. repoProblems as soon as it's filtered (if any found), it's taking problems from logs so we dont have to log everything.
  2. branches info extended after branch summary we will print branch info , i minimized the data as much as possible, see above comment (updated) feat: log extended branch summary #22056 (comment)

we do not need the same dashboard text, we will part of the logic and implement it on our side with our own UI

@PhilipAbed PhilipAbed marked this pull request as ready for review May 15, 2023 15:02
@PhilipAbed PhilipAbed requested a review from viceice May 16, 2023 08:35
viceice
viceice previously approved these changes May 17, 2023
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️

@rarkins rarkins added this pull request to the merge queue May 18, 2023
Merged via the queue into renovatebot:main with commit c6d7168 May 18, 2023
11 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 35.94.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

log dependency dashboard info
4 participants