releasecop 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 688d27f9f3caa8116455a3a9efa09907995143c815c78c242291fb2213414c83
4
- data.tar.gz: f70f81672b5436f91e48eac60d65ce3a14a182a451f37ab53634613f7788b1fe
3
+ metadata.gz: e67b286ebaca81d5f18df0fa1a22434288d31149aa015dfa5f5a862ca7d46a41
4
+ data.tar.gz: ca42df31717398673e2df330b5d98152379a309c8fd6c761c0e6af341436ab38
5
5
  SHA512:
6
- metadata.gz: 8a2db437039bf5d9428743adc2aa818bfe3f65e37836b206aeb0d04f0a4b18dda5f6be76a1b1c0378d6c89b9a0ed6efc3a7e01144f53c30535f4109de7d6c0d2
7
- data.tar.gz: f39a326831ef4f38b54e5c5b9bc001ec109e8df49d2678986d33e103926da8319fbe2439d5f5479971892a1e86f1410e574cb2647155f587c52a16f79354bcfc
6
+ metadata.gz: 4eb0cfface184b1789c90487ecc269c9883aa99f641225b516b9b4b5c94e2cb95540c940389b90b16d5dfa9dcf555ce773dd69b4c2a11558b7d43269a59ba6d5
7
+ data.tar.gz: affe10bd19328c250a3746e7eea0e36fed6f71ac4dca8963404843914db2d0135dd2b4714ecdf37371d8fee72bfe09d6cc399ad272d3f007e281accd45d69c30
data/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  (Next)
2
2
  ------------
3
+ * Add `path` option for environments with `hokusai`, to run hokusai from a subdirectory of the repo.
3
4
  * Your contribution here...
4
5
 
5
6
  0.0.16 (2022-07-27)
data/README.md CHANGED
@@ -69,6 +69,14 @@ 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
+ If the project's hokusai configuration doesn't live at the top level of the repo (e.g., in a monorepo), add a `path` property with the subdirectory containing its `hokusai/` directory. `hokusai` commands will be run from there:
73
+
74
+ ```json
75
+ {"name": "production", "git": "git@github.com:artsy/artsy-agent.git", "hokusai": "production", "path": "apps/agent-web"}
76
+ ```
77
+
78
+ Note that `path` only affects where hokusai is run; comparisons still cover every commit in the repo.
79
+
72
80
  ### Tagged Releases
73
81
 
74
82
  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.:
@@ -1,6 +1,6 @@
1
1
  module Releasecop
2
2
  class ManifestItem
3
- OPTION_KEYS = %w[hokusai tag_pattern aws_access_key_id aws_secret_access_key]
3
+ OPTION_KEYS = %w[hokusai path tag_pattern aws_access_key_id aws_secret_access_key]
4
4
  attr_reader :git, :branch, :name
5
5
 
6
6
  def initialize(repo_name, item)
@@ -24,13 +24,26 @@ module Releasecop
24
24
  private
25
25
 
26
26
  def find_hokusai_sha
27
- images_output = with_aws_env { `hokusai registry images --limit 1000` } # list as many items as possible
27
+ images_output = in_path { with_aws_env { `hokusai registry images --limit 1000` } } # list as many items as possible
28
28
  tags = images_output.lines.grep(/\d{4}.* \| .*/).map do |l| # lines listing images
29
29
  l.split(' | ').last.gsub(/\e\[(\d+)(\;\d+)*m/, '').split(',').map(&:strip) # tags
30
30
  end
31
31
  tags.detect{|t| t.include?(@options['hokusai']) }.detect{|t| t[/^[0-9a-f]{40}$/]} # first SHA-seeming tag matching environment
32
32
  end
33
33
 
34
+ # Runs the block in the configured subdirectory of the repo (where the project's hokusai/ config lives), if any.
35
+ def in_path(&block)
36
+ path = @options['path'].to_s
37
+ return yield if path.empty? || path == '.'
38
+
39
+ if Pathname.new(path).absolute? || Pathname.new(path).cleanpath.each_filename.include?('..')
40
+ raise ArgumentError, "path must be relative to the repo root: #{path}"
41
+ end
42
+ raise ArgumentError, "path not found in #{@repo_name} repo: #{path}" unless File.directory?(path)
43
+
44
+ Dir.chdir(path, &block)
45
+ end
46
+
34
47
  def find_tag_pattern_sha
35
48
  `git for-each-ref --format='%(objectname)' --count=1 --sort=-authordate --sort=-committerdate --sort=-creatordate 'refs/tags/#{@options['tag_pattern']}'`.strip
36
49
  end
@@ -1,3 +1,3 @@
1
1
  module Releasecop
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
data/lib/releasecop.rb CHANGED
@@ -3,6 +3,7 @@ require "releasecop/version"
3
3
  require 'thor'
4
4
  require 'shellwords'
5
5
  require 'json'
6
+ require 'pathname'
6
7
  require 'releasecop/manifest_item'
7
8
  require "releasecop/comparison"
8
9
  require "releasecop/result"
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.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joey Aghion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2026-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.3.14
111
+ rubygems_version: 3.4.19
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Given a list of projects and environments pipelines, report which environments