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: add transform template log #34821

Merged
merged 9 commits into from
Mar 16, 2025

Conversation

bdovaz
Copy link
Contributor

@bdovaz bdovaz commented Mar 14, 2025

Changes

Try to log the transform template source and compiled to be able to debug the result correctly.

Context

#34815

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

Sorry, something went wrong.

@rarkins rarkins requested a review from secustor March 15, 2025 06:54
@rarkins
Copy link
Collaborator

rarkins commented Mar 15, 2025

Do you have an example output of this log file from testing locally?

@bdovaz
Copy link
Contributor Author

bdovaz commented Mar 15, 2025

How can I run it locally? I have run some existing test related to this file but I don't see any output to see the log in vscode.

Can you guide me? Thanks!

@rarkins
Copy link
Collaborator

rarkins commented Mar 15, 2025

pmpm start some/repo

@bdovaz
Copy link
Contributor Author

bdovaz commented Mar 15, 2025

@rarkins is there any way to optimize the pnpm commands? I'm following these instructions but each build/start command takes several minutes.... And my hardware is not exactly old.

https://github.com/renovatebot/renovate/blob/main/docs/development/local-development.md

@rarkins
Copy link
Collaborator

rarkins commented Mar 15, 2025

You don't need to run build before start

@bdovaz
Copy link
Contributor Author

bdovaz commented Mar 15, 2025

@rarkins if I don't make changes I understand that I don't but I still want to say that the pnpm start command is very slow, it takes me several minutes just to start seeing renovate logs....

In any case, I have already tested (ready to review) it and the logs look like this.

The 2 logs that I have added and show below make it possible to correctly debug the custom datasources transformations improving a lot this experience.

This is the one showing the original template and the transformed one:

TRACE: Custom datasource transform template compiled. (repository=bdovaz/renovate_test, baseBranch=main)
       "transformTemplate": "{\"releases\": $map($[id = '{{packageName}}'].releases, function($r) { { \"version\": $r.version, \"releaseTimestamp\": $r.created, \"isStable\": $not($r.isNightly), \"changelogUrl\": $match($[id = '{{packageName}}'].website, /github.com\\/nextcloud\\//) ? $replace($[id = '{{packageName}}'].website, /(.*github.com\\/nextcloud)(\\/.*)/, \"$1\" & \"-releases\" & \"$2\") : $[id = '{{packageName}}'].website, \"sourceUrl\": $[id = '{{packageName}}'].website } })[] }",
       "templated": "{\"releases\": $map($[id = 'user_oidc'].releases, function($r) { { \"version\": $r.version, \"releaseTimestamp\": $r.created, \"isStable\": $not($r.isNightly), \"changelogUrl\": $match($[id = 'user_oidc'].website, /github.com\\/nextcloud\\//) ? $replace($[id = 'user_oidc'].website, /(.*github.com\\/nextcloud)(\\/.*)/, \"$1\" & \"-releases\" & \"$2\") : $[id = 'user_oidc'].website, \"sourceUrl\": $[id = 'user_oidc'].website } })[] }"

This is the one that shows the evaluated json:

TRACE: Custom manager evaluated data. (repository=bdovaz/renovate_test, baseBranch=main)
       "data": {
         "releases": [
           {
             "version": "7.0.0",
             "releaseTimestamp": "2025-03-07T14:11:14.839176Z",
             "isStable": true,
             "changelogUrl": "https://github.com/nextcloud-releases/user_oidc",
             "sourceUrl": "https://github.com/nextcloud/user_oidc"
           },
           {
             "version": "6.3.1",
             "releaseTimestamp": "2025-02-25T10:50:43.057012Z",
             "isStable": true,
             "changelogUrl": "https://github.com/nextcloud-releases/user_oidc",
             "sourceUrl": "https://github.com/nextcloud/user_oidc"
           },
           {
             "version": "6.3.0",
             "releaseTimestamp": "2025-02-17T17:11:31.626194Z",
             "isStable": true,
             "changelogUrl": "https://github.com/nextcloud-releases/user_oidc",
             "sourceUrl": "https://github.com/nextcloud/user_oidc"
           },
           {
             "version": "6.2.1",
             "releaseTimestamp": "2025-01-23T11:04:08.249174Z",
             "isStable": true,
             "changelogUrl": "https://github.com/nextcloud-releases/user_oidc",
             "sourceUrl": "https://github.com/nextcloud/user_oidc"
           },
           {
             "version": "6.2.0",
             "releaseTimestamp": "2025-01-20T12:44:55.041834Z",
             "isStable": true,
             "changelogUrl": "https://github.com/nextcloud-releases/user_oidc",
             "sourceUrl": "https://github.com/nextcloud/user_oidc"
           },
           {
             "version": "6.1.2",
             "releaseTimestamp": "2024-10-30T09:27:44.722794Z",
             "isStable": true,
             "changelogUrl": "https://github.com/nextcloud-releases/user_oidc",
             "sourceUrl": "https://github.com/nextcloud/user_oidc"
           },
           {
             "version": "6.1.1",
             "releaseTimestamp": "2024-10-22T14:37:59.666490Z",
             "isStable": true,
             "changelogUrl": "https://github.com/nextcloud-releases/user_oidc",
             "sourceUrl": "https://github.com/nextcloud/user_oidc"
           },
           {
             "version": "6.1.0",
             "releaseTimestamp": "2024-10-15T09:39:48.435754Z",
             "isStable": true,
             "changelogUrl": "https://github.com/nextcloud-releases/user_oidc",
             "sourceUrl": "https://github.com/nextcloud/user_oidc"
           }
         ]
       }

@rarkins
Copy link
Collaborator

rarkins commented Mar 15, 2025

Something is wrong in your environment. Consider using code spaces instead

@bdovaz
Copy link
Contributor Author

bdovaz commented Mar 15, 2025

Something is wrong in your environment. Consider using code spaces instead

Ok, can you answer to the other part of the comment showing the logs you requested? It's ready to review.

bdovaz and others added 6 commits March 15, 2025 17:48

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
@rarkins rarkins requested a review from secustor March 16, 2025 10:27
@rarkins rarkins enabled auto-merge March 16, 2025 10:29
@rarkins rarkins added this pull request to the merge queue Mar 16, 2025
Merged via the queue into renovatebot:main with commit fe36034 Mar 16, 2025
40 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 39.204.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bdovaz bdovaz deleted the add-transform-template-log branch March 16, 2025 16:34
mjobst-necls pushed a commit to mjobst-necls/renovate that referenced this pull request Mar 17, 2025
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants