renuo-cli 4.21.0 → 4.21.2

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: 9120767921d12d64d169446d7dc3a7e0329f498e80fc5c4f4afca46583ff9418
4
+ data.tar.gz: e16008accec27c375cb831856ce4fb9acce1ac2630fcdae9dfffcbc0a9a63c2f
5
5
  SHA512:
6
- metadata.gz: 9a1ad1c501f0df98ee51a8ed38e08358ae6b03e020a2ee3e9d598ce98026f0db612c4323385dbe188f142a1b5d5b163a894c99f89b6429dd54abf9db4d428e88
7
- data.tar.gz: a4618b96d73466267c395546f8a4d918fbb8de282046c471f86023bbabf25db349f9357433d1acff722120c0548aaa8b4c5fa0db6cdd3f782d210e83c4316493
6
+ metadata.gz: 93c42b19caa65fb26adf806fe0079c842b6ed8661aaaa639ed5325bc4cd64d62d783363a6374db2aed5b3df50bc6769af4220b703359f75c0a38f5ef77dbc0c8
7
+ data.tar.gz: 3966f6f6510994401559c46b32931645d51f726d84a67a402977b5df6d9640b8e146c3208f04d54c05c3e0decee308c54da9a3c952a8ce6a068af637a2551c53
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`,
@@ -7,10 +7,11 @@ module Renuo::Cli::Commands::Ci
7
7
  INTERVAL_IN_SECONDS = 5
8
8
 
9
9
  command "ci check-deploio-status" do |c|
10
- c.syntax = "renuo ci check-deploio-status"
10
+ c.syntax = "renuo ci check-deploio-status [options] <app-name>"
11
11
  c.summary = "Checks the build and release status of the deployment."
12
12
  c.description = c.summary
13
13
  c.option "-p", "--project <name>", String, "The name of the project"
14
+ c.option "-g", "--git-revision <hash>", String, "The Git revision"
14
15
  c.action { |args, options| new(args, options).run }
15
16
  end
16
17
 
@@ -29,7 +30,7 @@ module Renuo::Cli::Commands::Ci
29
30
  def initialize(args, options)
30
31
  @app = args.first
31
32
  @project = options.project
32
- @revision = ENV.fetch("SEMAPHORE_GIT_SHA", nil)
33
+ @revision = options.git_revision || ENV.fetch("SEMAPHORE_GIT_SHA", nil)
33
34
 
34
35
  abort "missing app name" unless @app
35
36
  abort "missing project name" unless @project
@@ -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
@@ -3,10 +3,11 @@
3
3
  module Renuo::Cli::Commands::Ci
4
4
  class UpdateDeploioApp
5
5
  command "ci update-deploio-app" do |c|
6
- c.syntax = "renuo ci update-deploio-app"
6
+ c.syntax = "renuo ci update-deploio-app [options] <app-name>"
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.2"
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.2
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