Skip to content

Commit

Permalink
update readme, add more CI setup (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Dolitsky <[email protected]>
  • Loading branch information
jdolitsky committed Nov 16, 2018
1 parent 4342a13 commit 3667b41
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .codefresh/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ steps:
working_directory: /go/src/github.com/chartmuseum
commands:
- ln -s /codefresh/volume/${{CF_REPO_NAME}} storage && cd storage
- make test
- make ci-setup testcloud
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ clean:
covhtml:
open coverage.html

.PHONY: ci-setup
ci-setup:
@mkdir -p $(HOME)/.oci
@echo $(ORACLE_CONFIG) | base64 --decode --ignore-garbage > $(HOME)/.oci/config
@echo $(ORACLE_KEY) | base64 --decode --ignore-garbage > $(HOME)/.oci/oci_api_key.pem
@chmod go-rwx $(HOME)/.oci/*
@echo $(GCLOUD_SERVICE_KEY) | base64 --decode --ignore-garbage > $(HOME)/gcp-key.json

.PHONY: test
test:
rm -rf .test/ && mkdir .test/
Expand Down
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# chartmuseum/storage

[![Codefresh build status](https://g.codefresh.io/api/badges/pipeline/chartmuseum/chartmuseum%2Fstorage%2Fmaster?type=cf-1)](https://g.codefresh.io/public/accounts/chartmuseum/pipelines/chartmuseum/storage/master)
[![Go Report Card](https://goreportcard.com/badge/github.com/chartmuseum/storage)](https://goreportcard.com/report/github.com/chartmuseum/storage)
[![GoDoc](https://godoc.org/github.com/chartmuseum/storage?status.svg)](https://godoc.org/github.com/chartmuseum/storage)

Go library providing a common interface for working across multiple storage backends.

Expand All @@ -14,14 +16,17 @@ Supported storage backends:
- [Openstack Object Storage](https://developer.openstack.org/api-ref/object-store/)
- [Oracle Cloud Infrastructure Object Storage](https://cloud.oracle.com/storage)

*This code was originally part of the [Helm](https://github.com/helm/helm) project, [ChartMuseum](https://github.com/helm/chartmuseum),
but has since been released as a standalone package for others to use in their own projects.*

## Primary Components

### Backend (interface)

`Backend` is a common interface that is implemented by all the supported storage backends and their associated types:

```go
Backend interface {
type Backend interface {
ListObjects(prefix string) ([]Object, error)
GetObject(path string) (Object, error)
PutObject(path string, content []byte) error
Expand All @@ -34,18 +39,41 @@ Backend interface {
`Object` is a struct that represents a single storage object:

```go
Object struct {
type Object struct {
Path string
Content []byte
LastModified time.Time
}
```

### ObjectSliceDiff (struct)

`ObjectSliceDiff` is a struct that represents overall changes between two `Object` slices:

```go
type ObjectSliceDiff struct {
Change bool
Removed []Object
Added []Object
Updated []Object
}
```

### GetObjectSliceDiff (function)

`GetObjectSliceDiff` is a function that takes two `Object` slices, compares them, and returns an `ObjectSliceDiff`:

```go
func GetObjectSliceDiff(os1 []Object, os2 []Object) ObjectSliceDiff
```


## Usage

### Simple example

The following is a simple program that will upload a file either to an Azure Blob Storage bucket (container) or a Google Cloud Storage bucket based on the command line options provided:

```go
// Usage: go run example.go <cloud> <bucket> <file>

Expand Down Expand Up @@ -115,4 +143,7 @@ go run example.go google mybucket index.html

### Per backend

TODO
Each supported storage backend has its own type that implements the `Backend` interface.
All available types are described in detail on [GoDoc](https://godoc.org/github.com/chartmuseum/storage).

In addition, authentication methods are based on the runtime environment and vary from cloud to cloud.

0 comments on commit 3667b41

Please sign in to comment.