last_green_go_pipeline 1.0.6 → 1.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 +4 -4
- data/lib/go_cd/green_build.rb +15 -0
- data/lib/go_cd/last_green_build_fetcher.rb +9 -5
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac773370f87965702077d7fee58659c1310dda85
|
4
|
+
data.tar.gz: e01e34d68577fb61d6bb6fb229842cb4969e3b62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aafdf4a7a3909dcea875573d12fa8f68e29b8722a4cf43b74c773f48b313583721611caf741f0b8b783f88c71eaa6c4f15c1225ce19c1cde23525a2bad1e6519
|
7
|
+
data.tar.gz: 63c63fc489e32ed9adcfabf6875c25c3adf2eb05be2985898321933dfaef5400c3eefc1fa1fe4008bbed106907021d52ec90ec970edb3785bf863f05db9d87a9
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GoCD
|
2
|
+
|
3
|
+
class GreenBuild
|
4
|
+
|
5
|
+
attr_reader :completed_at, :materials, :dependencies
|
6
|
+
|
7
|
+
def initialize(stage)
|
8
|
+
@completed_at = stage.completed_at
|
9
|
+
@materials = stage.pipeline.materials
|
10
|
+
@dependencies = stage.pipeline.dependencies
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -3,18 +3,21 @@ Bundler.setup
|
|
3
3
|
require 'go_api_client'
|
4
4
|
require 'pstore'
|
5
5
|
require 'benchmark'
|
6
|
+
require_relative 'green_build'
|
6
7
|
|
7
8
|
module GoCD
|
8
9
|
class LastGreenBuildFetcher
|
9
10
|
|
11
|
+
PAGE_FETCH_LIMIT = 2
|
12
|
+
|
10
13
|
def initialize(options)
|
11
14
|
@options = options
|
12
15
|
@pipeline = @options[:pipeline_name]
|
13
16
|
@stage = @options.delete(:stage_name)
|
14
|
-
@cache = PStore.new(File.expand_path(
|
15
|
-
@options.merge!(:latest_atom_entry_id => recall(:latest_atom_entry_id))
|
17
|
+
@cache = PStore.new(File.expand_path('./.last_green_build_fetcher_cache'))
|
18
|
+
@options.merge!(:latest_atom_entry_id => recall(:latest_atom_entry_id), :page_fetch_limit => PAGE_FETCH_LIMIT)
|
16
19
|
if @options[:latest_atom_entry_id].nil? && ENV['QUIET'].nil?
|
17
|
-
puts "Retrieving the feed for #{@options[:pipeline_name]}/#{@stage}
|
20
|
+
puts "Retrieving the the first #{PAGE_FETCH_LIMIT} feed pages for #{@options[:pipeline_name]}/#{@stage}."
|
18
21
|
end
|
19
22
|
end
|
20
23
|
|
@@ -32,11 +35,12 @@ module GoCD
|
|
32
35
|
pipelines.reverse.each do |pipeline|
|
33
36
|
stage = pipeline.stages.find { |stage| stage.name == @stage }
|
34
37
|
if stage && stage.result == 'Passed'
|
35
|
-
|
38
|
+
stage.pipeline = pipeline
|
39
|
+
remember(:last_green_build, GreenBuild.new(stage))
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
|
-
recall :
|
43
|
+
recall :last_green_build
|
40
44
|
end
|
41
45
|
|
42
46
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: last_green_go_pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bill DePhillips
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.1'
|
41
41
|
description: friendly wrapper around the go-api-client that looks up the last green
|
42
42
|
build of a Go.CD pipeline
|
43
43
|
email:
|
@@ -47,6 +47,7 @@ extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
49
|
- lib/go_cd/last_green_build_fetcher.rb
|
50
|
+
- lib/go_cd/green_build.rb
|
50
51
|
- LICENSE
|
51
52
|
- README.md
|
52
53
|
homepage: https://github.com/rearadmiral/last_green_go_pipeline
|