buildkite-builder 4.5.0 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/buildkite/builder/commands/run.rb +1 -1
- data/lib/buildkite/builder/pipeline.rb +5 -2
- data/lib/buildkite/pipelines/command.rb +33 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bf8325879836987ca1d33d9822e1c2aaf315843c7ee2b99e5791378a893c767
|
4
|
+
data.tar.gz: 2e9edbde3a0db277878a8f307ef0e1975a4dde99c396e87a3ecb1b9b2673b405
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb4cf5652a702e0d030350db16c0447d72cd2000a6cb32fa4f1a89d00c38cc0e5820661ca1fb67de8abe4a56b177172a4a806a4d05ff954744a01dcd2ec56c32
|
7
|
+
data.tar.gz: c04110b0ca0f550a4a2be480f9aecde71566358fb9d638a4a0c96d1c503c3de6272a75b78083bb21b60d81a3fc12d4440c80445e5a0f9d41bbae5ea4a130ee30
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.6.0
|
@@ -17,7 +17,7 @@ module Buildkite
|
|
17
17
|
# variables to be set. It also uploads the pipeline to Buildkite.
|
18
18
|
log.info "+++ 🧰 #{'Buildkite Builder'.color(:springgreen)} v#{Buildkite::Builder.version} ─ #{relative_pipeline_path.to_s.yellow}"
|
19
19
|
|
20
|
-
if Buildkite::Pipelines::Command.meta_data(:exists, Builder.meta_data.fetch(:job))
|
20
|
+
if Buildkite::Pipelines::Command.meta_data(:exists, Builder.meta_data.fetch(:job)).success?
|
21
21
|
log.info "Pipeline already uploaded in #{Buildkite.env.step_id} step".color(:dimgray)
|
22
22
|
else
|
23
23
|
Pipeline.new(pipeline_path, logger: log).upload
|
@@ -54,8 +54,11 @@ module Buildkite
|
|
54
54
|
file.write(contents)
|
55
55
|
|
56
56
|
logger.info "+++ :pipeline: Uploading pipeline"
|
57
|
-
|
58
|
-
|
57
|
+
|
58
|
+
result = Buildkite::Pipelines::Command.pipeline(:upload, file.path)
|
59
|
+
|
60
|
+
unless result.success?
|
61
|
+
logger.info "Pipeline upload failed with #{result.stderr}, saving as artifact…"
|
59
62
|
Buildkite::Pipelines::Command.artifact!(:upload, file.path)
|
60
63
|
abort
|
61
64
|
end
|
@@ -7,6 +7,23 @@ module Buildkite
|
|
7
7
|
class Command
|
8
8
|
class CommandFailedError < StandardError; end
|
9
9
|
|
10
|
+
class Result
|
11
|
+
attr_reader :stdout, :stderr
|
12
|
+
def initialize(stdout, stderr, status)
|
13
|
+
@stdout = stdout.strip
|
14
|
+
@stderr = stderr.strip
|
15
|
+
@status = status
|
16
|
+
end
|
17
|
+
|
18
|
+
def success?
|
19
|
+
@status.success?
|
20
|
+
end
|
21
|
+
|
22
|
+
def output
|
23
|
+
@output ||= "#{stdout}\n#{stderr}".strip
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
10
27
|
BIN_PATH = 'buildkite-agent'
|
11
28
|
COMMANDS = %w(
|
12
29
|
pipeline
|
@@ -21,12 +38,12 @@ module Buildkite
|
|
21
38
|
end
|
22
39
|
|
23
40
|
def artifact(subcommand, *args, exception: false)
|
24
|
-
|
25
|
-
when 'shasum', 'search' then true
|
26
|
-
else false
|
27
|
-
end
|
41
|
+
result = new(:artifact, subcommand, *args).run(exception: exception)
|
28
42
|
|
29
|
-
|
43
|
+
case subcommand.to_s
|
44
|
+
when 'shasum', 'search' then result.output
|
45
|
+
else result
|
46
|
+
end
|
30
47
|
end
|
31
48
|
|
32
49
|
def annotate(body, *args, exception: false)
|
@@ -34,12 +51,12 @@ module Buildkite
|
|
34
51
|
end
|
35
52
|
|
36
53
|
def meta_data(subcommand, *args, exception: false)
|
37
|
-
|
38
|
-
when 'get', 'keys' then true
|
39
|
-
else false
|
40
|
-
end
|
54
|
+
result = new(:'meta-data', subcommand, *args).run(exception: exception)
|
41
55
|
|
42
|
-
|
56
|
+
case subcommand.to_s
|
57
|
+
when 'get', 'keys' then result.output
|
58
|
+
else result
|
59
|
+
end
|
43
60
|
end
|
44
61
|
end
|
45
62
|
|
@@ -58,16 +75,14 @@ module Buildkite
|
|
58
75
|
@args = transform_args(args)
|
59
76
|
end
|
60
77
|
|
61
|
-
def run(
|
78
|
+
def run(exception: false)
|
62
79
|
stdout, stderr, status = Open3.capture3(*to_a)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
elsif exception
|
68
|
-
raise CommandFailedError, "#{stdout}\n#{stderr}"
|
80
|
+
result = Result.new(stdout, stderr, status)
|
81
|
+
|
82
|
+
if !result.success? && exception
|
83
|
+
raise CommandFailedError, "#{result.output}"
|
69
84
|
else
|
70
|
-
|
85
|
+
result
|
71
86
|
end
|
72
87
|
end
|
73
88
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildkite-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ngan Pham
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rainbow
|