buildkit 0.4.0 → 1.0.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
  SHA1:
3
- metadata.gz: 0e8e7e8d70271e9586222b477e7945262fbf87e3
4
- data.tar.gz: 7368c5308d1c8550eef30748fc3bbd69e67fb828
3
+ metadata.gz: d162a0a598036a70a22e5e46e3a71cf6f0b00f6e
4
+ data.tar.gz: bffdf975b211b039d78e2d8d1995fd25acddd153
5
5
  SHA512:
6
- metadata.gz: 6555de8adc533b85cb01b4704ffce09daf21e282900926b48eb1dd38346e4367d7f5cf26f4e4c75a59f612ab4563e8439980ab9fc4026d635080208a4d22c885
7
- data.tar.gz: f6009e1e15930027a2eda79ae5231de977ba0ece624f682eff4b7eb16c27c31818fa5576a3b3acdab00004bbdb6141587f5e8749e066a2b7a291a1a17b4cad11
6
+ metadata.gz: a704cd607dc9c306626f24e7f47cb1854d658153755146d926a12185a00101129e088f7e712a0713fce79660311dc6909370906ea04f43aeedd95665ad925eb2
7
+ data.tar.gz: 5df600fb07dbbf3b468d4ade3390c7600e0949ed7322cff18ae40ba8f4be8ef29a0301760fad6e77c3169b58ad9c312a8c98ab1ae1bf869f83ca118ecb590c81
@@ -2,7 +2,7 @@ require 'sawyer'
2
2
  require 'buildkit/client/agents'
3
3
  require 'buildkit/client/builds'
4
4
  require 'buildkit/client/organizations'
5
- require 'buildkit/client/projects'
5
+ require 'buildkit/client/pipelines'
6
6
  require 'buildkit/response/raise_error'
7
7
 
8
8
  module Buildkit
@@ -10,9 +10,9 @@ module Buildkit
10
10
  include Agents
11
11
  include Builds
12
12
  include Organizations
13
- include Projects
13
+ include Pipelines
14
14
 
15
- DEFAULT_ENDPOINT = 'https://api.buildkite.com/v1/'.freeze
15
+ DEFAULT_ENDPOINT = 'https://api.buildkite.com/v2/'.freeze
16
16
 
17
17
  # Header keys that can be passed in options hash to {#get},{#head}
18
18
  CONVENIENCE_HEADERS = Set.new([:accept, :content_type])
@@ -11,7 +11,7 @@ module Buildkit
11
11
  # @example
12
12
  # Buildkit.agents('my-great-org')
13
13
  def agents(org, options = {})
14
- get("/v1/organizations/#{org}/agents", options)
14
+ get("/v2/organizations/#{org}/agents", options)
15
15
  end
16
16
 
17
17
  # Get an agent
@@ -23,30 +23,7 @@ module Buildkit
23
23
  # @example
24
24
  # Buildkit.agent('my-great-org', '0b461f65-e7be-4c80-888a-ef11d81fd971')
25
25
  def agent(org, id, options = {})
26
- get("/v1/organizations/#{org}/agents/#{id}", options)
27
- end
28
-
29
- # Create an agent
30
- #
31
- # @param org [String] Organization slug.
32
- # @param name [String] The name of the agent.
33
- # @return [Sawyer::Resource] Your newly created agent
34
- # @see https://buildkite.com/docs/api/agents#create-an-agent
35
- # @example Create a new Agent for an organization
36
- # Buildkit.create_agent('my-great-org', 'new-agent')
37
- def create_agent(org, name, options = {})
38
- post("/v1/organizations/#{org}/agents", options.merge(name: name))
39
- end
40
-
41
- # Delete an agent
42
- #
43
- # @param org [String] Organization slug.
44
- # @param id [String] Agent id.
45
- # @see https://buildkite.com/docs/api/agents#delete-an-agent
46
- # @example Delete an existing agent
47
- # Buildkit.delete_agent('my-great-org', '16940c91-f12d-4122-8154-0edf6c0978c2')
48
- def delete_agent(org, id, options = {})
49
- delete("/v1/organizations/#{org}/agents/#{id}", options)
26
+ get("/v2/organizations/#{org}/agents/#{id}", options)
50
27
  end
51
28
 
52
29
  # Stop an agent
@@ -57,7 +34,7 @@ module Buildkit
57
34
  # @example Stop an agent
58
35
  # Buildkit.stop_agent('my-great-org', '16940c91-f12d-4122-8154-0edf6c0978c2')
59
36
  def stop_agent(org, id, options = {})
