takeltau 0.44.19 → 0.44.23
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 +4 -4
- data/README.md +27 -22
- data/lib/takeltau/lib/logging.rb +2 -1
- data/lib/takeltau/self/commands.rb +1 -1
- data/lib/takeltau/ship/cli.rb +11 -3
- data/lib/takeltau/ship/container/cli.rb +26 -0
- data/lib/takeltau/ship/container/stop.rb +1 -1
- data/lib/takeltau/ship/project/cli.rb +1 -2
- data/lib/takeltau/ship/project/start.rb +20 -9
- data/lib/takeltau/version +1 -1
- data/lib/takeltau.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec3b62ba1e1249c50ec7025739cd986e89b35fab368a65c31515fa5e67f87170
|
4
|
+
data.tar.gz: 39fd060a35ab0b03f20a5bac6831641dd90264fe0c5641c55a1c70f3e32d9608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5db32c8083f2bfdbfab9a61b4f8edeafd3c5776659279c40b3c6841618a30f8acd57aae855d07908fd237b1d8fc293b13cde9a6c0a9e27c7b0271bd0cb6bd3d7
|
7
|
+
data.tar.gz: 441cc2c4b7d7918be14b04f766ec491324753474f7c8813ee1ee1472e37301dc3ca95518f3edf7922ec0fa884633daf0662da0f82a3b45f3e162d0c1d14cb266
|
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
|
|
@@ -125,9 +125,12 @@ or *tau commands*:
|
|
125
125
|
| tau [ship container clean](features/cucumber/features/ship/container/ship.container.clean.feature) | Stop all takelships |
|
126
126
|
| tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature) [COMMAND] | Run a [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 |
|
131
|
+
| tau [ship container name](features/cucumber/features/ship/container/ship.container.name.feature) | Print the takelship name |
|
130
132
|
| tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) [COMMAND] | 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
135
|
| tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature) [COMMAND] | 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 |
|
@@ -141,10 +144,12 @@ or *tau commands*:
|
|
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
146
|
| tau ship command [COMMAND] | Alias for tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature) |
|
147
|
+
| tau ship docker [COMMAND] | Alias for tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) |
|
144
148
|
| tau ship list | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature) |
|
145
149
|
| tau ship login | Alias for tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature) |
|
146
150
|
| tau ship logs | Alias for tau [ship container logs](features/cucumber/features/ship/container/ship.container.logs.feature) |
|
147
151
|
| tau ship ls | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature) |
|
152
|
+
| tau ship name | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.name.feature) |
|
148
153
|
| tau ship podman [COMMAND] | Alias for tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) |
|
149
154
|
| tau ship sail [PROJECT] | Alias for tau [ship project start](features/cucumber/features/ship/project/ship.project.start.feature) |
|
150
155
|
| tau ship restart [PROJECT] | Alias for tau [ship project restart](features/cucumber/features/ship/project/ship.project.restart.feature) |
|
@@ -173,7 +178,7 @@ or *tau commands*:
|
|
173
178
|
|
174
179
|
*takelage-cli* uses three different YAML configuration files and environment variables which have different precedences.
|
175
180
|
They are merged to an active configuration during runtime
|
176
|
-
which can be inspected with
|
181
|
+
which can be inspected with
|
177
182
|
*tau [self config active](features/cucumber/features/self/self.config.active.feature)*
|
178
183
|
or *tau config*.
|
179
184
|
|
@@ -197,7 +202,7 @@ The project directory is identified by the first match:
|
|
197
202
|
### Configuration Examples
|
198
203
|
|
199
204
|
- You should add the following configuration items in your *~/.takelage.yml*
|
200
|
-
if you want to use the *takelbeta* docker image channel:
|
205
|
+
if you want to use the *takelbeta* docker image channel:
|
201
206
|
|
202
207
|
```yaml
|
203
208
|
---
|
@@ -205,7 +210,7 @@ docker_repo: takelbeta
|
|
205
210
|
```
|
206
211
|
|
207
212
|
- If you want to pin a specific docker tag for one of your projects
|
208
|
-
then create an *takelage.yml* file with:
|
213
|
+
then create an *takelage.yml* file with:
|
209
214
|
|
210
215
|
```yaml
|
211
216
|
---
|
@@ -213,18 +218,18 @@ docker_tag: '1.2.3'
|
|
213
218
|
```
|
214
219
|
|
215
220
|
- The cucumber tests make use of an *~/.takelage.yml*
|
216
|
-
to overwrite defaults like:
|
221
|
+
to overwrite defaults like:
|
217
222
|
|
218
223
|
```yaml
|
219
224
|
---
|
220
225
|
docker_repo: takelage-mock
|
221
226
|
```
|
222
227
|
|
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*:
|
228
|
+
- You may prefer to interact with
|
229
|
+
[mercurial](https://github.com/takelwerk/takelage-doc/blob/main/doc/tau/hg.md)
|
230
|
+
through `tau hg`
|
231
|
+
in a different branch than `main` in one project so you may add
|
232
|
+
to your *takelage.yml*:
|
228
233
|
|
229
234
|
|
230
235
|
```yaml
|
@@ -232,7 +237,7 @@ to your *takelage.yml*:
|
|
232
237
|
git_hg_repo: my_git_hg_branch
|
233
238
|
```
|
234
239
|
|
235
|
-
Furthermore,
|
240
|
+
Furthermore,
|
236
241
|
[every external command](https://github.com/takelwerk/takelage-cli/blob/main/lib/takeltau/default.yml)
|
237
242
|
can be reconfigured.
|
238
243
|
|
@@ -241,7 +246,7 @@ can be reconfigured.
|
|
241
246
|
*tau* reads two different YAML project files
|
242
247
|
which have different precedences.
|
243
248
|
They are merged to an active configuration during runtime
|
244
|
-
which can be inspected with
|
249
|
+
which can be inspected with
|
245
250
|
*tau [info project active](features/cucumber/features/info/info.project.active.feature)*
|
246
251
|
or *tau project*.
|
247
252
|
|
@@ -263,19 +268,19 @@ source <(tau completion bash)
|
|
263
268
|
*takelage-cli* uses
|
264
269
|
[minitest](https://github.com/seattlerb/minitest) unit tests.
|
265
270
|
|
266
|
-
*takelage-cli* ships with
|
271
|
+
*takelage-cli* ships with
|
267
272
|
[cucumber](https://github.com/cucumber/cucumber) ruby system tests.
|
268
|
-
It uses cucumber's
|
273
|
+
It uses cucumber's
|
269
274
|
[aruba](https://github.com/cucumber/aruba) extension and especially its
|
270
275
|
[filesystem](https://relishapp.com/cucumber/aruba/v/0-11-0/docs/filesystem)
|
271
276
|
library.
|
272
277
|
|
273
278
|
*takelage-cli* [deploys](https://docs.docker.com/registry/deploying/)
|
274
|
-
a private docker
|
279
|
+
a private docker
|
275
280
|
[registry](https://hub.docker.com/_/registry)
|
276
281
|
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:
|
282
|
+
The registry exposes port 5005.
|
283
|
+
You need to whitelist it in your host's docker engine configuration:
|
279
284
|
|
280
285
|
```json
|
281
286
|
{
|
data/lib/takeltau/lib/logging.rb
CHANGED
@@ -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}"
|
data/lib/takeltau/ship/cli.rb
CHANGED
@@ -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
|
28
|
+
desc 'ports [COMMAND]', 'Manage takelship ports'
|
30
29
|
subcommand 'ports', ShipPorts
|
31
30
|
|
32
31
|
desc 'project [COMMAND]', 'Manage takelship projects'
|
@@ -56,6 +55,16 @@ module Takeltau
|
|
56
55
|
Takeltau::ShipContainer.new.command(*args)
|
57
56
|
end
|
58
57
|
|
58
|
+
desc 'docker [COMMAND]', 'Run a podman [COMMAND] in a takelship'
|
59
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
60
|
+
Run a podman command as user podman in a takelship container.
|
61
|
+
Alias for ship container podman.
|
62
|
+
LONGDESC
|
63
|
+
# ship docker: {Takeltau::ShipContainer#podman}
|
64
|
+
def docker(*args)
|
65
|
+
Takeltau::ShipContainer.new.podman(*args)
|
66
|
+
end
|
67
|
+
|
59
68
|
desc 'list', 'List takelships'
|
60
69
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
61
70
|
List takelship containers.
|
@@ -177,5 +186,4 @@ module Takeltau
|
|
177
186
|
Takeltau::ShipContainer.new.update
|
178
187
|
end
|
179
188
|
end
|
180
|
-
# rubocop:enable Metrics/ClassLength
|
181
189
|
end
|
@@ -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
|
#
|
@@ -91,6 +104,19 @@ 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
|
#
|
@@ -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
|
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
|
-
|
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
|
37
|
-
return
|
37
|
+
def _ship_project_start_already_sailing?(project, ports)
|
38
|
+
return false unless ship_container_check_existing
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
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 '
|
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.
|
1
|
+
0.44.23
|
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]
|