concourse 0.33.0 → 0.34.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: b85989175cc8ec8bb8b3f250544e1eb568b577343e07617db488affd7877ead7
4
- data.tar.gz: 8854b8eb32fa8389624bff4f47e41d0e525a0debf378aaeddcd62d139cc48bfe
3
+ metadata.gz: baf385b29c11940d30e629579e3a49cbece674505744784cd76bc2c2ba555a57
4
+ data.tar.gz: 137a75561ca03dae7bf5d261ead42d23ad529646e4ff88af19210bed13030317
5
5
  SHA512:
6
- metadata.gz: 578cb1e88feb546eca5080b40633225ebab45f97e028fd3bcd989748ac94a67d44aeae5ccd45cd039b3ad9a78acd5d254ff0cab9f8d46606fad4590c23c7ff03
7
- data.tar.gz: 8cdc46a9b8ce7594cfa3a624365a48894b5d1686260f21fb0e231257c540bb118df205623656e488ada4da32b9ceefaeecab21ee81db70b4fccb30f8def5e0fb
6
+ metadata.gz: ccf56e48803d7af6f9cebb66c88982cab01bd879360fe9035ecc86604ff14712f4ab27d4429e25e0540cb13780db30cf43f88e22136a18a29651e70b9de4ce7f
7
+ data.tar.gz: 14e5a4f401c650605da01391b2892bd636e5a8dc5ec847945a22c9fef8f41806e1c852b42e6a4bc00c014db5b82bfc0b8f020f6bdf50684cf99952ba9c87aad2
@@ -1,5 +1,10 @@
1
1
  # concourse-gem changelog
2
2
 
3
+ ## v0.34.0 / 2020-08-31
4
+
5
+ * allow injection of fly command arguments via `fly_args_<command_name>`
6
+
7
+
3
8
  ## v0.33.0 / 2020-03-31
4
9
 
5
10
  * add `format` option for formatting final pipeline files with `fly format-pipeline`
