buildkite-builder 2.0.0 → 2.1.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: 827239e1a697a723a13cf14a5793bf17490d102611003270b3ef73e196428f5c
4
- data.tar.gz: dfe7bf3a2f6e63916812a28b93af9f8b25979fafa8f1b35a608819e4cc4a94bc
3
+ metadata.gz: 1796ef4fc73c74c399a7eb271092baee5b0101e3c06598c8d837d1fd031876e2
4
+ data.tar.gz: c384d20a194cf13a8dff4e1057a1b07b777201fd717f1d75496d88ec04d7fbff
5
5
  SHA512:
6
- metadata.gz: 3e64effb01732d99febf7516897c95d0dd45ca5a4c5dbf61da73dcb0843a3459c6a5ff3ba1e74861f9ab4029a312cfe6225de2a7dc0968c50952d4473920d5e2
7
- data.tar.gz: 3d95fbab003838087d12626fd7240ba7f6359434af0c8e87af15fce0804bcafa219f4af049f6b81e2dbc786eca0152daa8801b41210539e693c0afd2e5607043
6
+ metadata.gz: cc19aa8d8c3af6f4fbbd0bd892d56f41243649b8b384e38f7391d8e198950704bc515530c022c231eb7d4368a7bed0f74fa0f4bab3c020813bf045b67a4d1062
7
+ data.tar.gz: e414869940fbb417e06192a7fdd48049d38564c00f1283a8110c2521462ce736ec890c7275c03c386b619ae718b654a4ac2cbbf460cb1f1dfd86cefb4e871b2c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 2.1.0
2
+ * Fix a bug introduced in 2.0.0 where artifacts were being uploaded before extensions had a chance to do work.
3
+ * Remove `SortedSet` dependency.
4
+ * Add `annotate` pipeline command helper.
5
+ * Add `StepCollection#find` and `StepCollection#find!` for ease of finding a step by its key in extensions.
6
+ * `group` now supports the `emoji:` helper. (Eg. `group "foobar", emoji: :smile`)
7
+
8
+ ## 2.0.0
9
+ * Add support for `group`.
10
+ * `Processor`s has been renamed to `Extension`. Extensions add more capabilities (will document separately).
11
+ * `plugin` no longer takes 2 arguments (source, version). It's simply 1 arg that is both source and version, separated by a `#`. This is more akin to Buildkite's usage.
12
+ * Full refactor of pipeline code allowing for extensions to extend DSL methods.
13
+
1
14
  ## 1.5.0
2
15
  * Merge `BuildKite::Builder::Context` and `BuildKite::Pipelines::Pipeline` to `BuildKite::Builder::Pipeline` (#37)
3
16
 
data/README.md CHANGED
@@ -28,7 +28,7 @@ steps:
28
28
  - label: ":toolbox:"
29
29
  plugins:
30
30
  - docker#v3.7.0:
31
- image: gusto/buildkite-builder:1.2.0
31
+ image: gusto/buildkite-builder:2.1.0
32
32
  propagate-environment: true
33
33
  ```
34
34
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
@@ -10,9 +10,14 @@ module Buildkite
10
10
  end
11
11
 
12
12
  dsl do
13
- def group(label = nil, &block)
13
+ def group(label = nil, emoji: nil, &block)
14
14
  raise "Group does not allow nested in another Group" if context.is_a?(Group)
15
15
 
16
+ if emoji
17
+ emoji = Array(emoji).map { |name| ":#{name}:" }.join
18
+ label = [emoji, label].compact.join(' ')
19
+ end
20
+
16
21
  context.data.steps.push(Buildkite::Builder::Group.new(label, context.data.steps, &block))
17
22
  end
18
23
 
@@ -20,7 +20,7 @@ module Buildkite
20
20
  end
21
21
 
22
22
  def initialize
23
- @modified_files = SortedSet.new(pull_request? ? files_from_pull_request : files_from_git)
23
+ @modified_files = Set.new(pull_request? ? files_from_pull_request.sort! : files_from_git.sort!)
24
24
  end
25
25
 
26
26
  private
@@ -36,7 +36,7 @@ module Buildkite
36
36
  matched.map! { |file| Pathname.new(file) }
37
37
  matched.reject!(&:directory?)
38
38
  matched.map! { |file| file.relative_path_from(Builder.root) }
39
- SortedSet.new(matched)
39
+ Set.new(matched.sort!)
40
40
  end
41
41
  end
42
42
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'digest/md5'
4
4
  require 'pathname'
5
- require 'sorted_set'
6
5
 
7
6
  module Buildkite
8
7
  module Builder
@@ -56,7 +55,7 @@ module Buildkite
56
55
  end
57
56
 
58
57
  def files
59
- @files ||= inclusion_rules.map(&:files).reduce(SortedSet.new, :merge) - exclusion_rules.map(&:files).reduce(SortedSet.new, :merge)
58
+ @files ||= (inclusion_rules.map(&:files).reduce(Set.new, :merge) - exclusion_rules.map(&:files).reduce(Set.new, :merge)).sort.to_set
60
59
  end
61
60
 
62
61
  def digest
@@ -40,9 +40,6 @@ module Buildkite
40
40
  end
41
41
 
42
42
  def upload
43
- logger.info '+++ :paperclip: Uploading artifacts'
44
- upload_artifacts
45
-
46
43
  # Upload the pipeline.
47
44
  Tempfile.create(['pipeline', '.yml']) do |file|
48
45
  file.sync = true
@@ -53,6 +50,9 @@ module Buildkite
53
50
  logger.info '+++ :pipeline: Uploading pipeline'
54
51
  Buildkite::Pipelines::Command.pipeline!(:upload, file.path)
55
52
  end
53
+
54
+ logger.info '+++ :paperclip: Uploading artifacts'
55
+ upload_artifacts
56
56
  end
57
57
 
58
58
  def to_h
@@ -27,6 +27,14 @@ module Buildkite
27
27
  end
28
28
  end
29
29
 
30
+ def find(key)
31
+ @steps.find { |step| step.has?(:key) && step.key == key.to_s }
32
+ end
33
+
34
+ def find!(key)
35
+ find(key) || raise(ArgumentError, "Can't find step with key: #{key}")
36
+ end
37
+
30
38
  def add(step_class, template = nil, **args, &block)
31
39
  @steps.push(step_class.new(self, template, **args, &block)).last
32
40
  end
@@ -21,6 +21,14 @@ module Buildkite
21
21
  new(:artifact, subcommand, *args).run
22
22
  end
23
23
 
24
+ def self.annotate(body, *args)
25
+ new(:annotate, body, *args).run
26
+ end
27
+
28
+ def self.annotate!(*args)
29
+ abort unless annotate(*args)
30
+ end
31
+
24
32
  def initialize(command, subcommand, *args)
25
33
  @command = command.to_s
26
34
  @subcommand = subcommand.to_s
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: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-08-25 00:00:00.000000000 Z
12
+ date: 2021-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: sorted_set
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: rainbow
30
16
  requirement: !ruby/object:Gem::Requirement