takeltau 0.44.19 → 0.44.24

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: c5d0871bd24f476f6349d62f2cb177c18fb6e1b66df92c6f26130c7474dfba43
4
- data.tar.gz: f4b9a65df03c97a890e696571c377c350f5b961367d2657a1efb895335397fa2
3
+ metadata.gz: deb82fda940a4ff5a0a2bf71cc84bf813589c07eda38a3d2040f825738b1d443
4
+ data.tar.gz: d41134f25c52879dcba44f08a6fdd4b910a884a410f02728d5f2413ae70c5338
5
5
  SHA512:
6
- metadata.gz: 45344bf0fa90a346ac8bc403b990c387682381cf00c6562567ae67b1c184130df7c030fcab0691371fe8f47b3a990bf14b2a649a98b016902722faf1829a3cc2
7
- data.tar.gz: 39c3c22e12e95bd0b6f4729ebe19fe79879900bf8f67a92ebb15ac92726d7a3d2f0cfa2b0a806c68ece2e17fa702512c31f60793bc167a10426231c3381c589b
6
+ metadata.gz: 2245845fa2cfe9ab835d416dc7502487cbedcc652a8e6191ddeb69267f9dc48d0e81a96d9f04ed985972e645da8da8fe861ac4695fff6f0a94f65ec8dcb85b80
7
+ data.tar.gz: 73b097fe9c5426567c53a2d7b1d95e92b7d0ca25817d6731f0cc32b9765efbf2016a96a7cd5d3d4d482e864d1d9844dae537cb58beb2f6c32ed463c0b5f999ab
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # takelage-cli
2
2
 
3
- *takelage-cli* is a command line interface
3
+ *takelage-cli* is a command line interface
4
4
  to facilitate the takelage devops workflow.
5
5
  The takelage devops workflow helps devops engineers
6
6
  build, test and deploy os images.
7
7
 
8
- The *takelage-cli* executable `tau` is a
9
- [ruby](https://www.ruby-lang.org/)
10
- command line script using the
8
+ The *takelage-cli* executable `tau` is a
9
+ [ruby](https://www.ruby-lang.org/)
10
+ command line script using the
11
11
  [thor](http://whatisthor.com/) toolkit.
12
12
 
13
13
  *takelage-cli* is also the remote control for the
@@ -50,9 +50,9 @@ The *takelage-cli* executable `ship` is a wrapper for `tau ship`.
50
50
 
51
51
  ## Installation
52
52
 
53
- *tau* is part of *takelage-dev*'s docker image
53
+ *tau* is part of *takelage-dev*'s docker image
54
54
  but you typically want to install it on the host system as well.
55
- Install the takelage gem and its dependencies
55
+ Install the takelage gem and its dependencies
56
56
  through the [gem](https://github.com/rubygems/rubygems)
57
57
  command line tool:
58
58
 
@@ -123,13 +123,16 @@ or *tau commands*:
123
123
  | tau [ship completion bash](features/cucumber/features/ship/completion/completion.bash.feature) | Print bash completion code for ship subcommand |
124
124
  | tau [ship container check existing](features/cucumber/features/ship/container/ship.container.check.existing.feature) | Check if a takelship is existing |
125
125
  | tau [ship container clean](features/cucumber/features/ship/container/ship.container.clean.feature) | Stop all takelships |
126
- | tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature) [COMMAND] | Run a [COMMAND] in a takelship container |
126
+ | tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature) [CMD] | Run a bash command in a takelship container |
127
127
  | tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature) | List takelships |
128
+ | tau [ship container hostname](features/cucumber/features/ship/container/ship.container.hostname.feature) | Print takelship hostname |
128
129
  | tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature) | Log in to a takelship |
129
130
  | tau [ship container logs](features/cucumber/features/ship/container/ship.container.logs.feature) | Print the takelship logs |
130
- | tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) [COMMAND] | Run a podman [COMMAND] in a takelship |
131
+ | tau [ship container name](features/cucumber/features/ship/container/ship.container.name.feature) | Print the takelship name |
132
+ | tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) [CMD] | Run a podman command in a takelship |
133
+ | tau [ship container shipdir](features/cucumber/features/ship/container/ship.container.shipdir.feature) | Print takelship shipdir |
131
134
  | tau [ship container stop](features/cucumber/features/ship/container/ship.container.stop.feature) | Stop a takelship |
132
- | tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature) [COMMAND] | Run a sudo [COMMAND] in a takelship |
135
+ | tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature) [CMD] | Run a sudo command in a takelship |
133
136
  | tau [ship container update](features/cucumber/features/ship/container/ship.container.update.feature) | Update takelship image |
