renuo-cli 4.28.0 → 4.29.1

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: 352c9cb95e2c7548026938080ff46625617536757aa4653aa3412ac35dead312
4
- data.tar.gz: dc0de5b1c6781136fe7b13d441c823b648a5efa36c3d28c1cc74e1f8ed8c2e2b
3
+ metadata.gz: bd6c38dab2678be2dd22abe7ce47388faa20efaa270f7e2f2f4e09ef57d62ef4
4
+ data.tar.gz: 3fc28c5af477aaa418a6c6211531dd29ea4153ce80d7e74f6b70386e0a4ddd71
5
5
  SHA512:
6
- metadata.gz: fe555bad89b04add4100bb6eb259a0194b1f30cb7d245dcd02418a7d65b6b2117c8903a3379747eacee069355060aefe3fd62798b03254d97a885af2d1d24f62
7
- data.tar.gz: e77579335bff65754f3871272a7df43eca8b9728c7f1c314b4c39665520bdb8347c5a184868fe81f33d1518d8b66a914fa74a83d50f1fe9bc46057705f0d8da0
6
+ metadata.gz: 4d80152b88e3f9f8f202eb369d396f0c04785be52a4c9799a872a3dbb7d53085ee7ede4caf7264c15c75dbbf84be1510ca570bca105d97160e40617665bd974e
7
+ data.tar.gz: 3cd1cd4b8699861f309690a82a04d09b9fd53c9587dbb53914dc73d040e4d21cedae12e159db6af167bfafaac2d2939c13efb853bd46c41b4093023d6e40e001
data/README.md CHANGED
@@ -52,25 +52,20 @@ renuo generate-password
52
52
 
53
53
  To install this gem onto your local machine, run `bundle exec rake install`.
54
54
 
