Skip to content

⚠️ Upgrade modules to v2, namespaced resources support, safe-start implementation#236

Open
hmlkao wants to merge 5 commits intocrossplane-contrib:mainfrom
hmlkao:crossplane-v2-support
Open

⚠️ Upgrade modules to v2, namespaced resources support, safe-start implementation#236
hmlkao wants to merge 5 commits intocrossplane-contrib:mainfrom
hmlkao:crossplane-v2-support

Conversation

@hmlkao
Copy link

@hmlkao hmlkao commented Nov 12, 2025

Description of your changes

This PR solves these issues:

  • Upgrade modules to v2
  • Upgrade Go to v1.24 due to module dependencies
  • Add namespaced resources support
  • Implement safe-start feature
  • ⚠️ (breaking) External Secret Store support is removed from ALL MRs (spec.publishConnectionDetailsTo is removed). This feature was alpha and it was decided to be removed from crossplane.
  • Upgrade Golangcilint to v2.6.2 due tu upragde to Go v1.24
  • ⚠️ (breaking) These resources were disabled due to errors (check comments below) Solved, thanks to @KaelBaldwin:
    • github_team_repository - import cycle
    • github_actions_runner_group - type check issue
    • github_actions_organization_permissions - type check issue

Fixes #213

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

@hmlkao hmlkao force-pushed the crossplane-v2-support branch 2 times, most recently from 25c1249 to 05fdade Compare November 12, 2025 15:16
@hmlkao
Copy link
Author

hmlkao commented Nov 12, 2025

I'm facing to an issue with import cycle:

apis/namespaced/repo/v1alpha1/zz_branch_terraformed.go:1: : import cycle not allowed: import stack: 
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/actions/v1alpha1
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/repo/v1alpha1
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/team/v1alpha1
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/repo/v1alpha1

I'm looking for solution.

@hmlkao
Copy link
Author

hmlkao commented Nov 18, 2025

I'm facing to an issue with import cycle:

apis/namespaced/repo/v1alpha1/zz_branch_terraformed.go:1: : import cycle not allowed: import stack: 
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/actions/v1alpha1
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/repo/v1alpha1
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/team/v1alpha1
   github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/repo/v1alpha1

I'm looking for solution.

make generate pass well, but make reviewable test fails with mentioned error.

The only way how to avoid the import cycle was to disable the resource github_team_repository...

I tried to:

  • remove the reference to the github_repository in config/{cluster,namespaced}/teamrepository/config.go files as it's the only place with cycle reference from team to repo.
  • compare the version before all changes with generated one, Upjet v1 works with references a bit different way, so it works for Upjet v1
  • upgrade Terraform provider from v6.6.0 to v6.8.3

@hmlkao hmlkao force-pushed the crossplane-v2-support branch from 05fdade to 82c2561 Compare November 18, 2025 15:32
@hmlkao
Copy link
Author

hmlkao commented Nov 18, 2025

Another issue with wrong type check appeared:

apis/namespaced/actions/v1alpha1/zz_actionssecret_terraformed.go:1: : # github.com/crossplane-contrib/provider-upjet-github/apis/namespaced/actions/v1alpha1
apis/namespaced/actions/v1alpha1/zz_generated.resolvers.go:270:43: cannot use mg.Spec.ForProvider.EnabledRepositoriesConfig[i3].RepositoryIds (variable of type []*int64) as []*string value in argument to reference.FromPtrValues
apis/namespaced/actions/v1alpha1/zz_generated.resolvers.go:283:69: cannot use reference.ToPtrValues(mrsp.ResolvedValues) (value of type []*string) as []*int64 value in assignment
apis/namespaced/actions/v1alpha1/zz_generated.resolvers.go:289:43: cannot use mg.Spec.InitProvider.EnabledRepositoriesConfig[i3].RepositoryIds (variable of type []*int64) as []*string value in argument to reference.FromPtrValues
apis/namespaced/actions/v1alpha1/zz_generated.resolvers.go:302:70: cannot use reference.ToPtrValues(mrsp.ResolvedValues) (value of type []*string) as []*int64 value in assignment
apis/namespaced/actions/v1alpha1/zz_generated.resolvers.go:424:42: cannot use mg.Spec.ForProvider.SelectedRepositoryIds (variable of type []*int64) as []*string value in argument to reference.FromPtrValues
apis/namespaced/actions/v1alpha1/zz_generated.resolvers.go:437:46: cannot use reference.ToPtrValues(mrsp.ResolvedValues) (value of type []*string) as []*int64 value in assignment
apis/namespaced/actions/v1alpha1/zz_generated.resolvers.go:458:42: cannot use mg.Spec.InitProvider.SelectedRepositoryIds (variable of type []*int64) as []*string value in argument to reference.FromPtrValues
apis/namespaced/actions/v1alpha1/zz_generated.resolvers.go:471:47: cannot use reference.ToPtrValues(mrsp.ResolvedValues) (value of type []*string) as []*int64 value in assignment (typecheck)

