Commit graph

316 commits

Author SHA1 Message Date
Brian Bland
94052ea213 Fixes normalization of inmemory file paths
A normalized path always begins with "/" and never has a trailing slash
unless it is the root directory.
2014-12-09 17:20:10 -08:00
Stephen J Day
722ca35841 Test Tags HTTP API methods during manifest upload 2014-12-09 15:36:26 -08:00
Stephen J Day
10e5276c0e Add error code for unknown repository 2014-12-09 14:19:38 -08:00
Stephen J Day
33b2b80a8c Remove errant log message 2014-12-09 14:19:07 -08:00
Stephen J Day
49d13f9a08 Move manifest store errors to where they happen 2014-12-09 13:40:44 -08:00
Stephen J Day
6cbd22c5f0 Implement tags HTTP API handler 2014-12-09 13:38:07 -08:00
Stephen J Day
c71089c653 Implement Tags method on ManifestService 2014-12-09 13:37:21 -08:00
Olivier Gambier
a8ecb17d7e Merge pull request #833 from stevvooe/next-generation
Address bug in inmemory filesystem WriteAt method
2014-12-09 00:56:32 -08:00
Stephen J Day
45c29be442 Address bug in inmemory filesystem WriteAt method 2014-12-08 21:08:07 -08:00
Brian Bland
cacf33ab62 Uses random paths with slashes for storagedriver tests, adds edge cases
This replaces only using flat filenames, to better test nested file
behaviors.
Fixed inmemory/mfs.go and filesystem/driver.go after finding bugs with
the new tests and test behavior.
2014-12-08 19:26:29 -08:00
Brian Bland
9e38ca2231 Runs s3 storagedriver tests against all regions (excluding gov) 2014-12-08 16:16:36 -08:00
Olivier Gambier
f3f70d151d Merge pull request #820 from stevvooe/ng-storagedriver-updates
StorageDriver interface changes and cleanup
2014-12-08 12:48:15 -08:00
Stephen J Day
e364e71aab Address go vet declaration issue in tests 2014-12-08 09:51:59 -08:00
Stephen J Day
e15e07cb40 Disable race detector during tests due to memory usage
The tests are using way too much memory with the race detector enabled causing
the build machines to fall over. Cursory profiling shows no leaks but it may
need a closer look. For now, it will be disabled but this cannot be permanent.
2014-12-05 20:22:36 -08:00
Stephen J Day
14e7adb3a0 Add documentation for (*DriverSuite).TestStatCall 2014-12-05 19:20:42 -08:00
Stephen J Day
a7017d6873 Merge branch 'next-generation' into ng-storagedriver-updates 2014-12-05 19:17:51 -08:00
Stephen Day
2ab1de344a Merge pull request #827 from stevvooe/circleci-setup
Use circleci for continuous builds
2014-12-05 19:17:01 -08:00
Stephen J Day
1a25a34c5d Use circleci for continuous builds 2014-12-05 19:12:33 -08:00
Stephen J Day
1a75fccb43 Address PathNotFoundError in (*manifestStore).Exists
Exists was returning an error when encountering a PathNotFoundError when it
should just return false without an error.
2014-12-05 14:34:54 -08:00
Stephen J Day
2f78886aac Disable s3 and ipc executable entry points 2014-12-05 14:34:22 -08:00
Stephen J Day
8cb0e3398c Disable s3, azure and ipc packages and testing
The packages causing build errors are being disabled for now to let us split up
the work in the different driver implementations without blocking integration
into the main branch. The s3 and azure implementations need some effort to add
Stat support. The ipc package needs that work plus some care around hanging
send calls.
2014-12-05 14:05:37 -08:00
Stephen J Day
d703a86a64 Add checks for ReadStream offset boundary conditions
Several checks for ReadStream with offset around boundary conditions were
missing. The new checks ensure negative offsets are detected and io.EOF is
returned properly when trying to read past the end of a file. The filesystem
and inmemory driver have been updated accordingly.

