-
Notifications
You must be signed in to change notification settings - Fork 25
Implement hands on hp-populate-remote #78
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
base: main
Are you sure you want to change the base?
Implement hands on hp-populate-remote #78
Conversation
woojiahao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't an easy hands-on to implement because we have remote integration. Left a couple of comments on structuring the hands-on!
Please note that this requires setting up delete access for the GitHub CLI via
gh auth refresh -h github.com -s delete_repo.
@damithc are we able to include this in our setup guide if it's not yet included?
I also realised that the GitHub CLI needs to be configured beforehand for this part of the hands-on to work.
This is already supported when you do __require_github__ = True: https://git-mastery.github.io/developers/docs/architecture/hands-on-structure/#file-structure
|
Thanks for the super-detailed comments! I’ll make the corresponding changes later today.
Sorry for the confusion, what I meant was that students need to have the GitHub CLI installed for the |
Given having to delete a remote repo is rare, instead of deleting the repo automatically, a safer alternative is to abort with a message asking the student to delete the repo and run the |
I agree with this approach! If I understand correctly, this would mean the Python script in this repo should raise exceptions that the app’s |
|
@damithc @oadultradeepfield afaik, deleting a repository is actually also used when we run I think that it's worth (1) Figuring out if we need to include I think (2) is a better user experience. What do you guys think? |
woojiahao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the quick turnaround @oadultradeepfield . I left some extra comments, but we will need to figure out on what to do with the delete first
@oadultradeepfield @woojiahao I'm OK with 2(b), given deleting repos is rare. |
|
@woojiahao @damithc Given that we’re likely proceeding with 2(b), may I confirm if the correct implementation is to raise an exception in this hands-on Python script? So far, I haven’t seen any hands-on printing any messages (though I might have missed it), so my understanding is that another part of the codebase (or a different repository) handles that. |
@oadultradeepfield let's wait for @woojiahao's input on this. |
|
@damithc @oadultradeepfield so sorry, resuming reviewing the PRs today. I am okay with 2(b) as well. The caveat here is that you need to ensure that when the user runs
No, while this would be the ideal solution, the current app does not handle errors raised from the download script (known feature gap that I will need to fix). For now, would it be possible to display a prompt for the student to continue, then calling Let me know if this makes sense! |
|
@woojiahao I have implemented the suggested changes. Please review again to see if they make sense. I have also tested this script again, and the message appears as expected, aborting correctly.
For now, I still don’t have the clearest picture of what you’re trying to point out, but I can look into it as a separate issue in more detail if you’d like. |
|
@oadultradeepfield Cool! I'll take a look at it in a bit. I'm currently seeing if it makes more sense for the app to handle this as a more first-class principle so that we don't need to have this hacky workaround. We are seeing this issue crop up more and more with other hands-ons as well, so would like to converge to have a common pattern for everyone |
| print( | ||
| f"\nRepository 'https://github.com/{full_repo_name}' already exists on GitHub.\n" | ||
| "Please delete the existing repository before proceeding." | ||
| ) | ||
| sys.exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I guess this part can be simplified to raising an exception with a similar message here?
|
|
||
|
|
||
| def _get_full_repo_name(verbose: bool) -> str: | ||
| output = run_command(["gh", "api", "user", "-q", ".login"], verbose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this can be changed to get the output from the utility function you will provide as well!
Exercise Discussion
This PR will close #56. Below is a more detailed description of the changes along with implementation notes:
add_originfunction inexercise_utils/git.py. This might be helpful in the future. I noticed that there is already aremove_remoteimplementation, andadd_originis intended to be used in a similar way.gitmastery-thingsis created successfully across multiple attempts, I added a check to delete any existing remote repository with the same name. Please note that this requires setting up delete access for the GitHub CLI viagh auth refresh -h github.com -s delete_repo. I also realised that the GitHub CLI needs to be configured beforehand for this part of the hands-on to work.Note: The download script tested via
test-download.shworks fine. Here is the remote repo I managed to create.Checklist
Git-Masteryorganization, have you created a request for it?repo-smithto validate the exercise grading scheme?test-download.sh?git-autograder?app?