data/README.md CHANGED
@@ -257,6 +257,19 @@ Concourse.new("myproject", secrets_filename: "secrets.yml").create_tasks!
257
257
  ```
258
258
 
259
259
 
260
+ ### `fly_args_<fly_command>`: fly command arguments
261
+
262
+ Rarely, you may need to inject additional commandline arguments into `fly` to get the behavior you want. For example, I wanted to inject `--enable-across-step` into my `validate-pipeline` commands when I started exploring matrix builds via [the `across` step](https://github.com/vito/rfcs/blob/spatial-resources/029-across-step/proposal.md).
263
+
264
+ You can pass in additional keys named `fly_args_<command-name-with-underscores>` like this:
265
+
266
+ ``` ruby
267
+ Concourse.new("myproject", fly_args_validate_pipeline: "--enable-across-step --another-flag")
268
+ ```
269
+
270
+ With the above initializer call, whenever the `concourse` gem invokes `validate-pipeline`, it will inject `--enable-across-step --another-flag`.
271
+
272
+
260
273
  ## Rake Tasks
261
274
 
262
275
 
@@ -25,6 +25,7 @@ class Concourse
25
25
  attr_reader :directory
26
26
  attr_reader :pipelines
27
27
  attr_reader :fly_target
28
+ attr_reader :fly_args
28
29
  attr_reader :secrets_filename
29
30
  attr_reader :format
30
31
 
@@ -58,6 +59,11 @@ class Concourse
58
59
  @directory = options[:directory] || DEFAULT_DIRECTORY
59
60
  @fly_target = options[:fly_target] || DEFAULT_FLY_TARGET
60
61
  @format = options.has_key?(:format) ? options[:format] : false
62
+ @fly_args = options.keys.grep(/^fly_args_/).inject({}) do |hash, key|
63
+ fly_command = key.to_s.gsub(/^fly_args_/, "").gsub("_", "-")
64
+ hash[fly_command] = options[key]
65
+ hash
66
+ end
61
67
 
62
68
  base_secrets_filename = options[:secrets_filename] || DEFAULT_SECRETS
63
69
  @secrets_filename = File.join(@directory, base_secrets_filename)
@@ -91,8 +97,8 @@ class Concourse
91
97
  File.open pipeline.filename, "w" do |f|
92
98
  f.write erbify_file(pipeline.erb_filename, working_directory: directory)
93
99
  end
94
- fly "validate-pipeline -c #{pipeline.filename}"
95
- fly "format-pipeline -c #{pipeline.filename} -w" if format
100
+ fly "validate-pipeline", "-c #{pipeline.filename}"
101
+ fly "format-pipeline", "-c #{pipeline.filename} -w" if format
96
102
  end
97
103
 
98
104
  def ensure_docker_compose_file
@@ -107,7 +113,7 @@ class Concourse
107
113
  def rake_concourse_local
108
114
  ensure_docker_compose_file
109
115
  @fly_target = "local"
110
- fly "login -u test -p test -c http://127.0.0.1:8080"
116
+ fly "login", "-u test -p test -c http://127.0.0.1:8080"
111
117
  end
112
118
 
113
119
  def rake_concourse_local_up
@@ -170,7 +176,7 @@ class Concourse
170
176
  note "using #{secrets_filename} to resolve template vars in #{pipeline.filename}"
171
177
  options << "-l '#{secrets_filename}'"
172
178
  end
173
- fly "set-pipeline #{options.join(" ")}"
179
+ fly "set-pipeline", options.join(" ")
174
180
  end
175
181
  end
176
182
 
@@ -181,7 +187,7 @@ class Concourse
181
187
  pipelines.each do |pipeline|
182
188
  desc "#{command} the #{pipeline.name} pipeline"
183
189
  task "#{command}:#{pipeline.name}" do
184
- fly "#{command}-pipeline -p #{pipeline.name}"
190
+ fly "#{command}-pipeline", "-p #{pipeline.name}"
185
191
  end
186
192
  end
187
193
  end
@@ -233,7 +239,7 @@ class Concourse
233
239
  f.write concourse_task["config"].to_yaml
234
240
  f.close
235
241
  Bundler.with_unbundled_env do
236
- fly "execute #{fly_execute_args} -c #{f.path}"
242
+ fly "execute", "#{fly_execute_args} -c #{f.path}"
237
243
  end
238
244
  end
239
245
  end
@@ -247,7 +253,7 @@ class Concourse
247
253
  pipeline_job, build_id, status = *line.split(/\s+/)[1, 3]
248
254
  next unless status == "started"
249
255
 
250
- fly "abort-build -j #{pipeline_job} -b #{build_id}"
256
+ fly "abort-build", "-j #{pipeline_job} -b #{build_id}"
251
257
  end
252
258
  end
253
259
 
@@ -258,7 +264,7 @@ class Concourse
258
264
  task "prune-stalled-workers" do
259
265
  `fly -t #{fly_target} workers | fgrep stalled`.each_line do |line|
260
266
  worker_id = line.split.first
261
- fly "prune-worker -w #{worker_id}"
267
+ fly "prune-worker", "-w #{worker_id}"
262
268
  end
263
269
  end
264
270
 
@@ -18,8 +18,9 @@ class Concourse
18
18
  File.open(GITIGNORE_FILE, "a") { |f| f.puts file_glob }
19
19
  end
20
20
 
21
- def fly command
22
- sh "fly -t #{fly_target} #{command}"
21
+ def fly command, args
22
+ command_args = Array(fly_args[command])
23
+ sh "fly -t #{fly_target} #{command} #{command_args.join(" ")} #{args}"
23
24
  end
24
25
 
25
26
  def docker_compose command
@@ -2,5 +2,5 @@ require "rake"
2
2
  require "erb"
3
3
 
4
4
  class Concourse
5
- VERSION = "0.33.0"
5
+ VERSION = "0.34.0"
6
6
  end
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.33.0
4
+ version: 0.34.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: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor