add dockerfile for cli and add to drone

This commit is contained in:
viktorbarzin 2021-03-16 00:05:05 +00:00
parent 70d306d0d2
commit 899805ddac
4 changed files with 41 additions and 8 deletions

View file

@ -23,7 +23,7 @@ var (
type GitFS struct {
repo *git.Repository
fs billy.Filesystem
fs *billy.Filesystem
auth *http.BasicAuth
}
@ -34,17 +34,19 @@ func NewGitFS(repoURL string) (*GitFS, error) {
Password: gitToken,
}
storer := memory.NewStorage()
fs := memfs.New()
r, err := git.Clone(storer, g.fs, &git.CloneOptions{
r, err := git.Clone(storer, fs, &git.CloneOptions{
URL: repository,
Auth: auth,
})
if err != nil {
return nil, errors.Wrapf(err, "failed to clone repo from repo url '%s'", repoURL)
}
return &GitFS{repo: r, fs: memfs.New(), auth: auth}, nil
return &GitFS{repo: r, fs: &fs, auth: auth}, nil
}
func (g *GitFS) Push() error {
glog.Infof("Attemping to push with auth: %+v", g.auth)
return g.repo.Push(&git.PushOptions{Auth: g.auth})
}