Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Commit

Permalink
add readme for testing in staging
Browse files Browse the repository at this point in the history
  • Loading branch information
farthir committed Jul 9, 2019
1 parent 316334f commit 18709a2
Showing 1 changed file with 48 additions and 2 deletions.
50 changes: 48 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,68 @@ region=eu-west-1
$ go build
```

## Testing
## Running Unit Tests

```
$ go test ./...
```

## Testing on Staging
There is no dedicated test environment in staging for Paddle, but it is possible to test in staging using another Canoe pipeline that uses Paddle.

1. Download and setup a pipeline repo that can be tested in staging, for example [`rider-planning-pipeline`](https://github.com/deliveroo/rider-planning-pipeline). Make sure you can build at least one of the pipeline steps listed in the definition `yml` file. The step should also contain inputs from a previous step if the paddle `get` command needs to be tested.
2. Modify the paddle template.go `podTemplate` to use a temporary paddlecontainer tag. e.g `localtest001`. The `latest` tag cannot be used as it is pulled into production images.
```
...
image: "219541440308.dkr.ecr.eu-west-1.amazonaws.com/paddlecontainer:localtest001"
...
```
3. Copy the paddle build that needs to be tested to root of pipeline repo. Build using:
```
go build
```
4. Copy a linux+amd64 paddle build that needs to be tested to the root of a new directory. Build for linux+amd64 using:
```
GOOS=linux GOARCH=amd64 go build
```
5. Create a new Dockerfile in the same directory with the following content:
```
FROM ubuntu
RUN apt-get update
RUN apt-get install -y ca-certificates curl wget
COPY ./paddle /usr/bin/paddle
```
6. From a shell, build and push a Docker image using the Dockerfile. Ensure local AWS credentials are setup to enable login.
**The image _must_ be built using a tag other than `latest` otherwise the image used in production will be overwritten!** In the example below, `localtest001` has been used to match the change made above.
```
$(aws ecr get-login --profile k8s_production --no-include-email --region eu-west-1)
docker build -t 219541440308.dkr.ecr.eu-west-1.amazonaws.com/paddlecontainer:localtest001 .
docker push 219541440308.dkr.ecr.eu-west-1.amazonaws.com/paddlecontainer:localtest001
```
7. Modify the testing step(s) in the pipeline `yml` file with the test paddle container tag e.g. `localtest001` and make any other amendements as necessary.
8. Re-run the pipeline to test the new version of paddle.
9. If successful, follow the process below to release a new version of paddle.
## Release
In order to release a new version, set up github export GITHUB_TOKEN=[YOUR_TOKEN]. Make sure that you have goreleaser installed from [goreleaser.com](http://goreleaser.com).
Ensure your git repo is clean. Then update VERSION (no need to commit it, it will be committed automatically), and run:
Ensure your git repo is clean, new PRs have already merged and your branch is set to master. Then update VERSION (no need to commit it, it will be committed automatically), and run:
```
$ ./release.sh
```
If the final `goreleaser` part of this process fails (e.g. due to a missing GITHUB_TOKEN or `goreleaser` install), the version will have likely been incremented and pushed to origin already. In this case, run the final `goreleaser` step manually:
```
goreleaser --rm-dist
```
## Usage
```
Expand Down

0 comments on commit 18709a2

Please sign in to comment.