8000 add progress tracking for git operations by khatibomar · Pull Request #81 · treenq/treenq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

khatibomar
Copy link
Contributor

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

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,
Copy link
Contributor

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

Copy link
Contributor

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) {
Copy link
Contributor

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)
Copy link
Contributor

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>
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.

2 participants
0