concourse-github-status 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +33 -0
- data/LICENSE.txt +13 -0
- data/README.org +54 -0
- data/bin/out +10 -0
- data/concourse-github-status.gemspec +17 -0
- data/lib/github-status/out.rb +97 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37681d254aa1cc86d5b71a12c61755b39a3142b3
|
4
|
+
data.tar.gz: 5cb323a8ebf24bed9873cfec9b1687ce9eb77a7d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd652cbfa3939568adcd4739559fc3bb5d1b84afc2aad191ffecc4a12ea46bdd228d161d28023e7bd6676ec4366d6f89854470b6120e0d3be7a03df758965da5
|
7
|
+
data.tar.gz: 1b389a5affe1cc2559a0591518650e0f5dac1777e014c1fe21f423ba03c73cbb29b6e7c6b3c73701765b54d281b1ef499d25c4905eb7788fb13edaf835a480ef
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
vendor/**
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
concourse-github-status (0.1.0)
|
5
|
+
concourse-fuselage (~> 0.1, >= 0.1.0)
|
6
|
+
git (~> 1.3, >= 1.3.0)
|
7
|
+
octokit (~> 4.2, >= 4.2.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.3.8)
|
13
|
+
concourse-fuselage (0.1.0)
|
14
|
+
contracts (~> 0.13, >= 0.13.0)
|
15
|
+
contracts (0.13.0)
|
16
|
+
faraday (0.9.2)
|
17
|
+
multipart-post (>= 1.2, < 3)
|
18
|
+
git (1.3.0)
|
19
|
+
multipart-post (2.0.0)
|
20
|
+
octokit (4.2.0)
|
21
|
+
sawyer (~> 0.6.0, >= 0.5.3)
|
22
|
+
sawyer (0.6.0)
|
23
|
+
addressable (~> 2.3.5)
|
24
|
+
faraday (~> 0.8, < 0.10)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
concourse-github-status!
|
31
|
+
|
32
|
+
BUNDLED WITH
|
33
|
+
1.11.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2016 Chris Olstrom <chris@olstrom.com>
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.org
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#+TITLE: GitHub Status
|
2
|
+
#+SUBTITLE: A Custom Resource for Concourse
|
3
|
+
#+LATEX: \pagebreak
|
4
|
+
|
5
|
+
* Overview
|
6
|
+
|
7
|
+
Create and update GitHub statuses from Concourse.
|
8
|
+
|
9
|
+
* Usage
|
10
|
+
|
11
|
+
Add the resource to your pipeline's ~resource_types~ (requires Concourse 0.74.0+)
|
12
|
+
|
13
|
+
#+BEGIN_SRC yaml
|
14
|
+
resource_types:
|
15
|
+
- name: github-status
|
16
|
+
type: docker-image
|
17
|
+
source:
|
18
|
+
repository: colstrom/concourse-github-status
|
19
|
+
#+END_SRC
|
20
|
+
|
21
|
+
* Source Configuration
|
22
|
+
|
23
|
+
|--------------+----------+---------------------------------------------|
|
24
|
+
| Name | Required | Description |
|
25
|
+
|--------------+----------+---------------------------------------------|
|
26
|
+
| repo | Yes | The GitHub repository in ~user/repo~ format |
|
27
|
+
| access_token | Yes | The access token to use with the GitHub API |
|
28
|
+
|--------------+----------+---------------------------------------------|
|
29
|
+
|
30
|
+
* Behaviour
|
31
|
+
|
32
|
+
** ~out~ Update the status for a commit
|
33
|
+
|
34
|
+
*** Parameters
|
35
|
+
|
36
|
+
|-------------+----------+-----------+--------------------------------------------|
|
37
|
+
| Name | Required | Default | Description |
|
38
|
+
|-------------+----------+-----------+--------------------------------------------|
|
39
|
+
| path | Yes | | Relative path to the repository |
|
40
|
+
| state | Yes | | One of ~pending~, ~success~, or ~failure~ |
|
41
|
+
| context | No | concourse | The ~context~ for the status being updated |
|
42
|
+
| description | No | | A description of the context. |
|
43
|
+
|-------------+----------+-----------+--------------------------------------------|
|
44
|
+
|
45
|
+
** ~check~ Not Implemented
|
46
|
+
** ~in~ Not Implemented
|
47
|
+
|
48
|
+
* License
|
49
|
+
|
50
|
+
Apache 2.0 License, see ~LICENSE.txt~ for details.
|
51
|
+
|
52
|
+
* Contributors
|
53
|
+
|
54
|
+
- [[https://colstrom.github.io/][Chris Olstrom]] | [[mailto:chris@olstrom.com][e-mail]] | [[https://twitter.com/ChrisOlstrom][Twitter]]
|
data/bin/out
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.name = 'concourse-github-status'
|
3
|
+
gem.version = '0.1.0'
|
4
|
+
gem.authors = ['Chris Olstrom']
|
5
|
+
gem.license = 'Apache-2.0'
|
6
|
+
gem.summary = 'GitHub Status resource for Concourse'
|
7
|
+
gem.description = 'Concourse Resource for updating arbitrary GitHub statuses'
|
8
|
+
|
9
|
+
gem.files = `git ls-files`.split("\n")
|
10
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
11
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
12
|
+
gem.require_paths = ['lib']
|
13
|
+
|
14
|
+
gem.add_runtime_dependency 'concourse-fuselage', '~> 0.1', '>= 0.1.0'
|
15
|
+
gem.add_runtime_dependency 'git', '~> 1.3', '>= 1.3.0'
|
16
|
+
gem.add_runtime_dependency 'octokit', '~> 4.2', '>= 4.2.0'
|
17
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'concourse-fuselage'
|
4
|
+
require 'contracts'
|
5
|
+
require 'git'
|
6
|
+
require 'octokit'
|
7
|
+
|
8
|
+
module GitHubStatus
|
9
|
+
class Out < Fuselage::Out
|
10
|
+
Contract None => String
|
11
|
+
def repo
|
12
|
+
@repo ||= source.fetch 'repo'
|
13
|
+
rescue KeyError
|
14
|
+
STDERR.puts 'Source is missing repo'
|
15
|
+
abort
|
16
|
+
end
|
17
|
+
|
18
|
+
Contract None => String
|
19
|
+
def access_token
|
20
|
+
@access_token ||= source.fetch 'access_token'
|
21
|
+
rescue KeyError
|
22
|
+
STDERR.puts 'Source is missing access_token'
|
23
|
+
abort
|
24
|
+
end
|
25
|
+
|
26
|
+
Contract None => String
|
27
|
+
def state
|
28
|
+
@state ||= params.fetch 'state'
|
29
|
+
rescue KeyError
|
30
|
+
STDERR.puts 'Params is missing state'
|
31
|
+
abort
|
32
|
+
end
|
33
|
+
|
34
|
+
Contract None => String
|
35
|
+
def path
|
36
|
+
@path ||= params.fetch 'path'
|
37
|
+
rescue KeyError
|
38
|
+
STDERR.puts 'Params is missing path'
|
39
|
+
abort
|
40
|
+
end
|
41
|
+
|
42
|
+
Contract None => String
|
43
|
+
def context
|
44
|
+
@context ||= params.fetch 'context', 'concourse'
|
45
|
+
end
|
46
|
+
|
47
|
+
Contract None => String
|
48
|
+
def description
|
49
|
+
@description ||= params.fetch 'description', ''
|
50
|
+
end
|
51
|
+
|
52
|
+
Contract None => String
|
53
|
+
def target_url
|
54
|
+
@target_url ||= "#{atc_external_url}/builds/#{build_id}"
|
55
|
+
end
|
56
|
+
|
57
|
+
Contract None => HashOf[Symbol, String]
|
58
|
+
def options
|
59
|
+
@options ||= {
|
60
|
+
context: context,
|
61
|
+
target_url: target_url,
|
62
|
+
description: description
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
Contract None => Git::Repository
|
67
|
+
def git
|
68
|
+
@git ||= Git.open "#{working_path}/#{path}"
|
69
|
+
rescue ArgumentError
|
70
|
+
STDERR.puts "#{path} is not a git repository"
|
71
|
+
abort
|
72
|
+
end
|
73
|
+
|
74
|
+
Contract None => String
|
75
|
+
def sha
|
76
|
+
@repo ||= git.revparse 'HEAD'
|
77
|
+
end
|
78
|
+
|
79
|
+
Contract None => HashOf[String, String]
|
80
|
+
def version
|
81
|
+
{ 'context@sha' => "#{context}@#{sha}" }
|
82
|
+
end
|
83
|
+
|
84
|
+
Contract None => Octokit::Client
|
85
|
+
def github
|
86
|
+
@github ||= Octokit::Client.new access_token: access_token
|
87
|
+
end
|
88
|
+
|
89
|
+
Contract None => Sawyer::Resource
|
90
|
+
def update!
|
91
|
+
github.create_status repo, sha, state, options
|
92
|
+
rescue Octokit::Error => error
|
93
|
+
STDERR.puts error.message
|
94
|
+
abort
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: concourse-github-status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Olstrom
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: concourse-fuselage
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.1.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.1.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: git
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.3'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.3.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.3'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.3.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: octokit
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '4.2'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 4.2.0
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '4.2'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 4.2.0
|
73
|
+
description: Concourse Resource for updating arbitrary GitHub statuses
|
74
|
+
email:
|
75
|
+
executables:
|
76
|
+
- out
|
77
|
+
extensions: []
|
78
|
+
extra_rdoc_files: []
|
79
|
+
files:
|
80
|
+
- ".gitignore"
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.org
|
85
|
+
- bin/out
|
86
|
+
- concourse-github-status.gemspec
|
87
|
+
- lib/github-status/out.rb
|
88
|
+
homepage:
|
89
|
+
licenses:
|
90
|
+
- Apache-2.0
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.5.1
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: GitHub Status resource for Concourse
|
112
|
+
test_files: []
|
113
|
+
has_rdoc:
|