It looks like an issue in upjet tool, maybe the Terraform provider schema is wrong, however, I was not able to fix it even if I wrote a workaround updating the provider schema.

So, again, the only way was to disable resources which caused the golangcilint failures, github_actions_runner_group and github_actions_organization_permissions.

@hmlkao
Copy link
Author

hmlkao commented Nov 18, 2025

These are definitely not the best solutions and I would appreciate if anybody could help with this issue.

However, it's possible to generate the provider now without these resources:

  • github_team_repository - import cycle
  • github_actions_runner_group - type check issue
  • github_actions_organization_permissions - type check issue

If anybody wants to help with it:

  1. Enable the resources in these files:
    • config/provider_cluster.go
    • config/provider_namespaced.go
    • config/external_name.go
  2. Run make reviewable test command
  3. Check the error

@hmlkao hmlkao marked this pull request as ready for review November 18, 2025 15:53
@hmlkao hmlkao changed the title Upgrade modules to v2, namespaced resources support, safe-start implementation ⚠️ Upgrade modules to v2, namespaced resources support, safe-start implementation Nov 18, 2025
@hmlkao
Copy link
Author

hmlkao commented Nov 19, 2025

Hi @AtzeDeVries, do you have some experience with any of the issues mentioned in previous comments?

I'd like to move forward with this issue, however, I'm not sure if are these issues related to Upjet v2 or GitHub Terraform provider schema.

@hmlkao hmlkao force-pushed the crossplane-v2-support branch from 82c2561 to 86507e1 Compare November 28, 2025 11:10
@KaelBaldwin
Copy link

@hmlkao I made an attempt via codex to resolve the issues you ran into. Generation works and it seems to start up fine locally: hmlkao#1

@KaelBaldwin
Copy link

hmlkao#2 another PR to fix merge conflicts

@KaelBaldwin
Copy link

@hmlkao , I'm sorry, I missed signing off on that commit, but I'm not sure how to resolve since I can't write to your branch to fix it

@hmlkao
Copy link
Author

hmlkao commented Dec 23, 2025

@hmlkao , I'm sorry, I missed signing off on that commit, but I'm not sure how to resolve since I can't write to your branch to fix it

Hi @KaelBaldwin, sorry for late response, Christmas time... I’m not entirely sure which approach is best to fix this, but I see two possible options:

  1. I could rebase and reword the commit messages to include the proper “Signed-off-by” line, but I would need the exact value from you.
  2. I could revert the merged changes, and you would need to create a new PR.

I prefer the first option. What do you think?

@devthane
Copy link

devthane commented Jan 2, 2026

Hi @KaelBaldwin, sorry for late response, Christmas time... I’m not entirely sure which approach is best to fix this, but I see two possible options:

  1. I could rebase and reword the commit messages to include the proper “Signed-off-by” line, but I would need the exact value from you.
  2. I could revert the merged changes, and you would need to create a new PR.

I prefer the first option. What do you think?

Hi @hmlkao, yes that sounds great! Sorry, I've been out as well. Here's the exact Signed-off-by line:

Signed-off-by: devthane kaelenbaldwin@gmail.com

@hmlkao hmlkao force-pushed the crossplane-v2-support branch 6 times, most recently from bd4e678 to 1391a8c Compare January 7, 2026 15:29
Ondrej Homolka and others added 3 commits January 9, 2026 09:43
…fe-start

Signed-off-by: Ondrej Homolka <ondrej.homolka@gmail.com>
Signed-off-by: Ondrej Homolka <ondrej.homolka@gmail.com>
* break import cycles and add back disabled resources

Signed-off-by: devthane <kaelenbaldwin@gmail.com>

* remove notes about disabled resources in readme

Signed-off-by: devthane <kaelenbaldwin@gmail.com>
@hmlkao hmlkao force-pushed the crossplane-v2-support branch from 1391a8c to febb111 Compare January 9, 2026 08:58
@hmlkao
Copy link
Author

hmlkao commented Jan 9, 2026

Hi @devthane , I have finally successfully rebased the branch and signed-off your commit, all fixes are there.

It was quite tricky for me due to merge commits and a lot of conflicts, so sorry for late response... In the end, I've reduced commits a bit...

@hmlkao
Copy link
Author

hmlkao commented Jan 9, 2026

@AtzeDeVries , @pravindahal , @xunholy as codeowners, could you review this PR with priority, pls? Thanks!

@AtzeDeVries
Copy link
Collaborator

thanks for the contribution! I will have a look!

