Commit Graph

17 Commits

Author SHA1 Message Date
Sunny 9b5613732f storage: Return details about the deleted items
Update Storage.RemoveAll() and Storage.RemoveAllButCurrent() to return
the details about the deleted items. This helps emit useful information
about garbage collection in the controllers and ignore no-op garbage
collections.

RemoveAll() returns the path of the deleted directory if any.
RemoveAllButCurrent() returns a slice of path of all the deleted items
from a resource's artifact dir.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-02-23 12:35:30 +01:00
Hidde Beydals 028a85d61a controllers: cleanup TestStorageCopyFromPath files
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-02-23 12:35:30 +01:00
Hidde Beydals 7c3c14997e Switch to v1beta2 API package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-02-23 12:35:25 +01:00
Kevin McDermott c397ff902b Ensure that directories are included.
This avoids skipping the directories when generating the archive
tarball.

This makes it easier to scan directory trees.

Signed-off-by: Kevin McDermott <kevin@weave.works>

Ensure that directories are included.

This avoids skipping the directories when generating the archive
tarball.

This makes it easier to scan directory trees.

Signed-off-by: Kevin McDermott <kevin@weave.works>
2022-01-20 13:58:44 +00:00
Tom Huang 5bb428349e
proper file close operation based on feedback
Signed-off-by: Tom Huang <tom.huang@weave.works>
2022-01-11 15:50:25 -05:00
Tom Huang 8868d3938a
Update file close operation to not use defer and add test case for CopyFromPath
Signed-off-by: Tom Huang <tom.huang@weave.works>
2022-01-11 13:23:17 -05:00
Hidde Beydals c4d7e46b90 Drop deprecated `io/ioutil`
The package has been deprecated since Go 1.16, see:
https://golang.org/doc/go1.16#ioutil

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-29 09:58:00 +02:00
Hidde Beydals b5004a93bc Make Storage#Archive file filtering configurable
This commit makes the filtering applied during the archiving
configurable by introducing an optional `ArchiveFileFilter`
callback argument and a `SourceIgnoreFilter` implementation.

`SourceIgnoreFilter` filters out files matching
sourceignore.VCSPatterns and any of the provided patterns.
If an empty gitignore.Pattern slice is given, the matcher is set to
sourceignore.NewDefaultMatcher.

The `GitRepository` now loads the ignore patterns before archiving
the repository contents by calling `sourceignore.LoadIgnorePatterns`
and other helpers. The loading behavior is **breaking** as
`.sourceignore` files in the (subdirectories of the) repository are
now still taken into account if `spec.ignore` for a resource is
defined, overwriting is still possible by creating an overwriting
rule in the `spec.ignore` of the resource.

This change also makes it possible for the `BucketReconciler` to not
configure a callback at all and prevent looking for ignore
matches twice. To finalize the bucket refactor, a change to the
reconciler has been made to look for a `.sourceignore` file in
the root of the bucket to provide an additional way of configuring
(global) exclusions.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-04-13 15:34:20 +02:00
Stefan Prodan 9a08c0cc52
Add well-known CI configs to exclusion list
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-31 14:39:12 +03:00
stefanprodan f16e5f041a Promote API to v1beta1 2020-09-30 16:11:00 +03:00
stefanprodan c2c61b10a1 Implement S3 Bucket controller 2020-09-18 16:11:24 +03:00
Hidde Beydals 42706a342b Calculate checksums during file writes 2020-09-10 13:00:08 +02:00
Hidde Beydals 68ccf2598f storage: actually record relative path in artifact 2020-09-09 16:32:25 +02:00
Hidde Beydals 0b752178b1 storage: only store relative path in artifact
As the storage base directory is determined during runtime, and
artifacts may live longer than that if they are e.g. stored in a
persistent volume but the mount path configuration changes.
2020-09-08 17:21:56 +02:00
Erik Hollensbe 687b79a7dd Storage: fix a small bug in RemoveAllButCurrent when the directory is invalid
filepath.Walk can return a `nil` for the stat value, when it does, the
directory is invalid and the error will be set. This causes a
panic+crash if the directory does not currently exist when
RemoveAllButCurrent is called.

The following patch makes the behavior an error instead.

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2020-07-15 18:50:09 +00:00
stefanprodan b9dc2ecf64 Add ignore field to GitRepository spec 2020-07-09 14:48:02 +03:00
Erik Hollensbe a723b9e3e7 Archive and storage tests
Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2020-07-08 23:23:33 +00:00