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

Automatically move generated client-go files to repo root #221

Merged
merged 7 commits into from
Jul 5, 2023

Conversation

danielvegamyhre
Copy link
Contributor

@danielvegamyhre danielvegamyhre commented Jul 5, 2023

Fixes #219

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 5, 2023
@k8s-ci-robot k8s-ci-robot requested a review from ahg-g July 5, 2023 17:35
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danielvegamyhre

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 5, 2023
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 5, 2023
@danielvegamyhre
Copy link
Contributor Author

/retest

@danielvegamyhre danielvegamyhre changed the title [WIP] Automatically move generated client-go files to repo root Automatically move generated client-go files to repo root Jul 5, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 5, 2023
@danielvegamyhre
Copy link
Contributor Author

danielvegamyhre commented Jul 5, 2023

@kannon92 Can you checkout this PR locally, try generating the client-go files, and let me know if the fix works? It works for me locally when I clone jobset into /tmp folder, delete /tmp/jobset/client-go then run make generate, the client-go files appear in /tmp/jobset/client-go.

@kannon92
Copy link
Contributor

kannon92 commented Jul 5, 2023

@kannon92 Can you checkout this PR locally, try generating the client-go files, and let me know if the fix works? It works for me locally when I clone jobset into /tmp folder, delete /tmp/jobset/client-go then run make generate, the client-go files appear in /tmp/jobset/client-go.

Doing this now!


bash "${CODEGEN_PKG}/generate-groups.sh" \
"all" \
sigs.k8s.io/jobset/client-go \
sigs.k8s.io/jobset/api \
jobset:v1alpha2 \
--go-header-file ./boilerplate.go.txt

# if client-go files were generated outside of repo root, attempt to move them to the repo root.
Copy link
Contributor

Choose a reason for hiding this comment

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

Testing this, it works but you will have to delete your client-go directory in order to get the copy to work. its a bit odd.

Can we just overwrite if we assume that these changes will never be modified manually?

I deleted everything under client-go directory but I reread your script and it wouldn't copy those changes so I had to delete the client-go directory also.

Maybe we just assume anything in client-go can be purged if you are running this?

Copy link
Contributor Author

@danielvegamyhre danielvegamyhre Jul 5, 2023

Choose a reason for hiding this comment

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

I added a force flag to the mv command so that it will overwrite if necessary, so now you shouldn't need to manually delete client-go/, can you try it again now? I think it's fine to assume the generated files will be overwritten.

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue is this code:

if [ ! -d "$REPO_ROOT/client-go" ]; then

This is saying that if the folder exists then we won't copy it.

Maybe we just remove this if check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I see what you mean now - thanks! I removed this check and also added a check before moving the files to only move it if it isn't already in the repo root (since if that is the case, the mv command will fail even with the force flag).

@kannon92
Copy link
Contributor

kannon92 commented Jul 5, 2023

/lgtm

Thanks for fixing this!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 5, 2023
@k8s-ci-robot k8s-ci-robot merged commit 218c73a into kubernetes-sigs:main Jul 5, 2023
@danielvegamyhre danielvegamyhre mentioned this pull request Dec 12, 2023
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Changing the API and regenerating client-go does not add changes to code repo.
3 participants