@AtzeDeVries
Copy link
Collaborator

AtzeDeVries commented Jan 16, 2026

@hmlkao @KaelBaldwin i tried to build the artifact but it fails
https://github.com/crossplane-contrib/provider-upjet-github/actions/runs/21065703704/job/60583060671

@hmlkao
Copy link
Author

hmlkao commented Jan 16, 2026

Hi @AtzeDeVries , thanks for moving it forward.

The problem is that crossplane-contrib/provider-workflows repo used by Publish Provider Package GHA Workflow depends on legacy build module - build @ 420d07d (it's more then 1 year old).

Since then a lot of changes were made and one of them was to install Crossplane CLI instead of UP CLI (line 28 in makelib/local.xpkg.mk).

I'll create an issue in crossplane-contrib/provider-workflows and maybe PR with upgrade of this build module...

Signed-off-by: Ondrej Homolka <ondrej.homolka@gmail.com>
@hmlkao hmlkao force-pushed the crossplane-v2-support branch from f71567b to 13aa7ab Compare January 19, 2026 08:11
@hmlkao
Copy link
Author

hmlkao commented Jan 19, 2026

Hi @AtzeDeVries , I added another commit with lock of provider-workflows version to use the commit from PR I've made in the module.

However, you would have to change default branch to this to be able to test it, or lock it and merge to main in separate PR, or wait for the merge in provider-workflows... It's always an issue to test a GHA workflow changes 🙄

@AtzeDeVries
Copy link
Collaborator

AtzeDeVries commented Jan 22, 2026

@hmlkao I managed to publish a provider package https://github.com/crossplane-contrib/provider-upjet-github/pkgs/container/provider-upjet-github/652598625?tag=v0.19.0-alpha1

I will test this locally as well. I need to think a bit about how to solve the issues with the workflow in a nice way.

@KaelBaldwin
Copy link

KaelBaldwin commented Feb 2, 2026

@hmlkao @AtzeDeVries Someone brought up a good point in slack that other providers have not had an issue with the build module as is and pointed out this provider's Makefile is not in sync with the crossplane provider template.

In order to address this, I've opened a PR to this branch: hmlkao#4 which pulls in the latest commits to the template repository and resolves the conflicts.

I'm hopeful this will resolve the workflow issues in the best way and allow us to keep following the template in the future.

@hmlkao hmlkao force-pushed the crossplane-v2-support branch from ab002ff to 9bcea32 Compare February 3, 2026 16:15
@KaelBaldwin
Copy link

KaelBaldwin commented Feb 3, 2026

@hmlkao I'm sorry, this signoff issue is because I've got two separate github accounts between my work and personal and apparently don't have it sorted correctly. I tried to do the signoff when I committed, but its wanting the other user name for some reason. I specifically tried to make sure this wouldn't happen again but failed to do it correctly still.

* merge template updates and resolve conflicts

Signed-off-by: devthane <kaelenbaldwin@gmail.com>

* fix some issues after merge of updated template repo

Signed-off-by: devthane <kaelenbaldwin@gmail.com>

* fix reference to template provider

Signed-off-by: devthane <kaelenbaldwin@gmail.com>

* update go modules

Signed-off-by: devthane <kaelenbaldwin@gmail.com>

---------

Signed-off-by: devthane <kaelenbaldwin@gmail.com>>
Co-authored-by: devthane <kaelenbaldwin@gmail.com>
@hmlkao hmlkao force-pushed the crossplane-v2-support branch from 9bcea32 to 7435315 Compare February 3, 2026 17:49
@hmlkao
Copy link
Author

hmlkao commented Feb 3, 2026

@hmlkao I'm sorry, this signoff issue is because I've got two separate github accounts between my work and personal and apparently don't have it sorted correctly. I tried to do the signoff when I committed, but its wanting the other user name for some reason. I specifically tried to make sure this wouldn't happen again but failed to do it correctly still.

Hey @KaelBaldwin , no worries, it's good practice with git also for me 😄
I successfully changed the author of the commit to "devthane kaelenbaldwin@gmail.com".

@KaelBaldwin
Copy link

@AtzeDeVries Can you try the workflow again and see if it is good to go now?

@KaelBaldwin
Copy link

@pravindahal @xunholy Would either of you be able to help us get this PR moving?

@devthane
Copy link

devthane commented Feb 16, 2026

Looks like it succeeded this time!

https://github.com/crossplane-contrib/provider-upjet-github/actions/runs/21641331303/job/63689835637

@hmlkao
Copy link
Author

hmlkao commented Feb 18, 2026

@xunholy What are next steps after the CI workflow run mentioned in previous comment succeeded? Is any additional work required to move forward with review?

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.

Crossplane v2 support.

4 participants

Comments