134
137
  | tau [ship info takelconfig](features/cucumber/features/ship/info/ship.info.takelconfig.feature) | Print takelage config |
135
138
  | tau [ship info takelship](features/cucumber/features/ship/info/ship.info.takelship.feature) | Print takelship info |
@@ -140,17 +143,20 @@ or *tau commands*:
140
143
  | tau [ship project stop](features/cucumber/features/ship/project/ship.project.stop.feature) | Stop a takelship project |
141
144
  | tau [ship project update](features/cucumber/features/ship/project/ship.project.create.feature) [PROJECT] | Update a takelship [PROJECT] |
142
145
  | tau ship board | Alias for tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature) |
143
- | tau ship command [COMMAND] | Alias for tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature) |
146
+ | tau ship clean | Alias for tau [ship container clean](features/cucumber/features/ship/container/ship.container.clean.feature) |
147
+ | tau ship command [CMD] | Alias for tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature) |
148
+ | tau ship docker [CMD] | Alias for tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) |
144
149
  | tau ship list | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature) |
145
150
  | tau ship login | Alias for tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature) |
146
151
  | tau ship logs | Alias for tau [ship container logs](features/cucumber/features/ship/container/ship.container.logs.feature) |
147
152
  | tau ship ls | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature) |
148
- | tau ship podman [COMMAND] | Alias for tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) |
153
+ | tau ship name | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.name.feature) |
154
+ | tau ship podman [CMD] | Alias for tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) |
149
155
  | tau ship sail [PROJECT] | Alias for tau [ship project start](features/cucumber/features/ship/project/ship.project.start.feature) |
150
156
  | tau ship restart [PROJECT] | Alias for tau [ship project restart](features/cucumber/features/ship/project/ship.project.restart.feature) |
151
157
  | tau ship start [PROJECT] | Alias for tau [ship project start](features/cucumber/features/ship/project/ship.project.start.feature) |
152
158
  | tau ship stop | Alias for tau [ship project stop](features/cucumber/features/ship/project/ship.project.stop.feature) |
153
- | tau ship sudo [COMMAND] | Alias for tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature) |
159
+ | tau ship sudo [CMD] | Alias for tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature) |
154
160
  | tau ship wreck | Alias for tau [ship project stop](features/cucumber/features/ship/project/ship.project.stop.feature) |
155
161
  | tau ship update | Alias for tau [ship container update](features/cucumber/features/ship/container/ship.container.update.feature) |
156
162
  | tau clean | Alias for tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature) |
@@ -173,7 +179,7 @@ or *tau commands*:
173
179
 
174
180
  *takelage-cli* uses three different YAML configuration files and environment variables which have different precedences.
175
181
  They are merged to an active configuration during runtime
176
- which can be inspected with
182
+ which can be inspected with
177
183
  *tau [self config active](features/cucumber/features/self/self.config.active.feature)*
178
184
  or *tau config*.
179
185
 
@@ -197,7 +203,7 @@ The project directory is identified by the first match:
197
203
  ### Configuration Examples
198
204
 
199
205
  - You should add the following configuration items in your *~/.takelage.yml*
200
- if you want to use the *takelbeta* docker image channel:
206
+ if you want to use the *takelbeta* docker image channel:
201
207
 
202
208
  ```yaml
203
209
  ---
@@ -205,7 +211,7 @@ docker_repo: takelbeta
205
211
  ```
206
212
 
207
213
  - If you want to pin a specific docker tag for one of your projects
208
- then create an *takelage.yml* file with:
214
+ then create an *takelage.yml* file with:
209
215
 
210
216
  ```yaml
211
217
  ---
@@ -213,18 +219,18 @@ docker_tag: '1.2.3'
213
219
  ```
214
220
 
215
221
  - The cucumber tests make use of an *~/.takelage.yml*
216
- to overwrite defaults like:
222
+ to overwrite defaults like:
217
223
 
218
224
  ```yaml
219
225
  ---
220
226
  docker_repo: takelage-mock
221
227
  ```
222
228
 
