Skip to content

Update Go schema and function dependencies and keep them up to date with renovate - #650

Merged
adamwg merged 5 commits into
crossplane:mainfrom
adamwg:awg/untar-go
Dec 3, 2026
Merged

adamwg merged 5 commits into
crossplane:mainfrom
adamwg:awg/untar-go

Conversation

@adamwg

@adamwg adamwg commented Dec 3, 2026

Copy link
Copy Markdown
Member

Description of your changes

Our Go function template and schema dependencies were rather out of date. In particular, the oapi-codegen/runtime dependency prevents us from using the latest oapi-codegen in our schema generator due to some breaking changes.

Contributing to this issue was the fact that our go.mod files were stored in a tarball (for the function template) and an in-code const (for the schemas) to avoid the Go toolchain treating them as separate modules. Move both into embeddable files by nesting them under testdata/ (so Go ignores the embedded go files) and naming the go.mod files ago.mod.tmpl. Make the function template's go.mod.tmpl a valid go module file and update it in code rather than treat it as a template, so that renovate can operate on it.

Update the renovate config to update dependencies of our Go schemas and the Go function template. We can't just point renovate at it like a normal go.mod because it's not called go.mod and we still need to call it something else so Go will let us embed it. A new nix app, which renovate runs as a post-upgrade task, creates temporary modules and runs go mod tidy so that go.sum gets updated correctly.

Finally, manually update the direct dependencies and run nix run .#tidy-go-templates to update indirect dependencies and go.sum files. This pulls in the latest opai-codegen/runtime module, which will let us use the latest oapi-codegen generator (and unblock #577).

I have:

  • Read and followed Crossplane's contribution process.
  • Read and followed Crossplane's AI policy and confirmed a human stands behind this PR.
  • Run ./nix.sh flake check to ensure this PR is ready for review.
  • Added or updated unit tests.
    - [ ] Linked a PR or a docs tracking issue to document this change.
    - [ ] Added backport release-x.y labels to auto-backport this PR.

The go function template includes go code and go.mod/go.sum files. When placed
in a normal directory like the other templates, Go tools get confused since it
looks like another module in the repository. To work around this, we put the go
template in a tarball; however, this makes it hard to inspect and maintain.

Rename the `templates/` directory to `testdata/`, which Go tooling knows to
ignore. This lets us see the contents of the template and have renovate keep its
dependencies current.

Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
We had the go.mod and go.sum files for Go schemas defined as consts. Move them
into real files so we can have renovate keep them up to date.

Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
Previously, we used a go template to produce go.mod for generated go
functions. Use the modfile package instead, so that we can make go.mod.tmpl a
valid go.mod and let renovate update it.

Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
Update the renovate config to update dependencies of our Go schemas and the Go
function template. We can't just point renovate at it like a normal go.mod
because it's not called go.mod and we still need to call it something else so Go
will let us embed it. A new nix app, which renovate runs as a post-upgrade task,
creates temporary modules and runs `go mod tidy` so that go.sum gets updated
correctly.

Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
Our Go function template and schema dependencies were rather out of date. In
particular, the oapi-codegen/runtime dependency prevents us from using the
latest oapi-codegen in our schema generator due to some breaking changes.

Manually update the direct deps to their latest versions and run the
tidy-go-templates app to update indirect deps. Renovate will take care of this
in the future.

Unblocks crossplane#577

Signed-off-by: Adam Wolfe Gordon <awg@upbound.io>
@adamwg
adamwg requested review from a team, jcogilvie and tampakrap as code owners December 3, 2026 19:29
@adamwg
adamwg requested review from negz and removed request for a team December 3, 2026 19:29
@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.27273% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.98%. Comparing base (5f271df) to head (7d6088f).
⚠️ Report is 121 commits behind head on main.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adamwg adamwg added this to the v2.6 milestone Dec 3, 2026
@adamwg
adamwg merged commit 7382776 into crossplane:main Dec 3, 2026
12 checks passed
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