Mirror of https://git.jolheiser.com/ugit
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove ugit-uci

-73
-68
cmd/ugit-uci/main.go
··· 1 - package main 2 - 3 - import ( 4 - "bytes" 5 - "flag" 6 - "fmt" 7 - "io" 8 - "net/http" 9 - "os" 10 - 11 - "github.com/go-git/go-git/v5" 12 - ) 13 - 14 - func maine() error { 15 - repoDir, ok := os.LookupEnv("UGIT_REPODIR") 16 - if !ok { 17 - panic("UGIT_REPODIR not set") 18 - } 19 - 20 - urlFlag := flag.String("url", "http://localhost:3448", "URL for UCI") 21 - flag.StringVar(urlFlag, "u", *urlFlag, "--url") 22 - repoDirFlag := flag.String("repo-dir", "", "Repo dir (including .git)") 23 - flag.StringVar(repoDirFlag, "rd", *repoDirFlag, "--repo-dir") 24 - manifestFlag := flag.String("manifest", ".uci.jsonnet", "Path to manifest in repo") 25 - flag.StringVar(manifestFlag, "m", *manifestFlag, "--manifest") 26 - flag.Parse() 27 - 28 - if *repoDirFlag != "" { 29 - repoDir = *repoDirFlag 30 - } 31 - 32 - repo, err := git.PlainOpen(repoDir) 33 - if err != nil { 34 - return fmt.Errorf("could not open git dir %q: %w", repoDir, err) 35 - } 36 - 37 - tree, err := repo.Worktree() 38 - if err != nil { 39 - return fmt.Errorf("could not get worktree: %w", err) 40 - } 41 - 42 - fi, err := tree.Filesystem.Open(*manifestFlag) 43 - if err != nil { 44 - return fmt.Errorf("could not open manifest %q: %w", *manifestFlag, err) 45 - } 46 - defer fi.Close() 47 - 48 - data, err := io.ReadAll(fi) 49 - if err != nil { 50 - return fmt.Errorf("could not read manifest: %w", err) 51 - } 52 - 53 - resp, err := http.Post(*urlFlag, "application/jsonnet", bytes.NewReader(data)) 54 - if err != nil { 55 - return fmt.Errorf("could not post manifest: %w", err) 56 - } 57 - if resp.StatusCode != http.StatusOK { 58 - return fmt.Errorf("non-ok response: %s", resp.Status) 59 - } 60 - 61 - return nil 62 - } 63 - 64 - func main() { 65 - if err := maine(); err != nil { 66 - fmt.Println(err) 67 - } 68 - }
-1
nix/pkg.nix
··· 15 15 ); 16 16 subPackages = [ 17 17 "cmd/ugitd" 18 - "cmd/ugit-uci" 19 18 ]; 20 19 vendorHash = pkgs.lib.fileContents ../go.mod.sri; 21 20 env.CGO_ENABLED = 0;
-4
nix/test.nix
··· 17 17 echo "Pre-receive hook executed" 18 18 ''; 19 19 } 20 - { 21 - name = "ugit-uci"; 22 - content = "${config.services.ugit.package}/bin/ugit-uci"; 23 - } 24 20 ]; 25 21 }; 26 22 }