diff options
Diffstat (limited to 'deploy/deploy.go')
-rw-r--r-- | deploy/deploy.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/deploy/deploy.go b/deploy/deploy.go index c0c6ed4f3..c7a4510c2 100644 --- a/deploy/deploy.go +++ b/deploy/deploy.go @@ -138,7 +138,7 @@ func (d *Deployer) Deploy(ctx context.Context) error { d.summary.NumLocal = len(local) // Load remote files from the target. - remote, err := walkRemote(ctx, bucket) + remote, err := walkRemote(ctx, bucket, include, exclude) if err != nil { return err } @@ -499,7 +499,7 @@ func walkLocal(fs afero.Fs, matchers []*matcher, include, exclude glob.Glob) (ma } // walkRemote walks the target bucket and returns a flat list. -func walkRemote(ctx context.Context, bucket *blob.Bucket) (map[string]*blob.ListObject, error) { +func walkRemote(ctx context.Context, bucket *blob.Bucket, include, exclude glob.Glob) (map[string]*blob.ListObject, error) { retval := map[string]*blob.ListObject{} iter := bucket.List(nil) for { @@ -510,6 +510,15 @@ func walkRemote(ctx context.Context, bucket *blob.Bucket) (map[string]*blob.List if err != nil { return nil, err } + // Check include/exclude matchers. + if include != nil && !include.Match(obj.Key) { + jww.INFO.Printf(" remote dropping %q due to include\n", obj.Key) + continue + } + if exclude != nil && exclude.Match(obj.Key) { + jww.INFO.Printf(" remote dropping %q due to exclude\n", obj.Key) + continue + } // If the remote didn't give us an MD5, compute one. // This can happen for some providers (e.g., fileblob, which uses the // local filesystem), but not for the most common Cloud providers |