-
Notifications
You must be signed in to change notification settings - Fork 14
add progress tracking for git operations #81
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?
Conversation
Implements detailed progress tracking for git clone, pull, and checkout operations using ProgressBuf. This allows monitoring and logging of git operations with proper error handling and status updates. - Add progress writer integration with git operations - Improve error handling with detailed messages - Add progress status updates for each git operation step - Add final success message with commit details Signed-off-by: khatibomar <elkhatibomar@outlook.com>
r, err := git.PlainClone(dir, false, &git.CloneOptions{ | ||
URL: u.String(), | ||
Progress: os.Stdout, | ||
Progress: progressWriter, |
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 this component I meant only this.
the rest is written from outside on error or success.
as I shared in docker build example, it has no event inside the build statement
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.
the rest of calls shouldn't happen because they must use deployment id as a key to write on, which is not available here.
as an option it must accept io.Writer here, as a result deployment id will be appeared here there and easily passed as Progress
src/api/api.go
Outdated
@@ -19,7 +19,7 @@ import ( | |||
"github.com/treenq/treenq/src/services/cdk" | |||
) | |||
|
|||
func New(conf Config) (http.Handler, error) { | |||
func New(conf Config, progressBuf *domain.ProgressBuf) (http.Handler, error) { |
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.
if you want to inject we can create it there instead of main, it makes it simpler to build the IMO
src/api/api.go
Outdated
@@ -39,7 +39,7 @@ func New(conf Config) (http.Handler, error) { | |||
authJwtIssuer := auth.NewJwtIssuer("treenq-api", []byte(conf.AuthPrivateKey), []byte(conf.AuthPublicKey), conf.AuthTtl) | |||
githubClient := repo.NewGithubClient(githubJwtIssuer, http.DefaultClient) | |||
gitDir := filepath.Join(wd, "gits") | |||
gitClient := repo.NewGit(gitDir) | |||
gitClient := repo.NewGit(gitDir, progressBuf) |
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.
here git has a different write that' not shared with the handler and docker artifactory.
if you want to inject we must do it for the others components too, or just use a global instance and pass as a Clone call argument.
I did it a global one by purpose, it doesn't persist data and must be changed to another data source or sync-like mechanic
Signed-off-by: khatibomar <elkhatibomar@outlook.com>
Implements detailed progress tracking for git clone, pull, and checkout operations using ProgressBuf. This allows monitoring and logging of git operations with proper error handling and status updates.