580 Commits

Author SHA1 Message Date
Danny
14c437b48f
GC: Iteration Cleanup (#878)
## Description
Small refactor. Moves Path functions from iterator to `service_functions.go`
Introduces getCollectionPath which combines the two previous functions and reduces code complexity
## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

## Test Plan

- [x]  Unit test
2022-09-16 22:30:36 +00:00
ashmrtn
09343c0220
Coalesce items into collections in kopia/wrapper.go during restore (#888)
## Description

The wrapper.go file was not properly grouping items during restore, instead returning a bunch of single item data.Collections. Update this to properly group items by folder. Also update the tests to be more strict about checking for this.

Remove dead code around restoring a single item as it was unused. Lose some visibility into what happens if the code is unable to open the reader for a given item.

Generally moves some logic around in wrapper.go

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* closes #879 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
2022-09-16 22:12:30 +00:00
Keepers
609bbc3512
skip tests that restore contacts, events (#885)
## Description

Skips any integration tests that restore events or contacts.

## Type of change

- [x] 🤖 Test

## Issue(s)

* #884

## Test Plan

- [x] 💚 E2E
2022-09-16 21:33:57 +00:00
ashmrtn
275961b5bd
Add more data stored in the test suite (#887)
## Description

No change to logic in other code, just refactoring the tests

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Test
- [ ] 💻 CI/Deployment
- [x] 🐹 Trivial/Minor

## Issue(s)

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2022-09-16 21:18:43 +00:00
Vaibhav Kamra
a9b0e2e7ee
OneDrive CLI commands (#739)
## Description

Wires up the OneDrive Backup(create,list,details,delete) and Restore commands

Unit tests added but integration tests will be added after the underlying operation
PRs are merged.

## Type of change

Please check the type of change your PR introduces:
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 🐹 Trivial/Minor

## Issue(s)
#658 
#668 

## Test Plan

<!-- How will this be tested prior to merging.-->

- [x] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2022-09-16 20:32:36 +00:00
Danny
31e4a68355
GC: Use Human-Readable Path Names for data.Collections (#882)
Changes all `data.Collection.` FullPath to use display name.
2022-09-16 15:32:23 -04:00
Vaibhav Kamra
ac638d3162
Provide interface to get stream size (#876)
## Description

Allows kopia data collection consumers to query stream size.

This is required for OneDrive that needs to set the file size prior to uploading file data.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [x] 🐹 Trivial/Minor

## Issue(s)

* #668 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2022-09-16 18:15:43 +00:00
ashmrtn
9e66f197c0
Create and populate folder backup details entries during backup (#872)
## Description

Other components may need to rebuild the directory hierarchy of items. As the paths Corso deals with can be hard to properly parse at times, store that information in the Corso backup details. The hierarchy can be rebuilt by following the `ParentRef` fields of items. The item at the root of the hierarchy has an empty `ParentRef` field.

Also hide these folders from end-users. They are not displayed during backup list nor are they eligible as a target for restore

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* closes #862
* closes #861
* closes #818 

merge after:
* #869 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
2022-09-16 01:42:01 +00:00
Vaibhav Kamra
8587e7d1c2
Implement OneDrive item upload (#843)
## Description

This implements helper methods that support creating new items and uploading data from a `io.Reader` to OneDrive.

It includes an integration test that uses mock data.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #668 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
2022-09-16 01:22:23 +00:00
Keepers
1f4a490c33
allow users to opt-out of metric gathering (#871)
## Description

Adds a flag and options control for disabling metrics.

## Type of change

- [x] 🌻 Feature

## Issue(s)

* #741

## Test Plan

- [x] 💪 Manual
2022-09-16 00:56:56 +00:00
Vaibhav Kamra
16d384a232
Removed timestamp check (#874)
## Description

Removed timestamp check which could fail if the test started right before the hour rolled over.

Couldn't think of a better check that wouldn't fail at *some point*

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [x] 🐹 Trivial/Minor
2022-09-16 00:35:47 +00:00
ashmrtn
ad2d046d19
Create folder struct for backup details (#869)
## Description

<!-- Insert PR description-->
Folder entries allow recording the directory hierarchy of a backup in backup details for other consumers.

Although folders are present in the backup details and they have the logic to be displayed, they are not expected to be shown to users (later PRs will ensure this).

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* closes #860 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2022-09-16 00:17:28 +00:00
Danny
87014a132b
GC: Backup: Contacts: Retrieve IDs from all Contact Folders (#830)
## Description

Adds the ability to retrieve M365 IDs of contacts not in the default folder. 

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature


## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* closes #804 
* closes #767<issue>
* closes #669

## Test Plan
- [x]  Unit test
2022-09-15 21:38:52 +00:00
ashmrtn
6d5540cdf6
Empty path generates empty short ref (#868)
## Description

Fixup corner case on ShortRef so that empty paths generate the empty string. This makes some cases with generating short refs for each parent path to an item easier because the base case (empty path) is no different than other cases.

<!-- Insert PR description-->

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* part of #818 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2022-09-15 21:06:26 +00:00
Keepers
7cbee2bf58
correct default directory handling (#866)
## Description

Use $HOME as the config default.
Allow CORSO_CONFIG_DIR env to
override the default.  Allow the flag
--config-file to override either.

## Type of change

- [x] 🐹 Trivial/Minor

## Issue(s)

* #718

## Test Plan

- [x] 💚 E2E
2022-09-15 20:06:27 +00:00
Keepers
1d24d575ca
fix folder deletion failures (#867)
## Description

Graph clips time values ending in :00 from folder
names.  In order for the purge handler to check
the time values correctly, we need to identify
those folders and reinstate the 00 seconds tail.

## Type of change

- [x] 🐛 Bugfix

## Issue(s)

* #805

## Test Plan

- [x] 💪 Manual
2022-09-15 19:44:52 +00:00
Keepers
a6ba26cd92
generate events (#863)
## Description

Adds events for repo init, backup start and end,
and restore start and end.  Not all expected
values are available.  TODOs have been marked
for values that need future implementation.

## Type of change

- [x] 🌻 Feature

## Issue(s)

* #741

## Test Plan

- [x]  Unit test
2022-09-15 18:03:20 +00:00
Keepers
ed52a07e2f
utilize shorthash in selector sels (#854)
## Description

The details entry shorthash can be treated as
equal to the leaf item ID.  This adds support to
the selector reduce step to compare the leaf val
to either the path item ID or the shortHash.

## Type of change

- [x] 🌻 Feature

## Issue(s)

* closes #572

## Test Plan

- [ ] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
2022-09-15 16:53:03 +00:00
Keepers
a368570e20
improve ci cache management - initial cleanup (#849)
## Description

An attempt to minimize and centralize how we're caching go builds.
Not necessarily going to solve all our CI issues, but should make
changes building on this state much easier.

## Type of change

- [x] 💻 CI/Deployment

## Issue(s)

* #790

## Test Plan

- [ ] 💪 Manual
- [ ]  Unit test
- [x] 💚 E2E
2022-09-15 16:25:05 +00:00
Keepers
e92cb1b62b
extend logging support for testing (#850)
## Description

Updating logging to help display/control within testing envs.
Restore error tracking within gc iterators.

## Type of change

- [x] 🐛 Bugfix
- [x] 🤖 Test

## Issue(s)

* #824

## Test Plan

- [ ] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
2022-09-15 13:18:05 +00:00
Keepers
0c8a03a826
add the metrics package (#839)
## Type of change

- [x] 🌻 Feature

## Issue(s)

* #741

## Test Plan

- [ ] 💪 Manual
- [ ]  Unit test
- [x] 💚 E2E
2022-09-15 00:28:02 +00:00
ashmrtn
4cf5fcab5a
Use short ref during backup (#851)
## Description

Short refs allow the user to type less to select an item to restore. This PR
* Adds a short ref field to the BackupDetails entries
* Populates the short ref field during backup

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #572

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2022-09-15 00:09:28 +00:00
Danny
f8a10b4de6
GC: Restore: Split restore data into separate file. (#857)
## Description
Places `exchange.Restore` logic into single file
<!-- Insert PR description-->

## Type of change


- [x] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2022-09-14 23:22:52 +00:00
Danny
76a4f5531c
Issue 855: Removal of external participants. (#856)
## Description

Stops the generation of Inbox messages when events are created

## Type of change


- [x] 🐛 Bugfix

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* closes #855<issue>

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual

Verify that Inbox doesn't grow with undeliverable messages.
2022-09-14 23:09:22 +00:00
Keepers
02ad1a86b8
switch default corso config location (#836)
## Description

Swaps the default corso config location from
$HOME to /app/corso in order to align with docs.

## Type of change

- [x] 🐹 Trivial/Minor

## Issue(s)

* #718

## Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
2022-09-14 22:58:56 +00:00
Keepers
1295750206
use main version of fliechange checker (#858) 2022-09-14 18:39:24 -04:00
Keepers
b739526bb5
use dorny version of skipping workflow jobs (#768)
## Description

The current action workflow skips cause requried
actions to be marked as passing until they fail,
not marked as incomplete until either passed,
failed, or skipped.  This change should provide
the latter behavior.


## Type of change

- [x] 🌻 Feature

## Issue(s)

* #744

## Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
2022-09-14 22:23:17 +00:00
Keepers
bf014f8706
fix build script, try local build again (#848)
## Type of change

- [x] 🐛 Bugfix
- [x] 💻 CI/Deployment

## Issue(s)

* #573

## Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
2022-09-14 21:51:29 +00:00
ashmrtn
8b83a728ef
Add function to generate short refs for paths (#845)
Currently using 12 hex characters of a sha256 sum. This is expected to
start giving collisions after about 16.7M paths hashed.

Short refs are stable in the sense that calling ShortRef multiple times
on the same path will yield the same result. They can be used to
identify unique paths if desired, but extra lookup functionality will be
needed because short refs cannot be directly transformed back into a
path.
2022-09-14 12:47:24 -07:00
ashmrtn
f2b287498b
Use path struct between components during restore (#842)
* Parse path structs from backup details for restore

* Fixup kopia tests for new restore interface
2022-09-14 12:11:58 -07:00
ashmrtn
5ae8259fd5
Change return value of data.Collection.FullPath to path.Path (#841)
* Make data.Collection.FullPath return path.Path

* Fixup graph connector code for path struct

* Add Elements call to Path interface

Still should not be used in place of the named functions to get specific
path elements (e.x. ResourceOwner())

* Fixup kopia wrapper path handling

Mostly removing shim code and minor fixup for building the directory
tree.

* All the test fixes
2022-09-14 10:01:11 -07:00
ashmrtn
59a6bc672a
Use path struct while streaming data to kopia (#840)
* Helper function to append elements to a path

Kopia wrapper will need to create the complete path of an item by
joining the collection path and the item name. This allows it to do so
without having to drop to a path Builder (not service/category safe) and
go back to a resource path. Right now it does not handle escaping.

* Use path struct while streaming entries

Use new path struct while streaming entries to kopia. Preparation for
FullPath returning a path struct.

* Update tests to use valid path structures
2022-09-14 08:37:04 -07:00
Vaibhav Kamra
14205d61e2
Refactor restore helper (#838)
## Description

Small refactor of the data collection restore helper so that we can plug-in the OneDrive helpers in a 
follow-up PR

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [x] 🐹 Trivial/Minor

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ]  Unit test
- [x] 💚 E2E
2022-09-14 00:14:27 +00:00
ashmrtn
0e6ae32fc3
Add OneDrive path base structs (#833)
* Constants for OneDrive stuff

* Tests and constructor for OneDrive paths

* Populate onedrive path struct in data collection (#835)

* Helper function to make path structs for onedrive

* Use path struct in onedrive data collection

Does not change the external API at all, just the internals of how
FullPath functions and what is stored for the path.

* Wire up making data collections with path struct

Requires addition of tenant as input to Collections().

* Fixup onedrive Collections tests

* Wire up call to onedrive.NewCollections()

Just requires adding the tenant ID to the call.
2022-09-13 14:48:03 -07:00
ashmrtn
1d39d911ca
Use path struct in recovery of exchange (#837)
Preparation for data.Collection.FullPath returning path.Path instead of
[]string.
2022-09-13 14:34:55 -07:00
ashmrtn
226489c58f
use path struct in kopia DataCollection (#827)
* Use path struct in kopia DataCollection

Does not change the external API of the DataCollection any, just updates
internals in preparation for switching support of
data.Collection.FullPath.

* Expand Path interface slightly

kopia.Wrapper needs some extra functionality from paths, mostly along
the lines of directly manipulating the elements in the path. This gives
access to those functions.

* Use path struct in kopia.Wrapper for restore

Pass path structs to the newly created collections during restore.

* Add tests for new path functionality
2022-09-13 14:18:00 -07:00
ashmrtn
573f55686f
Make ExchangeDataCollection use path.Path internally (#820)
* Have exchange data collection store path.Path

Still complies with the old FullPath() string interface until we update
that.

* Pass path.Path to NewCollection for exchange

Basically fixes up errors introduced by previous commit.

* Fixup exchange recovery path indices

All exchange paths now use the path struct, meaning the service,
category, and user elements are in the standard positions.

* use path package in selector reduction (#822)

Currently, during a reduction process, scopes
compare their values to the raw split on repoRef.
This causes some brittle indexing to retrieve
values from the rr, carrying assumptions that are
difficult to track across changes.  This PR trades
the string split for the paths package to better
integrate identification of the path values.

Adds some mocks and amends some error
behaviors in order to fit paths into the current
testing schema.

Co-authored-by: Keepers <ryanfkeepers@gmail.com>
2022-09-13 13:58:20 -07:00
Vaibhav Kamra
a17d00c65f
Change client timeouts (#834)
Change HTTP client timeout from 30 to 90 seconds
2022-09-13 16:19:08 -04:00
ashmrtn
2b7d3877a4
Remove code to restore directory subtrees (#826)
Not used and don't have the time to figure out the best way to bend the
path struct API to get it to work nicely.
2022-09-13 09:29:17 -07:00
Danny
61f769cc15
812 gc retrieval function tests (#817)
Issue 812: Test Expansion
Retrieval functions added to the test exchange package.

Issue #831:
Retry handler added to message restore pipeline.
2022-09-13 11:33:08 -04:00
Vaibhav Kamra
16ad25f3a1
Implement wrapper around M365 helper methods (#825)
## Description

Exports functionality useful for external services/validators

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2022-09-13 10:32:02 +00:00
Keepers
c82dad6e40
flexible restore/details flags (#821)
removes the requriement that higher order data
must be specified in order to specify granular
data ids.  Ex: previously, cli users needed to add
--user and --folder flags in order to use a --mail
flag.  Now the user and folder will default to Any()
if they're not provided.
2022-09-12 18:13:50 -06:00
Keepers
fa489782a3
purge both mail and calendars (#813)
expands the `purge` command to accept args for
purging mail folders, calendars, or both.  This
allows the test cleanup to ensure we aren't over-
populating either mail folders or calendars, thus
blocking CI actions
2022-09-12 17:35:16 -06:00
ashmrtn
0a7954b300
Simplify exchange path constructors (#819)
Allows constructing Contacts and Events category type paths for Exchange.
They all need user and tenant filled in and only differ in the category given.
This makes it easier to call them in more generic situations, so long as the
category is known. It also consolidates code for constructing the paths of those
types.
2022-09-12 14:10:02 -07:00
ashmrtn
dc0c7e49c4
Remove selector pathType const in favor of path package const (#757)
* Remove pathType const

The path package const only provides information on the category, not
the service for the path.

* Fix var name/package name clashes
2022-09-12 13:16:08 -07:00
Keepers
110e874e5b
rename password to passphrase (#796)
General user friendliness renaming.  Will cause a
breaking change in any local environment for
developers and Ark.
2022-09-12 10:09:59 -06:00
Danny
432f984e61
GC: Backup:Event Feature to incorporate event ids for all calendars (#808)
Feature enhancement to include all Calendars in the event `restore-all` feature.
2022-09-12 08:17:04 -04:00
Keepers
964a2fc39e
new format for tabular display of timestamps (#793) 2022-09-09 20:43:18 -06:00
Keepers
a226035c23
clean out scope value chaff (#731) 2022-09-09 19:21:31 -06:00
Keepers
25ce11b2c6
deduplicate shared exchange code in cli (#732) 2022-09-09 18:30:15 -06:00