go_builder 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.travis.yml +2 -2
- data/README.md +109 -5
- data/lib/go_builder/go_docker.rb +3 -0
- data/lib/go_builder/version.rb +1 -1
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NWZhODJmYjg2NzgwODA5ZjY4NDIwNzA1NDczMDJkY2QxYTU5NDE0Ng==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YTNhNmIyNzJiYzUwNTEwNGQ5OTdkNTkxMDZmMTRmOTE1OTkzNGI1MA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjI5MGM2ZmZkMTZhYzUxYWUzM2Q5ZTg1OTk5YjRiM2ZkY2YyZjJkZjUyMTQz
|
10
|
+
YTQ1NzU0NGI3YjdiMWNlMzRmOTkzMzlmY2Y5ZmEwY2EzY2Q0NmVmMDZjNWRm
|
11
|
+
ZjIxYThjMDdhZDAzNDc5MjMzMWMwNWZkYjI2YjljYzVmMzJlNmE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OWI5NDExOWQxMDA3NWMyYTllMDA2NGQ0YWJmYzlhM2Q4OWVlNWU3Zjg3NGQx
|
14
|
+
OTIwYzkwYzE5OTRhMGZlYmUwYjg4YTg2ZDdiZTcwODg0OTZmOWM2NjQ0NjI1
|
15
|
+
ZDczYmQxOTMwMmFiYWY3OTA0MjdiNmRkYWFlYTJkMTE1MjU3MGU=
|
data/.travis.yml
CHANGED
@@ -7,8 +7,8 @@ script:
|
|
7
7
|
- rake build
|
8
8
|
deploy:
|
9
9
|
provider: rubygems
|
10
|
-
api_key:
|
11
|
-
secure: GRtgzVc4BWoriFpF1h57w1ndS8HhI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6hWoHKk7/vMn5u2pdMRUykArAJ6++JxRSitaKSXn0xZfRKvszp00WhHiG4kPtQXgNKiJiuOKX9huy+gHssYfP3sxcd0LNrslnxaGRAn0igRHuBeaIi8kxL+03q1tCSjOcc6OV9qPIgZAiGUdeeolefrXFTovptcG5PiDzq6jJoQSO51kRMhG/XGfuf2T+vpl5ouT2dsYSz8qDchX5LEjcjuBXb3J1/Xz5s1oQjGI1w+bSrZ1OAFv0d5v8jcD9IyF4C7iVuqCtlc0bNkm9ZgwG+iHHj/SxezFPCttVFBS2or6YizA2xAONXkuy2g+yUDZplcX56fe0oIQsOJOjc=
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# GoBuilder
|
2
|
+
[![Build Status](https://travis-ci.org/nicholasjackson/go_builder.svg?branch=master)](https://travis-ci.org/nicholasjackson/go_builder)
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
4
|
+
Go Builder is an opinionated build system for Go microservices and Docker, it scaffolds the build, run and test (go test and cucumber) phases of your microservice project.
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
@@ -20,9 +19,115 @@ Or install it yourself as:
|
|
20
19
|
|
21
20
|
$ gem install go_builder
|
22
21
|
|
22
|
+
## Dependencies
|
23
|
+
|
24
|
+
### Docker
|
25
|
+
You need to have docker, docker-machine, and docker-compose installed on your build machine and the docker envrionment variables must be set. If using the docker-toolkit on a mac you can set these by running...
|
26
|
+
```bash
|
27
|
+
eval "$(docker-machine env default)"
|
28
|
+
```
|
29
|
+
|
23
30
|
## Usage
|
31
|
+
Include the rake tasks in your Rakefile
|
32
|
+
```ruby
|
33
|
+
require 'go_builder'
|
24
34
|
|
25
|
-
|
35
|
+
spec = Gem::Specification.find_by_name 'go_builder'
|
36
|
+
Rake.add_rakelib "#{spec.gem_dir}/lib/go_builder/rake"
|
37
|
+
```
|
38
|
+
|
39
|
+
By default Go builder looks for a config file (config.yml) in the same folder as your Rakefile
|
40
|
+
|
41
|
+
Go builder provides the following tasks...
|
42
|
+
|
43
|
+
### rake app:test
|
44
|
+
Gets your packages dependencies then executes go test against the package.
|
45
|
+
|
46
|
+
### rake app:build
|
47
|
+
Creates a linux binary for your application, runs app:test before execution.
|
48
|
+
|
49
|
+
### rake app:build_server
|
50
|
+
Creates a docker image for your application, runs app:build before execution.
|
51
|
+
|
52
|
+
### rake app:build_and_run
|
53
|
+
Creates a docker image for your application then starts the application using docker-compose, runs app:build_server before execution.
|
54
|
+
|
55
|
+
### rake app:cucumber[optional feature tag]
|
56
|
+
Starts the application and then runs cucumber to execute your features, you can optionally pass a feature tag to this command to configure which part of your test suite you would like to run. Does not build the server before running, this needs to be done when you change your source code with app:build_server.
|
57
|
+
|
58
|
+
### rake app:push
|
59
|
+
Pushes the built image to the configured registry, does not build the image before execution, this can be done manually with app:build_server.
|
60
|
+
|
61
|
+
## Config File
|
62
|
+
The config file config.yml is where you set the various configuration for the build process.
|
63
|
+
|
64
|
+
### Example Config File
|
65
|
+
```yaml
|
66
|
+
go:
|
67
|
+
namespace: 'github.com/nicholasjackson'
|
68
|
+
application_name: 'event-sauce'
|
69
|
+
docker_registry:
|
70
|
+
url: <%= ENV['DOCKER_REGISTRY_URL'] %>
|
71
|
+
user: <%= ENV['DOCKER_REGISTRY_USER'] %>
|
72
|
+
password: <%= ENV['DOCKER_REGISTRY_PASS'] %>
|
73
|
+
email: <%= ENV['DOCKER_REGISTRY_EMAIL'] %>
|
74
|
+
namespace: <%= ENV['DOCKER_NAMESPACE'] %>
|
75
|
+
docker:
|
76
|
+
docker_file: './'
|
77
|
+
compose_file: './'
|
78
|
+
build_args:
|
79
|
+
image: 'golang:latest'
|
80
|
+
env:
|
81
|
+
- 'CGO_ENABLED=0' # used for alpine linux static linking
|
82
|
+
working_directory: '/go/src/github.com/nicholasjackson/event-sauce'
|
83
|
+
run:
|
84
|
+
consul_loader:
|
85
|
+
enabled: true
|
86
|
+
config_file: './config.yml'
|
87
|
+
url: <%= "http://#{ENV['DOCKER_IP']}:9500" %>
|
88
|
+
cucumber:
|
89
|
+
consul_loader:
|
90
|
+
enabled: true
|
91
|
+
config_file: './config.yml'
|
92
|
+
url: <%= "http://#{ENV['DOCKER_IP']}:9500" %>
|
93
|
+
health_check:
|
94
|
+
enabled: true
|
95
|
+
url: <%= "http://#{ENV['DOCKER_IP']}:8001/v1/health" %>
|
96
|
+
after_start:
|
97
|
+
- 'wait_for_elastic_search'
|
98
|
+
after_build:
|
99
|
+
copy_assets:
|
100
|
+
-
|
101
|
+
from: <%= "#{ENV['GOPATH']}/src/github.com/nicholasjackson/event-sauce/event-sauce" %>
|
102
|
+
to: './docker/event-sauce'
|
103
|
+
-
|
104
|
+
from: './swagger_spec/swagger.yml'
|
105
|
+
to: './dockerfile/event-sauce/swagger_spec/swagger.yml'
|
106
|
+
```
|
107
|
+
|
108
|
+
#### go:
|
109
|
+
This section contains the configuration for the build process.
|
110
|
+
**namespace:** namespace for your application code within your GOPATH, this is generally the same as your repository.
|
111
|
+
**application_name:** name of the built binary.
|
112
|
+
|
113
|
+
#### docker_registry:
|
114
|
+
This section contains the configuration for the docker registry to push the image to. Images are pushed to the registry prefixed with the namespace and application_name, e.g. nicholasjackson/event-sauce:latest.
|
115
|
+
**url:** url for the docker registry.
|
116
|
+
**user:** username to use when logging into the registry.
|
117
|
+
**password:** password to use when logging into the registry.
|
118
|
+
**email:** email address to use when logging into the registry.
|
119
|
+
**namespace:** namespace of your image to use when pushing the image to the registry.
|
120
|
+
|
121
|
+
#### docker:
|
122
|
+
This section contains configuration for the Docker build and run process.
|
123
|
+
**docker_file:** path to the folder containing your Dockerfile used by the build_server task.
|
124
|
+
**compose_file:** path to your docker-compose file for run and cucumber tasks.
|
125
|
+
|
126
|
+
#### run:
|
127
|
+
##### consul_loader:
|
128
|
+
When the application is run using docker-compose you can load some default config into your consul server. Told you this was opinionated, if you are building microservices you are using consul right?
|
129
|
+
**enabled:** boolean determining if this feature is enabled.
|
130
|
+
**config_file:** path to a yaml file containing the key values you would like to load into consul. consul_loader flattens the structure of your yaml file and converts this into key values. For more information please see []()
|
26
131
|
|
27
132
|
## Development
|
28
133
|
|
@@ -38,4 +143,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
38
143
|
## License
|
39
144
|
|
40
145
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/lib/go_builder/go_docker.rb
CHANGED
@@ -71,7 +71,10 @@ module GoBuilder
|
|
71
71
|
image.tag('repo' => "#{args['docker_registry']['namespace']}/#{args['go']['application_name']}", 'force' => true) unless image.info["RepoTags"].include? "#{args['docker_registry']['namespace']}/#{args['go']['application_name']}:latest"
|
72
72
|
|
73
73
|
system("docker login -u #{args['docker_registry']['user']} -p #{args['docker_registry']['password']} -e #{args['docker_registry']['email']} #{args['docker_registry']['url']}")
|
74
|
+
abort "Unable to login" unless $?.exitstatus == 0
|
75
|
+
|
74
76
|
system("docker push #{args['docker_registry']['namespace']}/#{args['go']['application_name']}:latest")
|
77
|
+
abort "Unable to push to registry" unless $?.exitstatus == 0
|
75
78
|
end
|
76
79
|
end
|
77
80
|
end
|
data/lib/go_builder/version.rb
CHANGED
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nic Jackson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cucumber
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '10.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: docker-api
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rest-client
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.8'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.8'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: consul_loader
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.0'
|
111
111
|
description:
|
@@ -115,11 +115,11 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
-
|
119
|
-
-
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
|
+
- .ruby-gemset
|
121
|
+
- .ruby-version
|
122
|
+
- .travis.yml
|
123
123
|
- CODE_OF_CONDUCT.md
|
124
124
|
- Gemfile
|
125
125
|
- LICENSE.txt
|
@@ -147,17 +147,17 @@ require_paths:
|
|
147
147
|
- lib
|
148
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ! '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - ! '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.4.5
|
160
|
+
rubygems_version: 2.4.5
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Go builder is a set of rake tasks for building and testing your go application
|