55
- To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
56
- which will create a git tag for the version, push git commits and tags, and push the `.gem` file to
57
- [rubygems.org](https://rubygems.org).
58
-
59
55
  ## Release
60
56
 
61
- * Bump the version number in `lib/renuo/cli/version.rb`, run `bundle install`
62
- to update the `Gemfile.lock` and commit to `main`
63
-
64
- ### Automatic
57
+ 1. Bump the version in `lib/renuo/cli/version.rb`, run `bundle install` and commit to `main`.
58
+ 1. Tag the commit with the bare version and push the tag:
65
59
 
66
- * Deploy through Semaphore console by starting a promotion to main
60
+ ```sh
61
+ git tag -a 1.2.3 -m 1.2.3
62
+ git push origin 1.2.3
63
+ ```
67
64
 
68
- ### Manual
65
+ 1. Create a GitHub release for the tag with the release notes.
69
66
 
70
- ```sh
71
- gem build renuo-cli.gemspec
72
- gem push renuo-cli-*.gem
73
- ```
67
+ Semaphore runs the tests on the tag and, when they pass, promotes the `release` pipeline, which pushes the gem to
68
+ [rubygems.org](https://rubygems.org). It fails when the tag does not match the gem version.
74
69
 
75
70
  ## Contributing
76
71
 
@@ -53,8 +53,9 @@ class Renuo::Cli::Commands::ConfigureSemaphore
53
53
  end
54
54
 
55
55
  def create_semaphore_deployment_targets
56
- system("sem create dt main -p #{project_name}")
57
- system("sem create dt develop -p #{project_name}")
56
+ %w[main develop].each do |branch|
57
+ system("sem create dt #{branch} -p #{project_name} --object-rule branch,exact,#{branch}")
58
+ end
58
59
  end
59
60
 
60
61
  def render(template_file)
@@ -108,10 +108,13 @@ class Renuo::Cli::Commands::Release # rubocop:disable Metrics/ClassLength
108
108
  end
109
109
 
110
110
  def checkout_project
111
- abort(">> Project not found.") unless system("#{MOVE_TO_TMP_FOLDER} && git clone git@#{@host}:#{@repo_path}.git")
111
+ # Blobless clone: file contents are only fetched when needed, so large files in the history are skipped
112
+ clone = "git clone --filter=blob:none git@#{@host}:#{@repo_path}.git"
113
+ abort(">> Project not found.") unless system("#{MOVE_TO_TMP_FOLDER} && #{clone}")
112
114
 
113
- system(cmd_in_folder("git checkout #{main_branch} && git pull origin #{main_branch} &&" \
114
- "git checkout #{develop_branch} && git pull origin #{develop_branch}"))
115
+ return if system(cmd_in_folder("git checkout #{main_branch} && git checkout #{develop_branch}"))
116
+
117
+ abort(">> Unable to check out #{main_branch} and #{develop_branch}.")
115
118
  end
116
119
 
117
120
  def calculate_version
@@ -141,8 +144,9 @@ class Renuo::Cli::Commands::Release # rubocop:disable Metrics/ClassLength
141
144
  changed_files = find_and_replace_version
142
145
 
143
146
  return unless changed_files.any?
147
+ return if system(cmd_in_folder(%(git add #{changed_files.join(" ")} && git commit -m "Bump version")))
144
148
 
145
- system(cmd_in_folder(%(git add #{changed_files.join(" ")} && git commit -m "Bump version")))
149
+ abort(">> Unable to commit the version bump. Cancelling release.")
146
150
  end
147
151
 
148
152
  def find_and_replace_version
@@ -176,8 +180,7 @@ class Renuo::Cli::Commands::Release # rubocop:disable Metrics/ClassLength
176
180
  end
177
181
 
178
182
  def finish_release_branch
179
- merge_branches
180
- push_branches_and_tags
183
+ merge_branches && system(cmd_in_folder("git push --atomic origin #{develop_branch} #{main_branch} --tags"))
181
184
  end
182
185
 
183
186
  def merge_branches
@@ -192,16 +195,6 @@ class Renuo::Cli::Commands::Release # rubocop:disable Metrics/ClassLength
192
195
  )
193
196
  end
194
197
 
195
- def push_branches_and_tags
196
- push_branch(develop_branch)
197
- push_branch(main_branch)
198
- system(cmd_in_folder("git checkout #{main_branch} && git push origin #{main_branch} --tags"))
199
- end
200
-
201
- def push_branch(branch)
202
- system(cmd_in_folder("git checkout #{branch} && git push origin #{branch}"))
203
- end
204
-
205
198
  def ask_for_final_confirmation
206
199
  unless agree(">> Are you sure you wish to deploy '#{@repo_path}' " \
207
200
  "as a #{@update_type} release (#{current_version} => #{@version})?")
@@ -0,0 +1,29 @@
1
+ # Review Apps
2
+
3
+ Review apps are short-lived deployments driven by the changes on a git branch.
4
+ They can be used for smoke testing during code reviews or to show a feature sketch to
5
+ the customer.
6
+
7
+ Here we assume that you use Deploio.
8
+ Further we can generate a SemaphoreCI pipeline template for you.
9
+
10
+ These are the steps of command execution in the happy path:
11
+
12
+ 1. _(Optional)_ `renuo review-app:setup-semaphoreci`
13
+ 1. Create or update `renuo review-app:deploy`
14
+ 1. _Intentional gap for configuration. Consider this the wiggle-room for LLMs_
15
+ 1. Start the paused app `renuo review-app:start`
16
+ 1. Cleanup `renuo review-app:purge`
17
+
18
+ ## Design Choices
19
+
20
+ * The git branch determines the lifetime of a review app
21
+ * The branch name **hash** is the only safe identifier.
22
+ It is being used to purge resources.
23
+ Connected services do not work across all systems (e.g. Nutanix Object Storage)
24
+ * A dry-run command flag is not easily possible because we rely on generated system output.
25
+ * We use the sunny/actor gem to concentrate reviewability to the command flow
26
+ * There is a special "safeguards" feature test. It covers the safe name contract.
27
+ * All `nctl` commands are routed through `system!` and are logged in a command trail for auditing.
28
+ * Configuration of system tools like `psql` is intentionally out of scope.
29
+ But CI templating can give you some pointers.
@@ -45,7 +45,7 @@ class Renuo::Cli::Services::Deploio
45
45
  def dropped_keys(*path, kind:)
46
46
  env = copied_spec.dig(*path) || []
47
47
  env.reject { |variable| keep_envs.include?(variable["sensitive"] ? "sensitive-#{kind}" : kind) }
48
- .map { |variable| variable["name"] }
48
+ .pluck("name")
49
49
  end
50
50
 
51
51
  def copied_spec
@@ -3,7 +3,7 @@
3
3
  # simplecov:disable
4
4
  module Renuo
5
5
  class Cli
6
- VERSION = "4.28.0"
6
+ VERSION = "4.29.1"
7
7
  NAME = "renuo-cli"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renuo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.28.0
4
+ version: 4.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renuo AG
@@ -117,6 +117,7 @@ files:
117
117
  - lib/renuo/cli/commands/heroku_users.rb
118
118
  - lib/renuo/cli/commands/list_large_git_files.rb
119
119
  - lib/renuo/cli/commands/release.rb
120
+ - lib/renuo/cli/commands/review_app/README.md
120
121
  - lib/renuo/cli/commands/review_app/deploy.rb
121
122
  - lib/renuo/cli/commands/review_app/name.rb
122
123
  - lib/renuo/cli/commands/review_app/purge.rb
@@ -181,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
182
  - !ruby/object:Gem::Version
182
183
  version: '0'
183
184
  requirements: []
184
- rubygems_version: 4.0.21
185
+ rubygems_version: 4.0.23
185
186
  specification_version: 4
186
187
  summary: The Renuo CLI automates some common workflows.
187
188
  test_files: []