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

fix: golang release version match #360

Merged
merged 5 commits into from
Feb 4, 2023

Conversation

frezbo
Copy link
Contributor

@frezbo frezbo commented Feb 2, 2023

Golang major releases follow major.minor only and patch releases follow major.minor.patch format. This change allows renovate to update Golang major/patch release versions.

This should also fix an old issue #189.

Signed-off-by: Noel Georgi [email protected]

Golang major releases follow `major.minor` only and patch releases follow
`major.minor.patch` format. This change allows renovate to update Golang
major/patch release versions.

This should also fix an old issue aquaproj#189.

Signed-off-by: Noel Georgi <[email protected]>
@suzuki-shunsuke
Copy link
Member

Thank you for your contribution!

@suzuki-shunsuke
Copy link
Member

I'll review this later.
I have a concern the treat of rc version.
https://github.com/golang/go/tags

@suzuki-shunsuke
Copy link
Member

And this preset should not affect other than aqua related packages.
This preset should restrict packages by file paths or something.

@frezbo
Copy link
Contributor Author

frezbo commented Feb 2, 2023

I have a concern the treat of rc version.

this will skip rc versions, only stable versions will be used, this regex is also used internally at work https://github.com/siderolabs/tools/blob/main/.github/renovate.json#L38

@frezbo
Copy link
Contributor Author

frezbo commented Feb 2, 2023

This preset should restrict packages by file paths or something.

Ahh, I see, to make sure only aqua managed files are only updated right??

@suzuki-shunsuke
Copy link
Member

Ahh, I see, to make sure only aqua managed files are only updated right??

Yes.

@frezbo
Copy link
Contributor Author

frezbo commented Feb 2, 2023

cool, I'll update the PR in a while.

@frezbo
Copy link
Contributor Author

frezbo commented Feb 2, 2023

I've updated the PR and added as a second commit, if it's needed I can rebase and force-push

@suzuki-shunsuke
Copy link
Member

Thank you for your update.

if it's needed I can rebase and force-push

Not needed. Thanks.

@suzuki-shunsuke
Copy link
Member

Only golang-go.json is updated and default.json isn't updated.
To update default.json too, we have to update utils.libsonnet's golangGo.

utils.golangGo + utils.argFileMatch,

golangGo: $.prefixRegexManager("golang/go", "(go)?") + {
extractVersionTemplate: "^go(?<version>.*)$",
datasourceTemplate: "github-tags",
},

But it's a bit complicated, so let me take a look.

By Jsonnet we could write code comments and made the code DRY, but the code became a bit complicated...
We will have to refactor Jsonnet when we will have a time.

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Feb 2, 2023

It works well.

https://github.com/suzuki-shunsuke/test-renovate/blob/73bc8f1adff83fb64dbfbc2158b2e22e7357723a/renovate.json5#L6-L24

  regexManagers: [
      {
         "datasourceTemplate": "github-tags",
         "depNameTemplate": "golang/go",
         "extractVersionTemplate": "^go(?<version>.*)$",
         "fileMatch": [
            "\\.?aqua\\.ya?ml"
         ],
         "matchStrings": [
            " +(?:version|'version'|\"version\") *: +(go)?(?<currentValue>[^'\" \\n]+) +# renovate: depName=golang/go[ \\n]",
            " +(?:version|'version'|\"version\") *: +'(go)?(?<currentValue>[^'\" \\n]+)' +# renovate: depName=golang/go[ \\n]",
            " +(?:version|'version'|\"version\") *: +\"(go)?(?<currentValue>[^'\" \\n]+)\" +# renovate: depName=golang/go[ \\n]",
            " +(?:name|'name'|\"name\") *: +golang/go@(go)?(?<currentValue>[^'\" \\n]+)",
            " +(?:name|'name'|\"name\") *: +'golang/go@(go)?(?<currentValue>[^'\" \\n]+)'",
            " +(?:name|'name'|\"name\") *: +\"golang/go@(go)?(?<currentValue>[^'\" \\n]+)\""
         ],
         "versioningTemplate": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.?(?<patch>\\d+)?$"
      },
  ]

@suzuki-shunsuke
Copy link
Member

We can configure versioning in regexManager.

https://docs.renovatebot.com/configuration-options/#versioningtemplate

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Feb 2, 2023

Hmm. 1.18.8 is updated to 1.20. suzuki-shunsuke/test-renovate#208
It is inconvenient if we want to specify the patch version too.

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Feb 2, 2023

Ah, if we enable separateMinorPatch,
1.19 is updated 1.19.5. It looks good to me.

@suzuki-shunsuke
Copy link
Member

Fixed. Do you have any opinion?

@suzuki-shunsuke
Copy link
Member

Maybe we can use Go Modules Directive Versioning? 🤔

https://docs.renovatebot.com/modules/versioning/#go-modules-directive-versioning

@suzuki-shunsuke
Copy link
Member

And golang-version datasource also seems to be useful.

https://docs.renovatebot.com/modules/datasource/golang-version/

I'll try them.

@suzuki-shunsuke
Copy link
Member

❌ Go Modules Directive Versioning doesn't support x.y.z.

@frezbo
Copy link
Contributor Author

frezbo commented Feb 2, 2023

@frezbo
Copy link
Contributor Author

frezbo commented Feb 2, 2023

would have expected a PR for 1.19.5 to 1.20

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Feb 2, 2023

Oh, I see.

github-tags

Without separateMinorPatch

With separateMinorPatch

golang-version + separateMinorPatch

golang-version doesn't update minor version. 🤔

@suzuki-shunsuke
Copy link
Member

Sorry. I'm a bit confused. Renovate is difficult. 😅

@suzuki-shunsuke
Copy link
Member

golang-version doesn't update minor version. 🤔
Let's use github-tags at the moment.

@suzuki-shunsuke
Copy link
Member

I confirmed 1.19.5 is updated to 1.20.

@frezbo
Copy link
Contributor Author

frezbo commented Feb 2, 2023

thanks for fixing up the PR, yeh, renovate is difficult 😅

This looks good 👍

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Feb 2, 2023

I set separateMinorPatch because I thought 1.x wasn't updated to 1.x.y, but this was my misunderstanding.

I confirmed 1.20 will be updated to 1.20.x without separateMinorPatch when 1.20.x will be released.

1.19 is updated to 1.19.5, because I set allowedVersions: "< 1.20" for testing.

So I'll remove separateMinorPatch.

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Feb 2, 2023

Before releasing the new version, let me publish the prerelease version and test in a few days.

https://github.com/aquaproj/aqua-renovate-config/releases/tag/1.5.2-1

@suzuki-shunsuke
Copy link
Member

👍

@suzuki-shunsuke suzuki-shunsuke merged commit 815eaa4 into aquaproj:main Feb 4, 2023
@suzuki-shunsuke suzuki-shunsuke added this to the 1.5.2 milestone Feb 4, 2023
@suzuki-shunsuke
Copy link
Member

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.

2 participants