releasecop 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +17 -0
- data/lib/releasecop/checker.rb +1 -1
- data/lib/releasecop/manifest_item.rb +15 -5
- data/lib/releasecop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cc5c2506e08bc0d5fce6b2c7c45c108c42d58f5ce292cf423b6c5ba0bae6bc1
|
4
|
+
data.tar.gz: de06bf95d2439019dee047414d576f13a1daa541a432cd945722c48422a13797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4c5369f22076ecd9a6eadac9c0d3ea16560a7e03aeda8e69c537c57c97167730745a24f3765d1e9ae7876e6f2d0f138146da781f90728f9d39d4c7a0dc2a779
|
7
|
+
data.tar.gz: 0465b41975ad27ecf8239df54231974cc21b3ccbf489d044beb9be4818821912e39f8cb269167fc6a96fbd96ea01d32fbce82f3b41732327652d341f8a7a094c
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
|
4
4
|
* Your contribution here.
|
5
5
|
|
6
|
+
0.0.7 (2018-06-15)
|
7
|
+
---
|
8
|
+
* Support `tag_pattern` expressions for matching git tags (fixes [#6](https://github.com/joeyAghion/releasecop/issues/6), [@joeyAghion](https://github.com/joeyAghion))
|
9
|
+
|
6
10
|
0.0.6 (2018-04-24)
|
7
11
|
------------------
|
8
12
|
|
data/README.md
CHANGED
@@ -69,4 +69,21 @@ At this time releasecop is not compatible with projects using [Heroku Pipelines]
|
|
69
69
|
|
70
70
|
Releasecop will determine the git SHAs corresponding with each pipeline stage via the `hokusai registry images` command.
|
71
71
|
|
72
|
+
### Tagged Releases
|
73
|
+
|
74
|
+
Many teams create git tags corresponding to each milestone or release. The `tag_pattern` property can be used to match sets of tags corresponding to an environment. E.g.:
|
75
|
+
|
76
|
+
```json
|
77
|
+
{
|
78
|
+
"causality": [
|
79
|
+
{"name": "master", "git": "git@github.com:artsy/causality.git" },
|
80
|
+
{"name": "staging", "git": "git@github.com:artsy/causality.git", "tag_pattern": "staging-*"},
|
81
|
+
{"name": "production", "git": "git@github.com:artsy/causality.git", "tag_pattern": "release-*"}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
```
|
85
|
+
|
86
|
+
The most recent commit matching each tag expression is presumed to correspond with the state of each environment. Tag patterns follow `git` conventions, so, e.g., `staging-*` will be treated as `/refs/tags/staging-*`.
|
87
|
+
|
88
|
+
|
72
89
|
Copyright (c) 2015-2018 Joey Aghion, Artsy
|
data/lib/releasecop/checker.rb
CHANGED
@@ -9,7 +9,7 @@ module Releasecop
|
|
9
9
|
|
10
10
|
def check
|
11
11
|
Dir.chdir(CONFIG_DIR) do
|
12
|
-
`git clone #{envs.first.git} #{'--bare' if envs.
|
12
|
+
`git clone #{envs.first.git} #{'--bare' if envs.all?(&:bare_clone?)} #{name} > /dev/null 2>&1`
|
13
13
|
|
14
14
|
Dir.chdir(name) do
|
15
15
|
envs.each do |env|
|
@@ -1,19 +1,25 @@
|
|
1
1
|
class ManifestItem
|
2
|
-
|
2
|
+
OPTION_KEYS = %w[hokusai tag_pattern]
|
3
|
+
attr_reader :git, :branch, :name
|
3
4
|
|
4
5
|
def initialize(repo_name, item)
|
5
6
|
@repo_name = repo_name
|
6
7
|
@git = item['git']
|
7
8
|
@name = item['name']
|
8
9
|
@branch = item['branch'] || 'master'
|
9
|
-
@
|
10
|
+
@options = item.select { |k, _v| OPTION_KEYS.include?(k) }
|
10
11
|
end
|
11
12
|
|
12
13
|
def for_rev_range
|
13
|
-
@sha ||=
|
14
|
+
@sha ||= find_tag_pattern_sha if @options['tag_pattern']
|
15
|
+
@sha ||= find_hokusai_sha if @options['hokusai']
|
14
16
|
@sha || [@name, @branch].join('/')
|
15
17
|
end
|
16
18
|
|
19
|
+
def bare_clone?
|
20
|
+
!@options.key?('hokusai')
|
21
|
+
end
|
22
|
+
|
17
23
|
private
|
18
24
|
|
19
25
|
def working_dir
|
@@ -23,6 +29,10 @@ class ManifestItem
|
|
23
29
|
def find_hokusai_sha
|
24
30
|
images_output = `hokusai registry images`
|
25
31
|
tags = images_output.lines.grep(/\d{4}.* | .* | .*/).map{|l| l.split(' | ').last.split(',').map(&:strip)}
|
26
|
-
tags.detect{|t| t.include?(@
|
32
|
+
tags.detect{|t| t.include?(@options['hokusai']) }.detect{|t| t[/^[0-9a-f]{40}$/]}
|
33
|
+
end
|
34
|
+
|
35
|
+
def find_tag_pattern_sha
|
36
|
+
`git for-each-ref --format='%(objectname)' --count=1 --sort=-authordate --sort=-committerdate 'refs/tags/#{@options['tag_pattern']}'`.strip
|
27
37
|
end
|
28
|
-
end
|
38
|
+
end
|
data/lib/releasecop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: releasecop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joey Aghion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|