Skip to content

Commit

Permalink
Add support for Wercker CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Nov 15, 2016
1 parent c7917be commit c8c709c
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ gocommon

Common Go library for Joyent's Triton and Manta.

[![wercker status](https://app.wercker.com/status/2f63bf7f68bfdd46b979abad19c0bee0/s/master "wercker status")](https://app.wercker.com/project/byKey/2f63bf7f68bfdd46b979abad19c0bee0)

## Installation

Use `go-get` to install gocommon.
Expand Down Expand Up @@ -70,7 +72,20 @@ upstream [email protected]:joyent/gocommon.git (push)

### Run Tests

The library needs values for the `SDC_URL`, `MANTA_URL`, `MANTA_KEY_ID` and `SDC_KEY_ID` environment variables even though the tests are run locally. You can generate a temporary key and use its fingerprint for tests without adding the key to your Triton Cloud account.

```
# create a temporary key
ssh-keygen -b 2048 -C "Testing Key" -f /tmp/id_rsa -t rsa -P ""
# set up environment
# note: leave the -E md5 argument off on older ssh-keygen
export KEY_ID=$(ssh-keygen -E md5 -lf /tmp/id_rsa | awk -F' ' '{print $2}' | cut -d':' -f2-)
export SDC_KEY_ID=${KEY_ID}
export MANTA_KEY_ID=${KEY_ID}
export SDC_URL=https://us-east-1.api.joyent.com
export MANTA_URL=https://us-east.manta.joyent.com
cd ${GOPATH}/src/github.com/joyent/gocommon
go test ./...
```
Expand Down
2 changes: 1 addition & 1 deletion errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (
RequestTooLargeError = Code("RequestTooLarge")
RequestMovedError = Code("RequestMoved")
ResourceNotFoundError = Code("ResourceNotFound")
UnknownErrorError = Code("UnkownError")
UnknownErrorError = Code("UnknownError")
)

// Error instances store an optional error cause.
Expand Down
40 changes: 40 additions & 0 deletions wercker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
box: golang

build:
steps:
# Sets the go workspace and places you package
# at the right place in the workspace tree
- setup-go-workspace:
package-dir: github.com/joyent/gocommon

# Gets the dependencies
- script:
name: go get
code: |
go get -v -t ./...
# Build the project
- script:
name: go build
code: |
go build ./...
- script:
name: make a new key for testing
code: |
ssh-keygen -b 2048 \
-C "Testing Key" \
-f /root/.ssh/id_rsa \
-t rsa \
-P ""
# Test the project
- script:
name: go test
code: |
export KEY_ID=$(ssh-keygen -lf /root/.ssh/id_rsa | awk -F' ' '{print $2}' | cut -d':' -f2-)
export SDC_KEY_ID=${KEY_ID}
export MANTA_KEY_ID=${KEY_ID}
export SDC_URL=https://us-east-1.api.joyent.com
export MANTA_URL=https://us-east.manta.joyent.com
go test ./...

0 comments on commit c8c709c

Please sign in to comment.