An outline of missing checks for List are also part of this commit. Action will
be taken here based on discussion in issue #819.
2014-12-05 11:46:41 -08:00
Stephen J Day
70ab06b864 Update storage package to use StorageDriver.Stat
This change updates the backend storage package that consumes StorageDriver to
use the new Stat call, over CurrentSize. It also makes minor updates for using
WriteStream and ReadStream.
2014-12-04 20:55:59 -08:00
Stephen J Day
2ebc373d91 Refactor inmemory driver for Stat and WriteStream methods
This change started out as simply updating the existing inmemory driver to
implement the new Stat call. After struggling with the map based
implementation, it has been refactored to be a tree-based implementation.

This process has exposed a few missing error cases in the StorageDriver API
that should be addressed in the coming weeks.
2014-12-04 20:25:14 -08:00
Stephen J Day
ab9570f872 Migrate filesystem driver to new storagedriver calls
The filesystem driver has been migrated to impleemnt the storagedriver
interface changes. Most interetingly, this provides a filesystem-based
implementation of the Stat driver call. With this comes some refactoring of
Reads and Write to be much simpler and more robust.

The IPC tests have been disabled to stability problems that we'll have to
troubleshoot at a later date.
2014-12-03 16:47:31 -08:00
Stephen J Day
2037b1d6bf Update testsuite with storagedriver interface changes
This change updates the testsuite to migrate to the new driver interface. This
includes the new Stat call, changes to int64 over uint64 and the changes to the
WriteStream signature. Several test cases have been added to vet
implementations against various assumptions.
2014-12-03 16:37:46 -08:00
Stephen J Day
2e3ecdca37 Remove size argument and using io.Reader for StorageDriver.WriteStream
We are change the the rpc call for WriteStream to not require the size
argument, opting to drive the process with io.Reader. The main issue was that
io.Reader may return io.EOF before reaching size, making the error handling
around this condition for callers more complex. To complement this, WriteStream
now returns the number of successfully written bytes.

The method no longer requires an io.ReadCloser, opting to require just an
io.Reader. This keeps the reader under the control of the caller, which
provides more flexibility.

This also begins to address some of the problems described in #791.
2014-12-02 21:47:28 -08:00
Stephen J Day
ac660e72bf Replace StorageLayer.CurrentSize interface call with Stat
To support single-flight Size and ModTime queries against backend storage file,
we are replacing the CurrentSize call with a Stat call. A FileInfo interface is
provided for backends to provide a type, with a default implementation called
FileInfoInternal, for use by driver implementations.

