Skip to content

chore: upgrade from pgx v4 to v5#1530

Merged
crozzy merged 1 commit intoquay:mainfrom
crozzy:upgrade-to-pgx-v5
Jun 11, 2025
Merged

chore: upgrade from pgx v4 to v5#1530
crozzy merged 1 commit intoquay:mainfrom
crozzy:upgrade-to-pgx-v5

Conversation

@crozzy
Copy link
Copy Markdown
Contributor

@crozzy crozzy commented Apr 28, 2025

In July 2025 v4 will reach end of life. This change updates claircore to use v5.

@crozzy crozzy requested a review from a team as a code owner April 28, 2025 21:05
@crozzy crozzy requested review from hdonnay and removed request for a team April 28, 2025 21:05
@crozzy crozzy force-pushed the upgrade-to-pgx-v5 branch 2 times, most recently from 4c0e5ee to e857549 Compare April 29, 2025 14:37
Copy link
Copy Markdown
Member

@hdonnay hdonnay left a comment

Choose a reason for hiding this comment

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

In July 2025 v4 will reach end of life. This change updates claircore to use v5.

Comment thread datastore/postgres/gc.go
Comment thread datastore/postgres/indexreport.go
@crozzy crozzy marked this pull request as draft April 29, 2025 15:38
@crozzy crozzy force-pushed the upgrade-to-pgx-v5 branch from e857549 to dd915e8 Compare April 30, 2025 18:37
@@ -0,0 +1,155 @@
package types
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is copied directly from https://github.com/hdonnay/claircore/tree/hack/db-updates and allows claircore.Versions to Scan() natively (which is awesome). There are other ScanPlans/EncodePlans in that branch that would probably be nice to add at some point, but currently the version code is required to make versions function correctly with v5.

@crozzy crozzy force-pushed the upgrade-to-pgx-v5 branch 9 times, most recently from 3f3c5e5 to 5c4894e Compare May 2, 2025 20:37
Comment thread pkg/ctxlock/ctxlock.go Outdated
@crozzy crozzy force-pushed the upgrade-to-pgx-v5 branch 11 times, most recently from fa90f81 to 7dcc4af Compare May 7, 2025 21:39
@crozzy crozzy force-pushed the upgrade-to-pgx-v5 branch 6 times, most recently from 1e5d892 to d8ea3f3 Compare May 13, 2025 16:59
Comment thread pkg/ctxlock/ctxlock.go Outdated
Comment thread pkg/ctxlock/ctxlock.go Outdated
Comment thread pkg/ctxlock/ctxlock.go Outdated
Comment thread pkg/ctxlock/ctxlock.go
Copy link
Copy Markdown
Member

@hdonnay hdonnay May 29, 2025

Choose a reason for hiding this comment

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

I think I'd rather this not change API and just grow the subpackage. So in a later PR, the New function becomes a func(context.Context, any) (*Locker, error) that always returns errors.ErrUnsupported and we can drop the pgx/v4 dependency.

Maybe the new types should just be in the datastore/postgres package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I updated to this, it does mean that we won't be able to seamlessly continue to use github.com/quay/claircore/pkg/ctxlock externally and github.com/quay/claircore/pkg/ctxlock/v2 will be more permanent but maybe I'm over-estimating the value of that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By new types do you mean v2.Locker?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no, I mean the ctxlock package just hangs around and eventually becomes non-functional as users move to ctxlock/v2.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right that's what I think the PR state is right now, just wanted confirmation on

Maybe the new types should just be in the datastore/postgres package?

@crozzy crozzy force-pushed the upgrade-to-pgx-v5 branch 3 times, most recently from 49d959e to a4e0433 Compare June 6, 2025 22:37
@crozzy crozzy requested a review from hdonnay June 6, 2025 22:37
@crozzy crozzy marked this pull request as ready for review June 6, 2025 22:37
go list -m
go mod download
go test -race ${RUNNER_DEBUG:+-v} "-coverprofile=${{ runner.temp }}/$(go list -m | tr / _).codecov.out" -covermode=atomic ./...
GOMAXPROCS=2 go test -race ${RUNNER_DEBUG:+-v} "-coverprofile=${{ runner.temp }}/$(go list -m | tr / _).codecov.out" -covermode=atomic ./...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😾

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm not sure what to do here, throttling the traffic going to the DB seems to alleviate the CI failures that were cropping up previously, but it's not the most elegant solution. Maybe futz around with the pg settings?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's not meaningfully slower, so I guess leave it like this for now :/