223
- - You may prefer to interact with
224
- [mercurial](https://github.com/takelwerk/takelage-doc/blob/main/doc/tau/hg.md)
225
- through `tau hg`
226
- in a different branch than `main` in one project so you may add
227
- to your *takelage.yml*:
229
+ - You may prefer to interact with
230
+ [mercurial](https://github.com/takelwerk/takelage-doc/blob/main/doc/tau/hg.md)
231
+ through `tau hg`
232
+ in a different branch than `main` in one project so you may add
233
+ to your *takelage.yml*:
228
234
 
229
235
 
230
236
  ```yaml
@@ -232,7 +238,7 @@ to your *takelage.yml*:
232
238
  git_hg_repo: my_git_hg_branch
233
239
  ```
234
240
 
235
- Furthermore,
241
+ Furthermore,
236
242
  [every external command](https://github.com/takelwerk/takelage-cli/blob/main/lib/takeltau/default.yml)
237
243
  can be reconfigured.
238
244
 
@@ -241,7 +247,7 @@ can be reconfigured.
241
247
  *tau* reads two different YAML project files
242
248
  which have different precedences.
243
249
  They are merged to an active configuration during runtime
244
- which can be inspected with
250
+ which can be inspected with
245
251
  *tau [info project active](features/cucumber/features/info/info.project.active.feature)*
246
252
  or *tau project*.
247
253
 
@@ -263,24 +269,24 @@ source <(tau completion bash)
263
269
  *takelage-cli* uses
264
270
  [minitest](https://github.com/seattlerb/minitest) unit tests.
265
271
 
266
- *takelage-cli* ships with
272
+ *takelage-cli* ships with
267
273
  [cucumber](https://github.com/cucumber/cucumber) ruby system tests.
268
- It uses cucumber's
274
+ It uses cucumber's
269
275
  [aruba](https://github.com/cucumber/aruba) extension and especially its
270
276
  [filesystem](https://relishapp.com/cucumber/aruba/v/0-11-0/docs/filesystem)
271
277
  library.
272
278
 
273
279
  *takelage-cli* [deploys](https://docs.docker.com/registry/deploying/)
274
- a private docker
280
+ a private docker
275
281
  [registry](https://hub.docker.com/_/registry)
276
282
  to conduct end-to-end tests of *tau docker* commands.
277
- The registry exposes port 5005.
278
- You need to whitelist it in your host's docker engine configuration:
283
+ The registry exposes port 5005.
284
+ You need to whitelist it in your host's docker engine configuration:
279
285
 
280
286
  ```json
281
287
  {
282
- "insecure-registries": [
283
- "host.docker.internal:5005"
284
- ]
288
+ "insecure-registries": [
289
+ "host.docker.internal:5005"
290
+ ]
285
291
  }
286
292
  ```
@@ -14,8 +14,9 @@ module LoggingModule
14
14
  end
15
15
 
16
16
  # Initialize logger with loglevel.
17
- def initialize_logging(loglevel)
17
+ def initialize_logging(loglevel, debug)
18
18
  TakeltauLogger.instance.logger.formatter = _logging_get_log_format
19
+ loglevel = 'DEBUG' if debug
19
20
  log_level_in_use = _logging_get_log_level loglevel
20
21
  TakeltauLogger.instance.logger.level = log_level_in_use
21
22
  TakeltauLogger.instance.logger.debug "Using loglevel #{log_level_in_use}"
@@ -4,7 +4,7 @@
4
4
  module SelfCommands
5
5
  # Backend method for config self commands.
6
6
  def self_commands
7
- _manipulate_output_(_get_thor_list_)
7
+ _manipulate_output_ _get_thor_list_
8
8
  end
9
9
 
10
10
  private
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Takeltau
4
4
  # tau ship
5
- # rubocop:disable Metrics/ClassLength
6
5
  class Ship < SubCommandBase
7
6
  include LoggingModule
8
7
  include SystemModule
@@ -26,7 +25,7 @@ module Takeltau
26
25
  desc 'info [COMMAND]', 'Get info about takelship containers'
27
26
  subcommand 'info', ShipInfo
28
27
 
29
- desc 'ports [COMMAND]', 'Manage takelship portss'
28
+ desc 'ports [COMMAND]', 'Manage takelship ports'
30
29
  subcommand 'ports', ShipPorts
31
30
 
32
31
  desc 'project [COMMAND]', 'Manage takelship projects'
@@ -46,7 +45,17 @@ module Takeltau
46
45
  Takeltau::ShipContainer.new.login
47
46
  end
48
47
 
49
- desc 'command [COMMAND]', 'Run a [COMMAND] in a takelship'
48
+ desc 'clean', 'Stop all takelships'
49
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
50
+ Stop all takelship containers.
51
+ Alias for ship container clean.
52
+ LONGDESC
53
+ # ship clean: {Takeltau::ShipProject#clean}
54
+ def clean
55
+ Takeltau::ShipProject.new.clean
56
+ end
57
+
58
+ desc 'command [CMD]', 'Run a bash command in a takelship'
50
59
  long_desc <<-LONGDESC.gsub("\n", "\x5")
51
60
  Run a command in a takelship container as user podman.
52
61
  Alias for ship container command.
@@ -56,6 +65,16 @@ module Takeltau
56
65
  Takeltau::ShipContainer.new.command(*args)
57
66
  end
58
67
 
68
+ desc 'docker [CMD]', 'Run a podman command in a takelship'
69
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
70
+ Run a podman command as user podman in a takelship container.
71
+ Alias for ship container podman.
72
+ LONGDESC
73
+ # ship docker: {Takeltau::ShipContainer#podman}
74
+ def docker(*args)
75
+ Takeltau::ShipContainer.new.podman(*args)
76
+ end
77
+
59
78
  desc 'list', 'List takelships'
60
79
  long_desc <<-LONGDESC.gsub("\n", "\x5")
61
80
  List takelship containers.
@@ -96,7 +115,7 @@ module Takeltau
96
115
  Takeltau::ShipContainer.new.list
97
116
  end
98
117
 
99
- desc 'podman [COMMAND]', 'Run a podman [COMMAND] in a takelship'
118
+ desc 'podman [CMD]', 'Run a podman command in a takelship'
100
119
  long_desc <<-LONGDESC.gsub("\n", "\x5")
101
120
  Run a podman command as user podman in a takelship container.
102
121
  Alias for ship container podman.
@@ -117,7 +136,7 @@ module Takeltau
117
136
  Takeltau::ShipProject.new.restart project
118
137
  end
119
138
 
120
- desc 'sudo [COMMAND]', 'Run a sudo [COMMAND] in a takelship'
139
+ desc 'sudo [CMD]', 'Run a sudo command in a takelship'
121
140
  long_desc <<-LONGDESC.gsub("\n", "\x5")
122
141
  Run a command as root in a takelship container.
123
142
  Alias for ship container sudo.
@@ -177,5 +196,4 @@ module Takeltau
177
196
  Takeltau::ShipContainer.new.update
178
197
  end
179
198
  end
180
- # rubocop:enable Metrics/ClassLength
181
199
  end
@@ -37,7 +37,7 @@ module Takeltau
37
37
  #
38
38
  # ship container command
39
39
  #
40
- desc 'command [COMMAND]', 'Run a [COMMAND] in a takelship container'
40
+ desc 'command [CMD]', 'Run a bash command in a takelship container'
41
41
  long_desc <<-LONGDESC.gsub("\n", "\x5")
42
42
  Run a command in a takelship container as user podman.
43
43
  LONGDESC
@@ -45,6 +45,19 @@ module Takeltau
45
45
  say ship_container_command args
46
46
  end
47
47
 
48
+ #
49
+ # ship container hostname
50
+ #
51
+ desc 'hostname', 'Print the takelship hostname'
52
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
53
+ Print the hostname of the takelship container.
54
+ LONGDESC
55
+ def hostname
56
+ say _ship_container_lib_ship_hostname
57
+ exit false unless ship_container_check_existing
58
+ true
59
+ end
60
+
48
61
  #
49
62
  # ship container list
50
63
  #
@@ -83,7 +96,7 @@ module Takeltau
83
96
  #
84
97
  # ship container podman
85
98
  #
86
- desc 'podman [COMMAND]', 'Run a podman [COMMAND] in a takelship'
99
+ desc 'podman [CMD]', 'Run a podman command in a takelship'
87
100
  long_desc <<-LONGDESC.gsub("\n", "\x5")
88
101
  Run a podman command as user podman in a takelship container.
89
102
  LONGDESC
@@ -91,10 +104,23 @@ module Takeltau
91
104
  say ship_container_podman args
92
105
  end
93
106
 
107
+ #
108
+ # ship container shipdir
109
+ #
110
+ desc 'shipdir', 'Print the takelship project root dir'
111
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
112
+ Print the project root directory of the takelship container.
113
+ LONGDESC
114
+ def shipdir
115
+ say config.active['project_root_dir']
116
+ exit false unless ship_container_check_existing
117
+ true
118
+ end
119
+
94
120
  #
95
121
  # ship container sudo
96
122
  #
97
- desc 'sudo [COMMAND]', 'Run a sudo [COMMAND] in a takelship'
123
+ desc 'sudo [CMD]', 'Run a sudo command in a takelship'
98
124
  long_desc <<-LONGDESC.gsub("\n", "\x5")
99
125
  Run a command as root in a takelship container.
100
126
  LONGDESC
@@ -5,7 +5,7 @@ module ShipContainerStop
5
5
  # Stop a takelship container
6
6
  def ship_container_stop
7
7
  _ship_container_stop_docker_stop
8
- "Stopped takelship \"#{_ship_container_lib_ship_hostname}\""
8
+ "Stopped takelship #{_ship_container_lib_ship_hostname}"
9
9
  end
10
10
 
11
11
  private
@@ -63,8 +63,7 @@ module Takeltau
63
63
  Start a takelship and run project [PROJECT] in it.
64
64
  LONGDESC
65
65
  def start(project = 'default')
66
- project_start = ship_project_start project
67
- say project_start if project_start
66
+ exit ship_project_start project
68
67
  end
69
68
 
70
69
  #
@@ -11,15 +11,16 @@ module ShipProjectStart
11
11
  return false unless _ship_project_start_valid_project? takelship, project
12
12
 
13
13
  ports = _ship_ports_lib_get_ports(takelship, project)
14
- return false unless _ship_project_start_sailing? project, ports
14
+ return false if _ship_project_start_already_sailing? project, ports
15
15
 
16
16
  log.debug 'Writing port configuration to takelage.yml'
17
17
  _ship_ports_lib_write_ports(ports, project)
18
18
 
19
19
  log.debug "Starting takelship project \"#{project}\""
20
20
  _ship_container_lib_docker_privileged ports, project
21
- say "Started project \"#{project}\" on takelship \"#{_ship_container_lib_ship_hostname}\".\n\n"
21
+ _ship_project_start_print_banner project
22
22
  _ship_project_start_print_ports ports
23
+ true
23
24
  end
24
25
 
25
26
  private
@@ -33,12 +34,12 @@ module ShipProjectStart
33
34
  end
34
35
 
35
36
  # check if the takelship is already existng
36
- def _ship_project_start_sailing?(project, ports)
37
- return true unless ship_container_check_existing
37
+ def _ship_project_start_already_sailing?(project, ports)
38
+ return false unless ship_container_check_existing
38
39
 
39
- say "The takelship \"#{_ship_container_lib_ship_hostname}\" is sailing with project \"#{project}\".\n\n"
40
- say _ship_project_start_print_ports ports
41
- false
40
+ _ship_project_start_print_banner project
41
+ _ship_project_start_print_ports ports
42
+ true
42
43
  end
43
44
 
44
45
  # check if the project is a valid takelship project
@@ -46,10 +47,20 @@ module ShipProjectStart
46
47
  return true if _ship_info_lib_valid_project? takelship, project
47
48
 
48
49
  say 'No valid project found!'
49
- say 'Hint: ship project list'
50
+ say 'Try: ship project list'
50
51
  false
51
52
  end
52
53
 
54
+ # print banner with status information
55
+ def _ship_project_start_print_banner(project)
56
+ ship_hostname = _ship_container_lib_ship_hostname
57
+ ship_dir = _docker_container_lib_homify_dir config.active['project_root_dir']
58
+ say "The takelship #{ship_hostname}"
59
+ say "departed from #{ship_dir}"
60
+ say "ships project #{project}"
61
+ say
62
+ end
63
+
53
64
  # print ports after starting a takelship
54
65
  def _ship_project_start_print_ports(ports)
55
66
  output = []
@@ -63,7 +74,7 @@ module ShipProjectStart
63
74
  description = " (#{description})" if port.key? 'description'
64
75
  output << "#{url.ljust(max_length['url'])} #{service.ljust(max_length['service'])}#{description}"
65
76
  end
66
- output.join("\n")
77
+ say output.join("\n")
67
78
  end
68
79
 
69
80
  # get max length of left column
data/lib/takeltau/version CHANGED
@@ -1 +1 @@
1
- 0.44.19
1
+ 0.44.24
data/lib/takeltau.rb CHANGED
@@ -127,6 +127,11 @@ module Takeltau
127
127
  # @return [String] bash completion code
128
128
  attr_reader :bash_fylla
129
129
 
130
+ option :debug,
131
+ aliases: 'd',
132
+ type: :boolean,
133
+ default: false,
134
+ desc: 'Alias for --loglevel=debug'
130
135
  option :loglevel,
131
136
  aliases: 'l',
132
137
  default: 'INFO',
@@ -141,7 +146,7 @@ module Takeltau
141
146
  super
142
147
 
143
148
  # Initialize global singleton log
144
- initialize_logging options[:loglevel].to_s.upcase
149
+ initialize_logging options[:loglevel].to_s.upcase, options[:debug]
145
150
 
146
151
  # Initialize global singleton config
147
152
  initialize_config options[:workdir]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: takeltau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.19
4
+ version: 0.44.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takelwerk