-
Notifications
You must be signed in to change notification settings - Fork 136
fix: promote cmd should sync app-interface first before making change #837
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: master
Are you sure you want to change the base?
fix: promote cmd should sync app-interface first before making change #837
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: feichashao The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@feichashao: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
joshbranham
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.
I think the owness should be to have users keep their checkout clean. Trying to program around that could have some unintended consequences.
If the process fails, how about we just print a helpful message "Please ensure you are on the default branch (master) and are up to date with the remote repository."
| // Fetch and sync with origin/master FIRST before reading any files | ||
| // to ensure we're working with the latest app-interface state | ||
| fmt.Println("Syncing app-interface with origin/master...") | ||
| if err := appInterface.GitExecutor.Run(appInterface.GitDirectory, "git", "fetch", "origin", "master"); err != nil { |
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.
To your point in the PR, what happens if someone's default remote is not "origin"?
| if err := appInterface.GitExecutor.Run(appInterface.GitDirectory, "git", "checkout", "master"); err != nil { | ||
| return fmt.Errorf("failed to checkout master: %v", err) | ||
| } | ||
| if err := appInterface.GitExecutor.Run(appInterface.GitDirectory, "git", "reset", "--hard", "origin/master"); err != nil { |
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 could cause unintended consequences if someone has something committed locally.
Code changes assisted by Claude Code. Reviewed and validated by human.
Problem
When I use the promote saas command, it failed to create a commit.
The issue was,
osdctlreads the current git hash in the current branch.osdctltries to replace the currently hash in themasterbranch with the new hash. However, themasterbranch is out of sync with the upstream branch.masterbranch is not tracking theorigin/master.Changes
origin/masterbefore reading and replacing the git hash.