60
- put("/v1/organizations/#{org}/agents/#{id}/stop", options)
37
+ put("/v2/organizations/#{org}/agents/#{id}/stop", options)
61
38
  end
62
39
  end
63
40
  end
@@ -11,7 +11,7 @@ module Buildkit
11
11
  # @example
12
12
  # Buildkit.builds
13
13
  def builds(options = {})
14
- get('/v1/builds', options)
14
+ get('/v2/builds', options)
15
15
  end
16
16
 
17
17
  # List builds for an organization
@@ -22,53 +22,53 @@ module Buildkit
22
22
  # @example
23
23
  # Buildkit.organization_builds('my-great-org'))
24
24
  def organization_builds(org, options = {})
25
- get("/v1/organizations/#{org}/builds", options)
25
+ get("/v2/organizations/#{org}/builds", options)
26
26
  end
27
27
 
28
- # List builds for a project
28
+ # List builds for a pipeline
29
29
  #
30
30
  # @param org [String] Organization slug.
31
- # @param project [String] Project slug.
31
+ # @param pipeline [String] pipeline slug.
32
32
  # @return [Array<Sawyer::Resource>] Array of hashes representing Buildkite builds.
33
- # @see https://buildkite.com/docs/api/builds#list-builds-for-a-project
33
+ # @see https://buildkite.com/docs/api/builds#list-builds-for-a-pipeline
34
34
  # @example
35
- # Buildkit.project_builds('my-great-org', 'great-project')
36
- def project_builds(org, project, options = {})
37
- get("/v1/organizations/#{org}/projects/#{project}/builds", options)
35
+ # Buildkit.pipeline_builds('my-great-org', 'great-pipeline')
36
+ def pipeline_builds(org, pipeline, options = {})
37
+ get("/v2/organizations/#{org}/pipelines/#{pipeline}/builds", options)
38
38
  end
39
39
 
40
40
  # Get a build
41
41
  #
42
42
  # @param org [String] Organization slug.
43
- # @param project [String] Project slug.
43
+ # @param pipeline [String] pipeline slug.
44
44
  # @param number [Integer] Build number.
45
45
  # @return [Sawyer::Resource] Hash representing Buildkite build.
46
46
  # @see https://buildkite.com/docs/api/builds#get-a-build
47
47
  # @example
48
- # Buildkit.build('my-great-org', 'great-project', 42)
49
- def build(org, project, number, options = {})
50
- get("/v1/organizations/#{org}/projects/#{project}/builds/#{number}", options)
48
+ # Buildkit.build('my-great-org', 'great-pipeline', 42)
49
+ def build(org, pipeline, number, options = {})
50
+ get("/v2/organizations/#{org}/pipelines/#{pipeline}/builds/#{number}", options)
51
51
  end
52
52
 
53
53
  # Rebuild a build
54
54
  #
55
55
  # @param org [String] Organization slug.
56
- # @param project [String] Project slug.
56
+ # @param pipeline [String] pipeline slug.
57
57
  # @param number [Integer] Build number.
58
58
  # @see https://buildkite.com/docs/api/builds#rebuild-a-build
59
59
  # @example
60
- # Buildkit.rebuild('my-great-org', 'great-project', 42)
61
- def rebuild(org, project, number, options = {})
62
- put("/v1/organizations/#{org}/projects/#{project}/builds/#{number}/rebuild", options)
60
+ # Buildkit.rebuild('my-great-org', 'great-pipeline', 42)
61
+ def rebuild(org, pipeline, number, options = {})
62
+ put("/v2/organizations/#{org}/pipelines/#{pipeline}/builds/#{number}/rebuild", options)
63
63
  end
64
64
 
65
65
  # Create a build
66
66
  #
67
67
  # @param org [String] Organization slug.
68
- # @param project [String] Project slug.
68
+ # @param pipeline [String] pipeline slug.
69
69
  # @see https://buildkite.com/docs/api/builds#create-a-build
70
70
  # @example
71
- # Buildkit.create_build('my-great-org', 'great-project', {
71
+ # Buildkit.create_build('my-great-org', 'great-pipeline', {
72
72
  # commit: 'HEAD',
73
73
  # branch: 'master',
74
74
  # message: 'Hello, world!',
@@ -78,8 +78,8 @@ module Buildkit
78
78
  # }
79
79
  # })
80
80
  #
81
- def create_build(org, project, options = {})
82
- post("/v1/organizations/#{org}/projects/#{project}/builds", options)
81
+ def create_build(org, pipeline, options = {})
82
+ post("/v2/organizations/#{org}/pipelines/#{pipeline}/builds", options)
83
83
  end
