Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b9b9082008 | |||
| bd54491c1d | |||
| 57d252cee4 | |||
| 78030230c5 |
@@ -708,7 +708,8 @@ sgard/
|
|||||||
sgardpb/ # Generated protobuf + gRPC Go code
|
sgardpb/ # Generated protobuf + gRPC Go code
|
||||||
proto/sgard/v1/ # Proto source definitions
|
proto/sgard/v1/ # Proto source definitions
|
||||||
|
|
||||||
flake.nix # Nix flake (builds sgard + sgardd)
|
VERSION # Semver string, read by flake.nix; synced from latest git tag via `make version`
|
||||||
|
flake.nix # Nix flake (builds sgard + sgardd, version from VERSION file)
|
||||||
.goreleaser.yaml # GoReleaser (builds both binaries)
|
.goreleaser.yaml # GoReleaser (builds both binaries)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -112,3 +112,4 @@ Phase 6: Manifest Signing (to be planned).
|
|||||||
| 2026-03-25 | — | Deploy sgardd to rift: Dockerfile, docker-compose, mc-proxy L4 route on :9443, Metacrypt TLS cert, DNS. |
|
| 2026-03-25 | — | Deploy sgardd to rift: Dockerfile, docker-compose, mc-proxy L4 route on :9443, Metacrypt TLS cert, DNS. |
|
||||||
| 2026-03-25 | — | `sgard remote set/show`: persistent remote config in `<repo>/remote.yaml` (addr, tls, tls_ca). |
|
| 2026-03-25 | — | `sgard remote set/show`: persistent remote config in `<repo>/remote.yaml` (addr, tls, tls_ca). |
|
||||||
| 2026-03-26 | — | `sgard list` remote support: uses `resolveRemoteConfig()` to list server manifest via `PullManifest` RPC. Client `List()` method added. |
|
| 2026-03-26 | — | `sgard list` remote support: uses `resolveRemoteConfig()` to list server manifest via `PullManifest` RPC. Client `List()` method added. |
|
||||||
|
| 2026-03-26 | — | Version derived from git tags via `VERSION` file. flake.nix reads `VERSION`; Makefile `version` target syncs from latest tag, `build` injects via ldflags. |
|
||||||
|
|||||||
@@ -206,8 +206,8 @@ func (c *Client) doPull(ctx context.Context, g *garden.Garden) (int, error) {
|
|||||||
serverManifest := server.ProtoToManifest(pullResp.GetManifest())
|
serverManifest := server.ProtoToManifest(pullResp.GetManifest())
|
||||||
localManifest := g.GetManifest()
|
localManifest := g.GetManifest()
|
||||||
|
|
||||||
// If local is newer or equal, nothing to do.
|
// If local has files and is newer or equal, nothing to do.
|
||||||
if !serverManifest.Updated.After(localManifest.Updated) {
|
if len(localManifest.Files) > 0 && !serverManifest.Updated.After(localManifest.Updated) {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,14 +9,13 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var listRemoteFlag bool
|
|
||||||
|
|
||||||
var listCmd = &cobra.Command{
|
var listCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List all tracked files",
|
Short: "List all tracked files",
|
||||||
Long: "List all tracked files locally, or on the remote server with -r.",
|
Long: "List all tracked files locally, or on the remote server with -r.",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if listRemoteFlag {
|
addr, _, _, _ := resolveRemoteConfig()
|
||||||
|
if addr != "" {
|
||||||
return listRemote()
|
return listRemote()
|
||||||
}
|
}
|
||||||
return listLocal()
|
return listLocal()
|
||||||
@@ -69,6 +68,5 @@ func printEntries(entries []manifest.Entry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
listCmd.Flags().BoolVarP(&listRemoteFlag, "use-remote", "r", false, "list files on the remote server")
|
|
||||||
rootCmd.AddCommand(listCmd)
|
rootCmd.AddCommand(listCmd)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ func dialRemote(ctx context.Context) (*client.Client, func(), error) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rootCmd.PersistentFlags().StringVar(&repoFlag, "repo", defaultRepo(), "path to sgard repository")
|
rootCmd.PersistentFlags().StringVar(&repoFlag, "repo", defaultRepo(), "path to sgard repository")
|
||||||
rootCmd.PersistentFlags().StringVar(&remoteFlag, "remote", "", "gRPC server address (host:port)")
|
rootCmd.PersistentFlags().StringVarP(&remoteFlag, "remote", "r", "", "gRPC server address (host:port)")
|
||||||
rootCmd.PersistentFlags().StringVar(&sshKeyFlag, "ssh-key", "", "path to SSH private key")
|
rootCmd.PersistentFlags().StringVar(&sshKeyFlag, "ssh-key", "", "path to SSH private key")
|
||||||
rootCmd.PersistentFlags().BoolVar(&tlsFlag, "tls", false, "use TLS for remote connection")
|
rootCmd.PersistentFlags().BoolVar(&tlsFlag, "tls", false, "use TLS for remote connection")
|
||||||
rootCmd.PersistentFlags().StringVar(&tlsCAFlag, "tls-ca", "", "path to CA certificate for TLS verification")
|
rootCmd.PersistentFlags().StringVar(&tlsCAFlag, "tls-ca", "", "path to CA certificate for TLS verification")
|
||||||
|
|||||||
@@ -10,13 +10,17 @@ import (
|
|||||||
|
|
||||||
var pullCmd = &cobra.Command{
|
var pullCmd = &cobra.Command{
|
||||||
Use: "pull",
|
Use: "pull",
|
||||||
Short: "Pull checkpoint from remote server",
|
Short: "Pull checkpoint from remote server and restore files",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
g, err := garden.Open(repoFlag)
|
g, err := garden.Open(repoFlag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
// Repo doesn't exist yet — init it so pull can populate it.
|
||||||
|
g, err = garden.Init(repoFlag)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("init repo for pull: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c, cleanup, err := dialRemote(ctx)
|
c, cleanup, err := dialRemote(ctx)
|
||||||
@@ -32,9 +36,22 @@ var pullCmd = &cobra.Command{
|
|||||||
|
|
||||||
if pulled == 0 {
|
if pulled == 0 {
|
||||||
fmt.Println("Already up to date.")
|
fmt.Println("Already up to date.")
|
||||||
} else {
|
return nil
|
||||||
fmt.Printf("Pulled %d blob(s).\n", pulled)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Pulled %d blob(s).\n", pulled)
|
||||||
|
|
||||||
|
if g.HasEncryption() && g.NeedsDEK(g.List()) {
|
||||||
|
if err := unlockDEK(g); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := g.Restore(nil, true, nil); err != nil {
|
||||||
|
return fmt.Errorf("restore after pull: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Restore complete.")
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user