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(template): allow releaseTimestamp & currentVersionTimestamp #31286

Merged

Conversation

hebestreit
Copy link
Contributor

Changes

We would like to identify the pull requests of packages that have not been updated for some time, determined by the currentVersionTimestamp in the beginning of the PR title.

On the other hand, we are also interested in the date of the new version, determined by the releaseTimestamp to know it's age and maybe wait until the adoption is higher.

Context

I've started a discussion #31228 to calculate the days between both dates but it turns out that this is not suitable as it would be very "noisy". Instead it would be great to define those timestamps statically inside the template.

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
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "config:recommended",
    "schedule:weekly"
  ],
  "packageRules": [
    {
      "commitMessagePrefix": "currentVersionTimestamp={{ lookup (split currentVersionTimestamp 'T') 0 }}, releaseTimestamp={{ lookup (split releaseTimestamp 'T') 0 }} -"
    }
  ]
}
DEBUG: packageFiles with updates (repository=xxxx/my-app, baseBranch=main)
       "config": {
         "gomod": [
           {
             "packageFile": "go.mod",
             "deps": [
                  ...
                 {
                   "datasource": "go",
                   "depType": "require",
                   "depName": "k8s.io/client-go",
                   "currentValue": "v0.30.3",
                   "managerData": {"multiLine": true, "lineNumber": 31},
                   "updates": [
                     {
                       "bucket": "non-major",
                       "newVersion": "v0.31.0",
                       "newValue": "v0.31.0",
                       "releaseTimestamp": "2024-08-13T14:19:25.000Z",
                       "newMajor": 0,
                       "newMinor": 31,
                       "newPatch": 0,
                       "updateType": "minor",
                       "branchName": "renovate/kubernetes-go"
                     }
                   ],
                   "packageName": "k8s.io/client-go",
                   "versioning": "semver",
                   "warnings": [],
                   "sourceUrl": "https://github.com/kubernetes/client-go",
                   "currentVersion": "v0.30.3",
                   "currentVersionTimestamp": "2024-07-17T18:49:23.000Z",
                   "isSingleVersion": true,
                   "fixedVersion": "v0.30.3"
               },
               {
                 "datasource": "go",
                 "depType": "require",
                 "depName": "github.com/docker/docker",
                 "currentValue": "v26.1.5+incompatible",
                 "managerData": {"multiLine": true, "lineNumber": 21},
                 "updates": [
                   {
                     "bucket": "major",
                     "newVersion": "v27.2.1+incompatible",
                     "newValue": "v27.2.1+incompatible",
                     "releaseTimestamp": "2024-09-06T09:57:40.000Z",
                     "newMajor": 27,
                     "newMinor": 2,
                     "newPatch": 1,
                     "updateType": "major",
                     "branchName": "renovate/github.com-docker-docker-27.x"
                   }
                 ],
                 "packageName": "github.com/docker/docker",
                 "versioning": "semver",
                 "warnings": [],
                 "sourceUrl": "https://github.com/docker/docker",
                 "currentVersion": "v26.1.5+incompatible",
                 "currentVersionTimestamp": "2024-07-23T19:36:28.000Z",
                 "isSingleVersion": true,
                 "fixedVersion": "v26.1.5+incompatible"
               },
               ...
         ]
       }
...

DEBUG: branches info extended (repository=xxxx/my-app)
       "branchesInformation": [
         {
           "branchName": "renovate/kubernetes-go",
           "prNo": null,
           "prTitle": "currentVersionTimestamp=2024-07-17, releaseTimestamp=2024-08-13 - Update module k8s.io/client-go to v0.31.0",
           "result": "no-work",
           "upgrades": [
             {
               "datasource": "go",
               "depName": "k8s.io/client-go",
               "displayPending": "",
               "fixedVersion": "v0.30.3",
               "currentVersion": "v0.30.3",
               "currentValue": "v0.30.3",
               "newValue": "v0.31.0",
               "newVersion": "v0.31.0",
               "packageFile": "go.mod",
               "updateType": "minor",
               "packageName": "k8s.io/client-go"
             }
           ]
         },
         {
           "branchName": "renovate/github.com-docker-docker-27.x",
           "prNo": null,
           "prTitle": "currentVersionTimestamp=2024-07-23, releaseTimestamp=2024-09-06 - Update module github.com/docker/docker to v27",
           "result": "no-work",
           "upgrades": [
             {
               "datasource": "go",
               "depName": "github.com/docker/docker",
               "displayPending": "",
               "fixedVersion": "v26.1.5+incompatible",
               "currentVersion": "v26.1.5+incompatible",
               "currentValue": "v26.1.5+incompatible",
               "newValue": "v27.2.1+incompatible",
               "newVersion": "v27.2.1+incompatible",
               "packageFile": "go.mod",
               "updateType": "major",
               "packageName": "github.com/docker/docker"
             }
           ]
         }
       ]

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.

both values can still be undefined

@rarkins rarkins added this pull request to the merge queue Sep 9, 2024
Merged via the queue into renovatebot:main with commit ed6bcd7 Sep 9, 2024
38 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 38.73.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@talpa-robin
Copy link

@viceice just because I'm curious is there a reason why the allowedFields implementation is not a at runtime configurable option? Needing a PR just for "whitelisting" existing fields for templating seems to be overkill, no?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2024
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.

5 participants