84
84
  end
85
85
  end
@@ -11,7 +11,7 @@ module Buildkit
11
11
  # @example
12
12
  # Buildkit.organizations
13
13
  def organizations(options = {})
14
- get('/v1/organizations', options)
14
+ get('/v2/organizations', options)
15
15
  end
16
16
 
17
17
  # Get an organization
@@ -22,7 +22,7 @@ module Buildkit
22
22
  # @example
23
23
  # Buildkit.organization('my-great-org')
24
24
  def organization(org, options = {})
25
- get("/v1/organizations/#{org}", options)
25
+ get("/v2/organizations/#{org}", options)
26
26
  end
27
27
  end
28
28
  end
@@ -0,0 +1,53 @@
1
+ module Buildkit
2
+ class Client
3
+ # Methods for the pipelines API
4
+ #
5
+ # @see https://buildkite.com/docs/api/pipelines
6
+ module Pipelines
7
+ # List pipelines
8
+ #
9
+ # @return [Array<Sawyer::Resource>] Array of hashes representing Buildkite pipelines.
10
+ # @see https://buildkite.com/docs/api/pipelines#list-pipelines
11
+ # @example
12
+ # Buildkit.pipelines('my-great-org')
13
+ def pipelines(org, options = {})
14
+ get("/v2/organizations/#{org}/pipelines", options)
15
+ end
16
+
17
+ # Get a pipeline
18
+ #
19
+ # @param org [String] Organization slug.
20
+ # @param pipeline [String] pipeline slug.
21
+ # @return [Sawyer::Resource] Hash representing Buildkite pipeline
22
+ # @see https://buildkite.com/docs/api/pipelines#get-a-pipeline
23
+ # @example
24
+ # Buildkit.pipeline('my-great-org', 'great-pipeline')
25
+ def pipeline(org, pipeline, options = {})
26
+ get("/v2/organizations/#{org}/pipelines/#{pipeline}", options)
27
+ end
28
+
29
+ # Create a pipeline
30
+ #
31
+ # @param org [String] Organization slug.
32
+ # @see https://buildkite.com/docs/api/pipelines#create-a-pipeline
33
+ # @example
34
+ # Buildkit.create_build('my-great-org', {
35
+ # name: 'My pipeline',
36
+ # repository: 'git@github.com:acme/pipeline.git',
37
+ # steps: [
38
+ # {
39
+ # type: 'script',
40
+ # name: 'Build',
41
+ # command: 'script/build.sh'
42
+ # }
43
+ # ],
44
+ # timeout_in_minutes: 10,
45
+ # agent_query_rules: ['test=true']
46
+ # })
47
+ #
48
+ def create_pipeline(org, options = {})
49
+ post("/v2/organizations/#{org}/pipelines", options)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,3 +1,3 @@
1
1
  module Buildkit
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-11 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sawyer
@@ -62,7 +62,7 @@ files:
62
62
  - lib/buildkit/client/agents.rb
63
63
  - lib/buildkit/client/builds.rb
64
64
  - lib/buildkit/client/organizations.rb
65
- - lib/buildkit/client/projects.rb
65
+ - lib/buildkit/client/pipelines.rb
66
66
  - lib/buildkit/error.rb
67
67
  - lib/buildkit/response/raise_error.rb
68
68
  - lib/buildkit/version.rb
@@ -1,30 +0,0 @@
1
- module Buildkit
2
- class Client
3
- # Methods for the Projects API
4
- #
5
- # @see https://buildkite.com/docs/api/projects
6
- module Projects
7
- # List projects
8
- #
9
- # @return [Array<Sawyer::Resource>] Array of hashes representing Buildkite projects.
10
- # @see https://buildkite.com/docs/api/projects#list-projects
11
- # @example
12
- # Buildkit.projects('my-great-org')
13
- def projects(org, options = {})
14
- get("/v1/organizations/#{org}/projects", options)
15
- end
16
-
17
- # Get a project
18
- #
19
- # @param org [String] Organization slug.
20
- # @param project [String] Project slug.
21
- # @return [Sawyer::Resource] Hash representing Buildkite project
22
- # @see https://buildkite.com/docs/api/projects#get-a-project
23
- # @example
24
- # Buildkit.project('my-great-org', 'great-project')
25
- def project(org, project, options = {})
26
- get("/v1/organizations/#{org}/projects/#{project}", options)
27
- end
28
- end
29
- end
30
- end