mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-21 22:21:41 +00:00
cmd/sync-containers: add a dry-run option.
Updates tailscale/corp#8461 Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
e5fe205c31
commit
a1ded4c166
@ -34,6 +34,7 @@ var (
|
|||||||
src = flag.String("src", "", "Source image")
|
src = flag.String("src", "", "Source image")
|
||||||
dst = flag.String("dst", "", "Destination image")
|
dst = flag.String("dst", "", "Destination image")
|
||||||
max = flag.Int("max", 0, "Maximum number of tags to sync (0 for all tags)")
|
max = flag.Int("max", 0, "Maximum number of tags to sync (0 for all tags)")
|
||||||
|
dryRun = flag.Bool("dry-run", true, "Don't actually sync anything")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -69,10 +70,14 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, tag := range add {
|
for _, tag := range add {
|
||||||
|
if !*dryRun {
|
||||||
log.Printf("Syncing tag %q", tag)
|
log.Printf("Syncing tag %q", tag)
|
||||||
if err := copyTag(*src, *dst, tag, opts...); err != nil {
|
if err := copyTag(*src, *dst, tag, opts...); err != nil {
|
||||||
log.Printf("Syncing tag %q: progress error: %v", tag, err)
|
log.Printf("Syncing tag %q: progress error: %v", tag, err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Printf("Dry run: would sync tag %q", tag)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(remove) > 0 {
|
if len(remove) > 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user