Comment thread datastore/postgres/gc.go
Comment thread go.mod Outdated
Comment thread pkg/ctxlock/v2/ctxlock.go Outdated
Comment thread rhel/matcher_test.go
@crozzy crozzy force-pushed the upgrade-to-pgx-v5 branch from a4e0433 to 4620dda Compare June 10, 2025 21:08
In July 2025 v4 will reach end of life. This change updates claircore to
use v5.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
@crozzy crozzy force-pushed the upgrade-to-pgx-v5 branch from 4620dda to 9a7ab02 Compare June 10, 2025 21:10
@crozzy crozzy requested a review from hdonnay June 10, 2025 21:14
Copy link
Copy Markdown
Member

@hdonnay hdonnay left a comment

Choose a reason for hiding this comment

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

LGTM

@crozzy
Copy link
Copy Markdown
Contributor Author

crozzy commented Jun 10, 2025

/fast-forward

@github-actions
Copy link
Copy Markdown

Triggered from #1530 (comment) by @​crozzy.

Trying to fast forward main (49f1591) to upgrade-to-pgx-v5 (9a7ab02).

Target branch (main):

commit 49f1591b598ff8aaa8cb324ae3714dfd3f1f0822 (HEAD -> main, origin/main)
Author: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Date:   Mon Jun 9 03:56:47 2025 +0000

    chore(deps): bump the golang-x group with 6 updates
    
    Bumps the golang-x group with 6 updates:
    
    | Package | From | To |
    | --- | --- | --- |
    | [golang.org/x/crypto](https://github.com/golang/crypto) | `0.38.0` | `0.39.0` |
    | [golang.org/x/net](https://github.com/golang/net) | `0.40.0` | `0.41.0` |
    | [golang.org/x/sync](https://github.com/golang/sync) | `0.14.0` | `0.15.0` |
    | [golang.org/x/text](https://github.com/golang/text) | `0.25.0` | `0.26.0` |
    | [golang.org/x/time](https://github.com/golang/time) | `0.11.0` | `0.12.0` |
    | [golang.org/x/tools](https://github.com/golang/tools) | `0.33.0` | `0.34.0` |
    
    
    Updates `golang.org/x/crypto` from 0.38.0 to 0.39.0
    - [Commits](https://github.com/golang/crypto/compare/v0.38.0...v0.39.0)
    
    Updates `golang.org/x/net` from 0.40.0 to 0.41.0
    - [Commits](https://github.com/golang/net/compare/v0.40.0...v0.41.0)
    
    Updates `golang.org/x/sync` from 0.14.0 to 0.15.0
    - [Commits](https://github.com/golang/sync/compare/v0.14.0...v0.15.0)
    
    Updates `golang.org/x/text` from 0.25.0 to 0.26.0
    - [Release notes](https://github.com/golang/text/releases)
    - [Commits](https://github.com/golang/text/compare/v0.25.0...v0.26.0)
    
    Updates `golang.org/x/time` from 0.11.0 to 0.12.0
    - [Commits](https://github.com/golang/time/compare/v0.11.0...v0.12.0)
    
    Updates `golang.org/x/tools` from 0.33.0 to 0.34.0
    - [Release notes](https://github.com/golang/tools/releases)
    - [Commits](https://github.com/golang/tools/compare/v0.33.0...v0.34.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/crypto
      dependency-version: 0.39.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: golang-x
    - dependency-name: golang.org/x/net
      dependency-version: 0.41.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: golang-x
    - dependency-name: golang.org/x/sync
      dependency-version: 0.15.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: golang-x
    - dependency-name: golang.org/x/text
      dependency-version: 0.26.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: golang-x
    - dependency-name: golang.org/x/time
      dependency-version: 0.12.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: golang-x
    - dependency-name: golang.org/x/tools
      dependency-version: 0.34.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: golang-x
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>

Pull request (upgrade-to-pgx-v5):

commit 9a7ab029d2cb7a526c44cad53c26c850d8118908 (pull_request/upgrade-to-pgx-v5)
Author: Joseph Crosland <jcroslan@redhat.com>
Date:   Mon Apr 28 11:29:59 2025 -0700

    chore: upgrade from pgx v4 to v5
    
    In July 2025 v4 will reach end of life. This change updates claircore to
    use v5.
    
    Signed-off-by: crozzy <joseph.crosland@gmail.com>

Fast forwarding main (49f1591) to upgrade-to-pgx-v5 (9a7ab02).

$ git push origin 9a7ab029d2cb7a526c44cad53c26c850d8118908:main
To https://github.com/quay/claircore.git
 ! [remote rejected] 9a7ab029d2cb7a526c44cad53c26c850d8118908 -> main (refusing to allow a GitHub App to create or update workflow `.github/workflows/main.yml` without `workflows` permission)
error: failed to push some refs to 'https://github.com/quay/claircore.git'

@crozzy crozzy merged commit 674d0f9 into quay:main Jun 11, 2025
6 checks passed
@crozzy crozzy added the needs-changelog Label for PRs that need a changelog note. label Jun 12, 2025
@github-actions github-actions bot removed the needs-changelog Label for PRs that need a changelog note. label Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants