renuo-cli 4.21.0 → 4.21.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: de68476aa8e37811fd54ca8248bc8a30ddeb8594ada90207201a968e1e106b59
4
- data.tar.gz: d7d2a77ec3fb9e520053a82be66f4ac2dd782179cf002c75ba7fd7b277d22e32
3
+ metadata.gz: de8f99bc222386ca1ac0dd81b673d3a4382de875269d5df20aa06a3099ddef36
4
+ data.tar.gz: 7c6a5239dba6bef5d5e7ce46c3da8f8c6a9e6a3ba28cbfea237743bd4a65e136
5
5
  SHA512:
6
- metadata.gz: 9a1ad1c501f0df98ee51a8ed38e08358ae6b03e020a2ee3e9d598ce98026f0db612c4323385dbe188f142a1b5d5b163a894c99f89b6429dd54abf9db4d428e88
7
- data.tar.gz: a4618b96d73466267c395546f8a4d918fbb8de282046c471f86023bbabf25db349f9357433d1acff722120c0548aaa8b4c5fa0db6cdd3f782d210e83c4316493
6
+ metadata.gz: 4fa9db9c017993228f783134a4bf03b11327436daadfcbb3dbc518519e017115b59011658e86d29147689fe0a1c5f1ecca975e45af36ed873d373379c8e4114a
7
+ data.tar.gz: f9626e0a2508da563348ab54f35a361556466fe17d0bc37866d2f7eb7d3b3a070c3769e4145b94bd48e0718062fa9f31f871c64de070bea89b902a7e3d41e3dc
data/README.md CHANGED
@@ -24,6 +24,21 @@ Run `bundle exec ruby -Ilib ./bin/renuo` to run the executable. (e.g. `ruby -Ili
24
24
 
25
25
  You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
26
 
27
+ ### Testing commands in the shell
28
+
29
+ The easiest way to test the CLI during development is to temporarily add the local `bin` directory to your `PATH`:
30
+
31
+ ```shell
32
+ export PATH="$PWD/bin:$PATH"
33
+ ```
34
+
35
+ This binds the `renuo` command to your local version, so you can run commands directly:
36
+
37
+ ```shell
38
+ renuo -h
39
+ renuo generate_github_settings
40
+ ```
41
+
27
42
  To install this gem onto your local machine, run `bundle exec rake install`.
28
43
 
29
44
  To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Renuo::Cli::Commands::Ci
4
+ class Setup
5
+ command "ci setup" do |c|
6
+ c.syntax = "renuo ci setup"
7
+ c.summary = "Installs and logs in to nctl."
8
+ c.description = c.summary
9
+ c.action { new.run }
10
+ end
11
+
12
+ def run
13
+ system! "echo 'deb [trusted=yes] https://repo.nine.ch/deb/ /' " \
14
+ "| sudo tee /etc/apt/sources.list.d/repo.nine.ch.list"
15
+ system! "sudo apt-get update -qqo Dir::Etc::sourcelist=/etc/apt/sources.list.d/repo.nine.ch.list"
16
+ system! "sudo apt-get install -qq nctl"
17
+ system! "nctl auth login"
18
+ end
19
+
20
+ private
21
+
22
+ def system!(cmd)
23
+ abort unless system cmd
24
+ end
25
+ end
26
+ end
@@ -7,6 +7,7 @@ module Renuo::Cli::Commands::Ci
7
7
  c.summary = "Updates a Deploio app."
8
8
  c.description = c.summary
9
9
  c.option "-d", "--docker", "If the app uses a Dockerfile"
10
+ c.option "-g", "--git-revision <hash>", String, "The Git revision"
10
11
  c.option "-p", "--project <name>", String, "The name of the project"
11
12
  c.example "renuo ci update-deploio-app main -dp renuo-dashboard",
12
13
  "Updates the 'main' app of the 'renuo-dashboard' project using a Dockerfile"
@@ -14,27 +15,22 @@ module Renuo::Cli::Commands::Ci
14
15
  end
15
16
 
16
17
  def run
17
- system! "checkout --use-cache" if @docker
18
- system! "echo 'deb [trusted=yes] https://repo.nine.ch/deb/ /' " \
19
- "| sudo tee /etc/apt/sources.list.d/repo.nine.ch.list"
20
- system! "sudo apt-get update -qqo Dir::Etc::sourcelist=/etc/apt/sources.list.d/repo.nine.ch.list"
21
- system! "sudo apt-get install -qq nctl"
22
- system! "nctl auth login"
23
- system! "nctl update app #{@app} -p #{@project} --env APP_REVISION=$SEMAPHORE_GIT_SHA " \
18
+ system! "nctl update app #{@app} -p #{@project} --env APP_REVISION=#{@git_revision} " \
24
19
  "#{"--build-env RUBY_VERSION=#{File.read(".ruby-version").strip} " if @docker}" \
25
- "--git-revision $SEMAPHORE_GIT_SHA --skip-repo-access-check"
20
+ "--git-revision #{@git_revision} --skip-repo-access-check"
26
21
  end
27
22
 
28
23
  private
29
24
 
30
25
  def initialize(args, options)
31
26
  @app = args.first
32
- @project = options.project
33
27
  @docker = options.docker
28
+ @git_revision = options.git_revision || ENV.fetch("SEMAPHORE_GIT_SHA", nil)
29
+ @project = options.project
34
30
 
35
31
  abort "missing app name" unless @app
36
32
  abort "missing project name" unless @project
37
- abort "this command must be run in Semaphore" unless ENV.key?("SEMAPHORE_GIT_SHA")
33
+ abort "missing Git revision" unless @git_revision
38
34
  end
39
35
 
40
36
  def system!(cmd)
@@ -68,14 +68,14 @@ class Renuo::Cli::Commands::Debug # rubocop:disable Metrics/ClassLength
68
68
 
69
69
  if should_scan_deploio && Cache.stored_at("deploio_apps")
70
70
  select_deploio_targets(query).each do |app|
71
- display_cmd, exec_cmd = nctl_command(app, "exec", "bash")
72
- menu.choice(display_cmd) { exec exec_cmd.squish }
71
+ bash_display_cmd, bash_exec_cmd = nctl_command(app, "exec", "bash")
72
+ menu.choice(bash_display_cmd) { exec bash_exec_cmd.squish }
73
73
 
74
- display_cmd, exec_cmd = nctl_command(app, "exec", "bundle exec rails console")
75
- menu.choice(display_cmd) { exec exec_cmd.squish }
74
+ bundle_display_cmd, bundle_exec_cmd = nctl_command(app, "exec", "bundle exec rails console")
75
+ menu.choice(bundle_display_cmd) { exec bundle_exec_cmd.squish }
76
76
 
77
- display_cmd, exec_cmd = nctl_command(app, "logs", "-f")
78
- menu.choice(display_cmd) { exec exec_cmd.squish }
77
+ logs_display_cmd, logs_exec_cmd = nctl_command(app, "logs", "-f")
78
+ menu.choice(logs_display_cmd) { exec logs_exec_cmd.squish }
79
79
 
80
80
  app[:hosts].each { |host| open_cmds << "open https://#{host}" }
81
81
  end
@@ -18,5 +18,6 @@ blocks:
18
18
  - name: deploying
19
19
  commands:
20
20
  - gem i -q renuo-cli
21
+ - renuo ci setup
21
22
  - renuo ci update-deploio-app <%= environment %> -p renuo-<%= project_name %>
22
23
  - renuo ci check-deploio-status <%= environment %> -p renuo-<%= project_name %>
@@ -3,7 +3,7 @@
3
3
  # :nocov:
4
4
  module Renuo
5
5
  class Cli
6
- VERSION = "4.21.0"
6
+ VERSION = "4.21.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.21.0
4
+ version: 4.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renuo AG
@@ -66,6 +66,7 @@ files:
66
66
  - lib/renuo/cli.rb
67
67
  - lib/renuo/cli/commands/check_deploio_status.rb
68
68
  - lib/renuo/cli/commands/ci/check_deploio_status.rb
69
+ - lib/renuo/cli/commands/ci/setup.rb
69
70
  - lib/renuo/cli/commands/ci/update_deploio_app.rb
70
71
  - lib/renuo/cli/commands/commit_leaderboard_stage.rb
71
72
  - lib/renuo/cli/commands/commit_leaderboard_sync.rb