argus-builder 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dcaaed12b45f52b1547d810cd1a87a1f4611b59
4
- data.tar.gz: 41dd4d8362911253e86857d565336808cdb4a830
3
+ metadata.gz: 493ccb46314486055d4caa0d2168bef4e69313b4
4
+ data.tar.gz: 98457b166a0c082cb757ba44b28dccb39dbfbbd8
5
5
  SHA512:
6
- metadata.gz: b95253f269aba1667ced23154968a1400c4b91400d6c6f34f398d32f7e22bbb8c94fa5a25d644dcdea5ff0aaef48232d717d1673f044623ab25cc6df9ef7fe4a
7
- data.tar.gz: 95b2df158dd4c45b283be922fd6201e379bbfe18aa9f33104a03f1c34dc9470423d32662e1772d2394382c0a966ac57d0da0521adac4432333ee43c40edf7198
6
+ metadata.gz: 4c826fb33c67b41c83ccbe02863b2f5932ecf1c4f10c126d3405e0937164a7086ee9aed052fb7f7c3866ca355578a0374977ff71f58aced0ad9a887d5f4cc5ef
7
+ data.tar.gz: 504c2d7180ed1f595893486444664c14c4b5be1b1578140398216208b5705e64d90d77e094695dbb7eed71fc0dfa1545f47b5a7b683c6b7b1c41327995d6886b
data/README.md CHANGED
@@ -13,6 +13,10 @@ Features:
13
13
  The primary goal of this project is simplicity. It should be easy to
14
14
  adapt to your exact image-building needs.
15
15
 
16
+ Argus is implemented as a shoryuken
17
+ worker. [Shoryuken](https://github.com/phstc/shoryuken) is a super
18
+ efficient AWS SQS thread based message processor.
19
+
16
20
  ## Quick-start
17
21
 
18
22
  You will need:
@@ -84,7 +88,7 @@ argus-worker
84
88
  ## Build procedure
85
89
 
86
90
  Argus builds images as follows. Examine and modify `lib/argus/git.rb`
87
- and `lib/argus/docker.git` to change exact behaviour.
91
+ and `lib/argus/docker.rb` to change exact behaviour.
88
92
 
89
93
  1. `git clone` a new github repo, or `git checkout` an existing one
90
94
  1. authenticate to elastic container registry using provided credentials
@@ -106,7 +110,8 @@ require 'aws-sdk'
106
110
  msg = {
107
111
  org: org,
108
112
  repo: repo,
109
- branch: branch
113
+ branch: branch,
114
+ tag: repo:branch # optional
110
115
  }
111
116
 
112
117
  sqs = Aws::SQS::Client.new
@@ -116,6 +121,22 @@ sqs.send_message(
116
121
  )
117
122
  ```
118
123
 
124
+ If no tag is given it will be constructed as
125
+ `registry/repo:branch`. The git branch will have `/` changed to `-` to
126
+ make a legal docker image name.
127
+
128
+ For example, git repo:
129
+
130
+ ```
131
+ rlister/argus:feature/foo
132
+ ```
133
+
134
+ will produce docker image:
135
+
136
+ ```
137
+ xxx.dkr.ecr.us-east-1.amazonaws.com/argus:feature-foo
138
+ ```
139
+
119
140
  ## Shoryuken options
120
141
 
121
142
  `argus` is a simple shoryuken worker. You can run it directly from the
@@ -171,7 +192,7 @@ the `.gem` file to [rubygems.org](https://rubygems.org).
171
192
  ## Contributing
172
193
 
173
194
  Bug reports and pull requests are welcome on GitHub at
174
- https://github.com/[USERNAME]/argus. This project is intended to be a
195
+ https://github.com/rlister/argus. This project is intended to be a
175
196
  safe, welcoming space for collaboration, and contributors are expected
176
197
  to adhere to the
177
198
  [Contributor Covenant](http://contributor-covenant.org) code of
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  exec <<EOF
4
+ bundle exec \
4
5
  shoryuken \
5
6
  --require ./lib/argus/worker.rb \
6
7
  --queue ${ARGUS_QUEUE:-argus} \
@@ -5,9 +5,8 @@ module Argus
5
5
  class Image
6
6
  attr_reader :repo, :branch, :build_time, :image, :push_time
7
7
 
8
- def initialize(repo, branch)
9
- @repo = repo
10
- @branch = branch
8
+ def initialize(name)
9
+ @repo, @branch = name.split(':')
11
10
  end
12
11
 
13
12
  def to_s
@@ -32,6 +32,18 @@ module Argus
32
32
  URI.parse(auth.proxy_endpoint).host
33
33
  end
34
34
 
35
+ ## return image tag, or make it out of:
36
+ ## repo:branch with / changed to - in branch;
37
+ ## prepend registry if none given
38
+ def image_name(registry, msg)
39
+ name = msg[:tag] || (msg[:repo] + ':' + msg[:branch].gsub('/', '-'))
40
+ if name.include?('/')
41
+ name
42
+ else
43
+ "#{registry}/#{name}"
44
+ end
45
+ end
46
+
35
47
  def initialize(msg)
36
48
  msg = symbolize_keys(msg)
37
49
 
@@ -46,7 +58,7 @@ module Argus
46
58
  registry = authenticate_ecr
47
59
 
48
60
  ## docker image to build
49
- img = Image.new("#{registry}/#{msg[:repo]}", msg[:branch])
61
+ img = Image.new(image_name(registry, msg))
50
62
 
51
63
  Dir.chdir(dir) do
52
64
  img.pull # pull some layers to speed up the build
@@ -1,3 +1,3 @@
1
1
  module Argus
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: argus-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-18 00:00:00.000000000 Z
11
+ date: 2016-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler