buildkite-builder 4.3.0 → 4.5.0

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: 6d27ba7be3d5fd3885be95d7d296c05643232507da5cd6b006ff7a3e94f68981
4
- data.tar.gz: db8bbe46f1a8848a67ed4eb7d75652864decaddd7efbb9546a83f0221c79635d
3
+ metadata.gz: c47c9c53151cf213174d4be297b48cc832a92d112c0227eea50ee04f7b8a2951
4
+ data.tar.gz: 1d2db37e56f3e5a5dbe13b2cb5b6355fe58a698ef60197ad4bd7d16d07d347cf
5
5
  SHA512:
6
- metadata.gz: 88570f93c62497ec97289a55169ad8932836b1f31cc1d503416f0abb8bfa7d5a774e1f8d43495e8f3a9fb44abe5b8283e209652cb1a6383f664a4fc3a0e15a57
7
- data.tar.gz: f257e71d32997ce9fabc7b71dab4afedc3771b961c5f6783a142b365bd59182e727b7198edb33311b126233a6d8682619c4ed774d1df618c0374a237d3f3ed79
6
+ metadata.gz: 256e662ade3a59a9ed2660b8e954781c3cbe995476187e8c186eadbe9e35a0e9c41ac750e5df8afc932c2643df59b99c51bb35b6dc878cddd7f17580e41b17ba
7
+ data.tar.gz: 40d109033e53bfc4eb80a4bfb9721cd5569d7fe9c608962da1e9003a0d202c1ff3d3edd7b89f1b6239ba3c7a3108513733abd898f1983491c12dc2fdb8c4d528
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 4.5.0
2
+ * Do not upload `pipeline.yml` when steps is empty.
3
+
4
+ ### 4.4.0
5
+ * Fix multiple arguments for `depends_on`.
6
+
1
7
  ### 4.3.0
2
8
  * Remove the `DependsOn` helper module since it doesn't do anything additive.
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.3.0
1
+ 4.5.0
@@ -45,20 +45,25 @@ module Buildkite
45
45
 
46
46
  upload_artifacts
47
47
 
48
- # Upload the pipeline.
49
- Tempfile.create(['pipeline', '.yml']) do |file|
50
- file.sync = true
51
- file.write(contents)
52
-
53
- logger.info "+++ :pipeline: Uploading pipeline"
54
- unless Buildkite::Pipelines::Command.pipeline(:upload, file.path)
55
- logger.info "Pipeline upload failed, saving as artifact…"
56
- Buildkite::Pipelines::Command.artifact!(:upload, file.path)
57
- abort
48
+ if data.steps.empty?
49
+ logger.info "+++ :pipeline: No steps defined, skipping pipeline upload"
50
+ else
51
+ # Upload the pipeline.
52
+ Tempfile.create(['pipeline', '.yml']) do |file|
53
+ file.sync = true
54
+ file.write(contents)
55
+
56
+ logger.info "+++ :pipeline: Uploading pipeline"
57
+ unless Buildkite::Pipelines::Command.pipeline(:upload, file.path)
58
+ logger.info "Pipeline upload failed, saving as artifact…"
59
+ Buildkite::Pipelines::Command.artifact!(:upload, file.path)
60
+ abort
61
+ end
58
62
  end
59
- logger.info "+++ :toolbox: Setting job meta-data to #{Buildkite.env.job_id.color(:yellow)}"
60
- Buildkite::Pipelines::Command.meta_data!(:set, Builder.meta_data.fetch(:job), Buildkite.env.step_id)
61
63
  end
64
+
65
+ logger.info "+++ :toolbox: Setting job meta-data to #{Buildkite.env.job_id.color(:yellow)}"
66
+ Buildkite::Pipelines::Command.meta_data!(:set, Builder.meta_data.fetch(:job), Buildkite.env.step_id)
62
67
  end
63
68
 
64
69
  def to_h
@@ -55,6 +55,10 @@ module Buildkite
55
55
  def to_definition
56
56
  @steps.map(&:to_h)
57
57
  end
58
+
59
+ def empty?
60
+ @steps.empty? || (@steps.all? { |step| step.is_a?(Pipelines::Steps::Group) && step.steps.empty? })
61
+ end
58
62
  end
59
63
  end
60
64
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Buildkite
4
+ module Pipelines
5
+ module Helpers
6
+ module DependsOn
7
+ def depends_on(*values)
8
+ values.any? ? super(values) : super()
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -6,6 +6,7 @@ module Buildkite
6
6
  ATTRIBUTE_HELPERS = {
7
7
  block: :Block,
8
8
  command: :Command,
9
+ depends_on: :DependsOn,
9
10
  key: :Key,
10
11
  label: :Label,
11
12
  plugins: :Plugins,
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.3.0
4
+ version: 4.5.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-09-27 00:00:00.000000000 Z
12
+ date: 2023-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
@@ -134,6 +134,7 @@ files:
134
134
  - lib/buildkite/pipelines/helpers.rb
135
135
  - lib/buildkite/pipelines/helpers/block.rb
136
136
  - lib/buildkite/pipelines/helpers/command.rb
137
+ - lib/buildkite/pipelines/helpers/depends_on.rb
137
138
  - lib/buildkite/pipelines/helpers/key.rb
138
139
  - lib/buildkite/pipelines/helpers/label.rb
139
140
  - lib/buildkite/pipelines/helpers/plugins.rb
@@ -173,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
174
  - !ruby/object:Gem::Version
174
175
  version: '0'
175
176
  requirements: []
176
- rubygems_version: 3.3.26
177
+ rubygems_version: 3.3.13
177
178
  signing_key:
178
179
  specification_version: 4
179
180
  summary: A gem for programmatically creating Buildkite pipelines.