More work needs to follow this change to update all the driver implementations.
2014-12-02 21:00:42 -08:00
Stephen J Day
b047c92e1c Use sync.WaitGroup to control concurrent tests 2014-12-02 20:43:31 -08:00
Stephen J Day
66107df1af Use int64 for ReadStream and WriteStream offsets
This change brings the storagedriver API in line with the Go standard library's
use of int64 for offsets. The main benefit is simplicity in interfacing with
the io library reducing the number of type conversions in simple code.
2014-12-02 19:01:00 -08:00
Olivier Gambier
511827efe2 Merge pull request #801 from ahmetalpbalkan/next-generation-azure-storagedriver
NG: Microsoft Azure storage driver
2014-12-02 13:45:52 -08:00
Olivier Gambier
e0414278d3 Merge pull request #806 from stevvooe/ng-registry-main
NG: Add registry main cmd
2014-12-02 12:34:59 -08:00
Olivier Gambier
efa4e03519 Merge pull request #807 from stevvooe/ng-nonzero-exit-error
StorageDrivers should exit non-zero on error (closes #803)
2014-12-02 12:33:08 -08:00
Olivier Gambier
fc1db3ad10 Merge pull request #805 from stevvooe/ng-manifest-bugs
NG: Various Manifest Oriented bugfixes
2014-12-01 18:45:12 -08:00
Ahmet Alp Balkan
4054cd3e73 Azure storage driver implementation
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2014-12-01 18:38:23 -08:00
Stephen J Day
54c0290cda StorageDrivers should exit non-zero on error (closes #803) 2014-12-01 18:25:10 -08:00
Stephen J Day
17b32e0aa0 Add TODO about manifest tampering test 2014-12-01 17:40:14 -08:00
Stephen J Day
3301626830 Add registry main cmd 2014-12-01 17:36:20 -08:00
Stephen J Day
dd8eb6a8df configuration.Parse should take io.Reader 2014-12-01 17:32:31 -08:00
Stephen J Day
e6e0219065 Avoid manifest verification errors by using Raw
Because json.Marshal does compaction on returned results, applications must
directly use SignedManifest.Raw when the marshaled value is required.
Otherwise, the returned manifest will fail signature checks.
2014-12-01 17:10:33 -08:00
Stephen J Day
8c7bec72b1 Cleanup image verification error handling
This diff removes a few early outs that caused errors to be unreported and
catches a missed error case for signature verification from libtrust. More work
needs to be done around ensuring consistent error handling but this is enough
to make the API work correctly.
2014-12-01 16:13:01 -08:00
Stephen J Day
b73a6c1998 Use json.MashalIndent for raw manifest json
This provides compatibility with what is in docker core, ensuring that image
manifests generated here have the same formatting. We'll need to automate this
some how.
2014-12-01 16:11:27 -08:00
Stephen J Day
98f5f30e75 Create copy of buffer for SignedManifest.Raw
Without this copy, the buffer may be re-used in the json package, causing
missing or corrupted content for the long-lived SignedManifest object. By
creating a new buffer, owned by the SignedManifest object, the content remains
stable.
2014-12-01 15:57:05 -08:00
Olivier Gambier
f497bceffa Merge pull request #794 from stevvooe/ng-client-race-condition
Address race condition in client tests (closes #784)
2014-12-01 10:10:43 -08:00
Olivier Gambier
af72f6cc94 Merge pull request #792 from stevvooe/next-generation
Initial implementation of Manifest HTTP API
2014-12-01 10:10:35 -08:00
Stephen J Day
c706657502 Address race condition in client tests (closes #784) 2014-11-26 15:37:27 -08:00
Olivier Gambier
9da63d0bd2 Merge pull request #793 from stevvooe/update-go-version
Correct ENV declaration in Dockerfile
2014-11-26 13:53:59 -08:00
Stephen J Day
e809796f59 Initial implementation of Manifest HTTP API
Push, pull and delete of manifest files in the registry have been implemented
on top of the storage services. Basic workflows, including reporting of missing
manifests are tested, including various proposed response codes. Common testing
functionality has been collected into shared methods. A test suite may be
emerging but it might better to capture more edge cases (such as resumable
upload, range requests, etc.) before we commit to a full approach.

To support clearer test cases and simpler handler methods, an application aware
urlBuilder has been added. We may want to export the functionality for use in
the client, which could allow us to abstract away from gorilla/mux.

A few error codes have been added to fill in error conditions missing from the
proposal. Some use cases have identified some problems with the approach to
error reporting that requires more work to reconcile. To resolve this, the
mapping of Go errors into error types needs to pulled out of the handlers and
into the application. We also need to move to type-based errors, with rich
information, rather than value-based errors. ErrorHandlers will probably
replace the http.Handlers to make this work correctly.

Unrelated to the above, the "length" parameter has been migrated to "size" for
completing layer uploads. This change should have gone out before but these
diffs ending up being coupled with the parameter name change due to updates to
the layer unit tests.
2014-11-26 13:35:07 -08:00
Stephen J Day
4a4d403655 Correct ENV declaration in Dockerfile 2014-11-26 13:19:45 -08:00
Stephen J Day
6fead90736 Rich error reporting for manifest push
To provide rich error reporting during manifest pushes, the storage layers
verifyManifest stage has been modified to provide the necessary granularity.
Along with this comes with a partial shift to explicit error types, which
represents a small move in larger refactoring of error handling. Signature
methods from libtrust have been added to the various Manifest types to clean up
the verification code.

A primitive deletion implementation for manifests has been added. It only
deletes the manifest file and doesn't attempt to add some of the richer
features request, such as layer cleanup.
2014-11-26 12:57:14 -08:00