ski 0.0.4 → 0.0.5
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/lib/project.rb +23 -20
- data/test/schema.yml +38 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c008b0ca30880effe6e9a44511e8bb2602ab865
|
4
|
+
data.tar.gz: 3edb69ea5640eedc6d88bf5aa6bb787fb1f2cacf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf2387377040c03d55b704ecb4c3e5fef6be7e539df848ed826f6b33ce5ea075e5a62baa62d1a9453f81e79c379bd76bd0b11cacb25845ae34a82489cfa2caa
|
7
|
+
data.tar.gz: 7c878a934ef61c065b7bbb7e9f5b2e7694d4a5e73dd8a4c97ebafc8748008bd6eaab4ba94e2f865cbcca63ef75c5ec1c11bc8577288d65f2cd71a899bfc8a24b
|
data/lib/project.rb
CHANGED
@@ -9,56 +9,59 @@ module Ski
|
|
9
9
|
attr_reader :credentials
|
10
10
|
|
11
11
|
def initialize(config)
|
12
|
+
@targets = config.dig('targets')
|
12
13
|
@title = config.dig('title')
|
13
14
|
@description = config.dig('description')
|
14
15
|
@pipelines = config.dig('pipelines')
|
15
16
|
@credentials = config.dig('pipelines')
|
17
|
+
@interactive = config.dig('interactive')
|
16
18
|
@fail = false
|
17
|
-
puts "PROJECT: #{@title}"
|
18
|
-
puts "DESCRIPTION: #{@description}"
|
19
|
-
puts "PIPELINES:"
|
20
|
-
@pipelines.each do |pipeline|
|
21
|
-
puts " ID: #{pipeline.dig('pipeline', 'id')}"
|
22
|
-
puts " DESCRIPTION: #{pipeline.dig('pipeline', 'description')}"
|
23
|
-
puts " TASKS: #{pipeline.dig('pipeline', 'tasks').count}"
|
24
|
-
end
|
25
19
|
end
|
26
20
|
|
27
|
-
def kick_off(
|
28
|
-
@pipeline = @pipelines.
|
21
|
+
def kick_off(pipeline_name)
|
22
|
+
@pipeline = @pipelines.dig(pipeline_name) || nil
|
23
|
+
if @pipeline.nil?
|
24
|
+
puts 'ERROR: Pipeline does not exist!'
|
25
|
+
exit 255
|
26
|
+
end
|
27
|
+
puts "PROJECT: #{@title}"
|
28
|
+
puts "DESCRIPTION: #{@description}"
|
29
|
+
puts "PIPELINE: #{pipeline_name}"
|
30
|
+
puts "DESCRIPTION: #{@pipeline.dig('description')}"
|
31
|
+
puts "TASKS: #{@pipeline.dig('tasks').count}"
|
29
32
|
run(tasks, 'TASK:')
|
30
33
|
if @fail
|
31
|
-
run(error_tasks, '
|
34
|
+
run(error_tasks, 'CATCH:')
|
32
35
|
else
|
33
|
-
run(success_tasks, '
|
36
|
+
run(success_tasks, 'THEN:')
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
37
40
|
private
|
38
41
|
|
39
42
|
def error_tasks
|
40
|
-
@pipeline.dig('
|
43
|
+
@pipeline.dig('catch') || []
|
41
44
|
end
|
42
45
|
|
43
46
|
def success_tasks
|
44
|
-
@pipeline.dig('
|
47
|
+
@pipeline.dig('then') || []
|
45
48
|
end
|
46
49
|
|
47
50
|
def tasks
|
48
|
-
@pipeline.dig('
|
51
|
+
@pipeline.dig('tasks') || []
|
49
52
|
end
|
50
53
|
|
51
54
|
def ff
|
52
|
-
@pipeline.dig('
|
55
|
+
@pipeline.dig('fail-fast') || true
|
53
56
|
end
|
54
57
|
|
55
58
|
def run(tasks, prefix)
|
56
|
-
tasks.
|
57
|
-
puts "************ #{prefix} Running: #{
|
58
|
-
stdout, stderr, status = Open3.capture3(
|
59
|
+
tasks.each do |key, value|
|
60
|
+
puts "************ #{prefix} Running: #{key} ************"
|
61
|
+
stdout, stderr, status = Open3.capture3(value.dig('command').to_s)
|
59
62
|
if status.exitstatus != 0
|
60
63
|
@fail = true
|
61
|
-
puts "
|
64
|
+
puts "STDERR: #{status.exitstatus} #{ stderr if stderr != ''}"
|
62
65
|
break if ff
|
63
66
|
end
|
64
67
|
puts stdout
|
data/test/schema.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
title:
|
2
|
+
description:
|
3
|
+
pipelines:
|
4
|
+
build:
|
5
|
+
description:
|
6
|
+
fail-fast:
|
7
|
+
interactive:
|
8
|
+
target:
|
9
|
+
tasks:
|
10
|
+
show-all-local-files:
|
11
|
+
description:
|
12
|
+
command:
|
13
|
+
show-space-used:
|
14
|
+
description:
|
15
|
+
command:
|
16
|
+
ping-google:
|
17
|
+
description:
|
18
|
+
command:
|
19
|
+
check-processes:
|
20
|
+
description:
|
21
|
+
command:
|
22
|
+
check-ruby-version:
|
23
|
+
description:
|
24
|
+
command:
|
25
|
+
then:
|
26
|
+
greet:
|
27
|
+
description:
|
28
|
+
command:
|
29
|
+
catch:
|
30
|
+
greet:
|
31
|
+
description:
|
32
|
+
command:
|
33
|
+
targets:
|
34
|
+
local:
|
35
|
+
ip:
|
36
|
+
username:
|
37
|
+
password:
|
38
|
+
ssh-key:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ski
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niklas Hanft
|
@@ -27,6 +27,7 @@ files:
|
|
27
27
|
- lib/project.rb
|
28
28
|
- lib/ski.rb
|
29
29
|
- modules/networking.rb
|
30
|
+
- test/schema.yml
|
30
31
|
homepage: https://github.com/ParadoXxGER/ski
|
31
32
|
licenses:
|
32
33
|
- MIT
|