fix: restore tree dropped by 6d224861; land stem95su gdrive-sync (10m) [ci skip]
6d224861 came from a --no-checkout worktree whose empty index made the
commit drop every file except two. This restores 05b50d2b's full tree and
correctly adds stacks/stem95su/gdrive-sync.tf + the service-catalog stem95su
entry. Forward-only (parent=6d224861, no force-push); [ci skip] since the
live infra was never applied from the broken commit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
6d224861c4
commit
fd0f4a0365
1166 changed files with 358546 additions and 0 deletions
51
cli/git.go
Normal file
51
cli/git.go
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/go-git/go-billy/v5"
|
||||
"github.com/go-git/go-billy/v5/memfs"
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||
memory "github.com/go-git/go-git/v5/storage/memory"
|
||||
"github.com/golang/glog"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
repository = "https://github.com/ViktorBarzin/infra"
|
||||
)
|
||||
|
||||
var (
|
||||
gitUser = os.Getenv("GIT_USER")
|
||||
gitToken = os.Getenv("GIT_TOKEN")
|
||||
)
|
||||
|
||||
type GitFS struct {
|
||||
repo *git.Repository
|
||||
fs *billy.Filesystem
|
||||
auth *http.BasicAuth
|
||||
}
|
||||
|
||||
func NewGitFS(repoURL string) (*GitFS, error) {
|
||||
glog.Infof("initializing new git fs from repo url: %s", repoURL)
|
||||
auth := &http.BasicAuth{
|
||||
Username: gitUser,
|
||||
Password: gitToken,
|
||||
}
|
||||
storer := memory.NewStorage()
|
||||
fs := memfs.New()
|
||||
|
||||
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: &fs, auth: auth}, nil
|
||||
}
|
||||
|
||||
func (g *GitFS) Push() error {
|
||||
return g.repo.Push(&git.PushOptions{Auth: g.auth})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue