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

Upgrade Golang versions automatically when new patch version is released #86

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

sairaj18
Copy link
Contributor

@sairaj18 sairaj18 commented Nov 13, 2024

Changes in this PR:

  • Separated go, golang package updates (from all patch, minor updates rule)
  • Grouped go, golang package with minor, major versions under a single group name - golang version
  • Grouped go, golang package with patch versions with name - golang patch version
  • Enabled version bump with group name - golang version but disabled automerge
  • Enabled both version bump and automerge for golang patch version group

Steps that I went through to test the auto-merge works as expected

TestCase-1: If there is a new GoLang Patch version released the renovate bot should auto-merge the PR.

  1. Created a fork of the nri-mysql repo
  2. Copied the config from coreint-automation/renovate-base.json5 and added it to forked nri-mysql/.github/renovate.json5
  3. Updated the config to auto-merge whenever new GoLang patch version is released
  4. Installed the renovate app by providing the billing details(name, address) in my profile
  5. Selected the forked nr-mysql repo to provide access to renovate for running and detecting changes in the repo
  6. The renovate job ran and detected new GoLang patch version 1.23.2->1.23.3
  7. Renovate bot has raised a PR for upgrading patch version, waited for all the checks to pass and auto-merged it after an hour.

TestCase-2: If there is a new GoLang minor version released the renovate bot should raise PR but not auto-merge it.

  1. Downgraded the version in the forked nri-mysql repo from 1.23.3 -> 1.22.2 and merged the commits
  2. Renovate bot detected the new minor version released i.e 1.23.3 and raised a PR to upgrade the GoLang version but didn't auto-merge it.

@sairaj18 sairaj18 marked this pull request as ready for review November 13, 2024 10:35
@sairaj18 sairaj18 requested a review from a team as a code owner November 13, 2024 10:35
@rajrohanyadav
Copy link
Contributor

Q: Should it not be a group so that it updates all places where it sees a golang-version (e.g. go.mod, Dockerfile etc)? Also, it would be great to have the regex manager for GO_VERSION=1.23.2. I think there are some repos with this.
Only asking as it is a common change. If it's outside the scope, please feel free to ignore.
Thanks

@sairaj18
Copy link
Contributor Author

Q: Should it not be a group so that it updates all places where it sees a golang-version (e.g. go.mod, Dockerfile etc)? Also, it would be great to have the regex manager for GO_VERSION=1.23.2. I think there are some repos with this. Only asking as it is a common change. If it's outside the scope, please feel free to ignore. Thanks

Even when i use "matchDatasources": ["golang-version"] renovate bot has created a PR with golang version updates in all places go.mod, Dockerfiles. Also why do we need regex manager for GO_VERSION=1.23.2 can you elaborate a bit.

@sigilioso
Copy link
Contributor

Even when i use "matchDatasources": ["golang-version"] renovate bot has created a PR with golang version updates in all places go.mod, Dockerfiles

I'd say they are grouped because of the last rule in the renovate file:

{
// Group the Dockerfile go bump ("golang" package) and the go.mod go bump ("go" package) together
// check <https://docs.renovatebot.com/configuration-options/#groupname> for details about grouping.
"matchPackageNames": ["golang", "go"],
"groupName": "golang version"
}

@rajrohanyadav
Copy link
Contributor

rajrohanyadav commented Nov 13, 2024

Q: Should it not be a group so that it updates all places where it sees a golang-version (e.g. go.mod, Dockerfile etc)? Also, it would be great to have the regex manager for GO_VERSION=1.23.2. I think there are some repos with this. Only asking as it is a common change. If it's outside the scope, please feel free to ignore. Thanks

Even when i use "matchDatasources": ["golang-version"] renovate bot has created a PR with golang version updates in all places go.mod, Dockerfiles. Also why do we need regex manager for GO_VERSION=1.23.2 can you elaborate a bit.

I just thought changes like this or this could also be handled with this. But it is completely okay to leave it for later.

@rajrohanyadav
Copy link
Contributor

Even when i use "matchDatasources": ["golang-version"] renovate bot has created a PR with golang version updates in all places go.mod, Dockerfiles

I'd say they are grouped because of the last rule in the renovate file:

{
// Group the Dockerfile go bump ("golang" package) and the go.mod go bump ("go" package) together
// check <https://docs.renovatebot.com/configuration-options/#groupname> for details about grouping.
"matchPackageNames": ["golang", "go"],
"groupName": "golang version"
}

Makes sense. Thanks.

@sigilioso
Copy link
Contributor

sigilioso commented Nov 14, 2024

I just thought changes like this or this could also be handled with this. But it is completely okay to leave it for later.

Yeah, grouping every go-update together would be even better 🙂 (I'd do it in a follow-up PR)

DavSanchez
DavSanchez previously approved these changes Nov 21, 2024
"matchUpdateTypes": ["patch"],
// Exclude any dependencies which are pre-1.0.0 because those can make breaking changes at any time
// according to the SemVer spec.
"matchCurrentVersion": "!/^(0|v0)/",
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this doesn't apply to Go versions since they are all already v1 as of now, but good to have it around nonetheless 👌

@sairaj18 sairaj18 marked this pull request as draft November 22, 2024 11:45
@sairaj18 sairaj18 self-assigned this Nov 22, 2024
@sairaj18 sairaj18 marked this pull request as ready for review November 22, 2024 15:47
Copy link
Contributor

@sigilioso sigilioso left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@sairaj18 sairaj18 merged commit 1b3b34f into main Nov 25, 2024
7 checks passed
@sairaj18 sairaj18 deleted the NR-337684-auto-upgrade-new-go-patch-versions branch November 25, 2024 16:18
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.

4 participants