concourse 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +13 -0
- data/lib/concourse.rb +58 -1
- data/lib/concourse/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 183cf7dea38c0266acb101bbe751dda1e609ff02
|
4
|
+
data.tar.gz: 7f6182af5ad5df4ec9ff3f9c567bd8cc869f2e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6925806fe57340e0356ea9127de345dcf26e148c561d682d9765c0a94b761058950d46b5560e03080a2b02cafe9fd5bdc4f15e71b6477944aee404cac8d5267a
|
7
|
+
data.tar.gz: 5cbf130ceb6e87211c576859d452226f99f690988692adaaded842b93e3e599d35dac8380791fe0a6ba528b77ef5c09a12abb65871d70081f5af4b9f58817c3b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -97,6 +97,19 @@ where:
|
|
97
97
|
* _optional_: `fly_execute_args` will default to map the project directory to a resource with the project name, e.g. `--input=myproject=.`, so your pipeline must name the input resource appropriately in order to use the default.
|
98
98
|
|
99
99
|
|
100
|
+
### Generating a sweet set of markdown badges
|
101
|
+
|
102
|
+
Would you like a markdown table of your jobs' passing/failing badges? Of course you would.
|
103
|
+
|
104
|
+
```
|
105
|
+
rake concourse:badges[fly_target,team_name] # display a list of jobs and badge urls
|
106
|
+
```
|
107
|
+
|
108
|
+
where:
|
109
|
+
|
110
|
+
* _optional_: `team_name` is the name of the pipeline's Concourse Team. Defaults to `main`.
|
111
|
+
|
112
|
+
|
100
113
|
## Installation
|
101
114
|
|
102
115
|
Add this line to your application's Gemfile:
|
data/lib/concourse.rb
CHANGED
@@ -22,6 +22,10 @@ class Concourse
|
|
22
22
|
return task_args[:fly_target]
|
23
23
|
end
|
24
24
|
|
25
|
+
def self.url_for fly_target
|
26
|
+
`fly targets`.split("\n").grep(/^#{fly_target}/).first.split(/ +/)[1]
|
27
|
+
end
|
28
|
+
|
25
29
|
def initialize project_name
|
26
30
|
@project_name = project_name
|
27
31
|
@pipeline_filename = File.join(DIRECTORY, "#{project_name}.yml")
|
@@ -113,13 +117,41 @@ class Concourse
|
|
113
117
|
sh "fly -t #{fly_target} execute #{fly_execute_args} -c #{f.path} -x"
|
114
118
|
end
|
115
119
|
end
|
120
|
+
|
121
|
+
#
|
122
|
+
# badge commands
|
123
|
+
#
|
124
|
+
desc "display a list of jobs and badge urls"
|
125
|
+
task "badges", [:fly_target, :team_name] => "generate" do |t, args|
|
126
|
+
fly_target = Concourse.validate_fly_target t, args
|
127
|
+
team_name = args[:team_name] || "main"
|
128
|
+
url_prefix = Concourse.url_for fly_target
|
129
|
+
|
130
|
+
puts ""
|
131
|
+
puts "| Build | Status |"
|
132
|
+
puts "|--|--|"
|
133
|
+
|
134
|
+
each_job do |job|
|
135
|
+
job_name = job["name"]
|
136
|
+
badge_url = badge_url_for url_prefix, team_name, job_name
|
137
|
+
job_url = job_url_for url_prefix, team_name, job_name
|
138
|
+
|
139
|
+
puts %Q'| #{titleize job_name} | [![name](#{badge_url})](#{job_url}) |'
|
140
|
+
end
|
141
|
+
end
|
116
142
|
end
|
117
143
|
end
|
118
144
|
|
119
|
-
def
|
145
|
+
def each_job
|
120
146
|
pipeline = YAML.load_file(pipeline_filename)
|
121
147
|
|
122
148
|
pipeline["jobs"].each do |job|
|
149
|
+
yield job
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def each_task
|
154
|
+
each_job do |job|
|
123
155
|
job["plan"].each do |task|
|
124
156
|
yield job, task if task["task"]
|
125
157
|
end
|
@@ -133,4 +165,29 @@ class Concourse
|
|
133
165
|
end
|
134
166
|
nil
|
135
167
|
end
|
168
|
+
|
169
|
+
def titleize string
|
170
|
+
string.gsub(/[^a-zA-Z0-9\.]/, " ")
|
171
|
+
end
|
172
|
+
|
173
|
+
def badge_url_for url_prefix, team_name, job_name
|
174
|
+
File.join url_prefix,
|
175
|
+
"api/v1/teams",
|
176
|
+
team_name,
|
177
|
+
"pipelines",
|
178
|
+
project_name,
|
179
|
+
"jobs",
|
180
|
+
job_name,
|
181
|
+
"badge"
|
182
|
+
end
|
183
|
+
|
184
|
+
def job_url_for url_prefix, team_name, job_name
|
185
|
+
File.join url_prefix,
|
186
|
+
"teams",
|
187
|
+
team_name,
|
188
|
+
"pipelines",
|
189
|
+
project_name,
|
190
|
+
"jobs",
|
191
|
+
job_name
|
192
|
+
end
|
136
193
|
end
|
data/lib/concourse/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concourse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|