concourse 0.32.0 → 0.37.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: 8ec26345e6d3bbe338f8ab1a929b3d9d4c7e89ed9dcdc64dcf797a50ba4d6181
4
- data.tar.gz: cf538c9f7a1d71f807ad85e8d1615943885e9e9f2c18cca7bf602e203f57b506
3
+ metadata.gz: d56283201553e044aa85a5681ee7ab3f5a1e17c07e7e96dea4bf642efc3384d2
4
+ data.tar.gz: 49f894a4644b08acdb40b8dc2ffd7236d91399bb2e47fe3e141338a03e5fe1a7
5
5
  SHA512:
6
- metadata.gz: 57724dde7a7129da027b654f2144afa5188f0027420e826ff717a855540829b343e2df25deb8171cc8345eae7cdf1b408f7e0c8f524735744bab132c679474b1
7
- data.tar.gz: 37e8bebb2a38853b7338eea83c98e830542b94507d3818a8512ad9b613a24bcc783300e6c16bd37fb683a0044bf06eacfc09bf73f69c451cb9143a51e8b514a4
6
+ metadata.gz: c49b5a1d841e718219cc808459562b8ddcbcb15b91b34e38336ecd177e87a74f458a00b62efebd30aaf769c99a7d1c5f302501d31dcb0b7e633bb6e70b45d94b
7
+ data.tar.gz: 8178487b108398fc87b00bd4ea735e09abf9e363801dbe7c687cb5e98900aec892ed7b2d109b6cc53d9493eb8c1c6346e2ef3b22e767472841ded07d0b3df5c5
@@ -1,5 +1,30 @@
1
1
  # concourse-gem changelog
2
2
 
3
+ ## v0.37.0 / 2020-10-01
4
+
5
+ * add TruffleRuby ("truffle") as a known Ruby
6
+
7
+
8
+ ## v0.36.0 / 2020-09-07
9
+
10
+ * remove generated pipelines from rake's "CLOBBER" global (generated pipelines have been recommended for checkin to source control since v0.26.0)
11
+
12
+
13
+ ## v0.35.0 / 2020-09-07
14
+
15
+ * remove "clean" rake task (generated pipelines have been recommended for checkin to source control since v0.26.0)
16
+
17
+
18
+ ## v0.34.0 / 2020-08-31
19
+
20
+ * allow injection of fly command arguments via `fly_args_<command_name>`
21
+
22
+
23
+ ## v0.33.0 / 2020-03-31
24
+
25
+ * add `format` option for formatting final pipeline files with `fly format-pipeline`
26
+
27
+
3
28
  ## v0.32.0 / 2020-03-29
4
29
 
5
30
  * avoid deprecation warning for `Bundler.with_clean_env`
data/README.md CHANGED
@@ -28,8 +28,10 @@ Here's an example pipeline maintained by this gem:
28
28
  - [Configuration](#configuration)
29
29
  * [`directory`: Concourse subdirectory name](#directory-concourse-subdirectory-name)
30
30
  * [`fly_target`: Concourse `fly` target name](#fly_target-concourse-fly-target-name)
31
+ * [`format`: Emit the final pipelines in `fly format-pipeline` canonical format](#format-emit-the-final-pipelines-in-fly-format-pipeline-canonical-format)
31
32
  * [`pipeline_erb_filename`: Pipeline filename](#pipeline_erb_filename-pipeline-filename)
32
33
  * [`secrets_filename`: Secrets filename](#secrets_filename-secrets-filename)
34
+ * [`fly_args_`: fly command arguments](#fly_args_-fly-command-arguments)
33
35
  - [Rake Tasks](#rake-tasks)
34
36
  * [Manage your Concourse pipeline](#manage-your-concourse-pipeline)
35
37
  * [List pipeline tasks](#list-pipeline-tasks)
@@ -225,6 +227,17 @@ Concourse.new("myproject", fly_target: "myci").create_tasks! # `fly -t myci <com
225
227
  ```
226
228
 
227
229
 
230
+ ### `format`: Emit the final pipelines in `fly format-pipeline` canonical format
231
+
232
+ If you'd prefer to have your final pipeline files in `fly`'s "canonical format" (via `format-pipeline`), then set this to true!
233
+
234
+ ``` ruby
235
+ Concourse.new("myproject", format: true).create_tasks!
236
+ ```
237
+
238
+ This might be useful if you're heavily refactoring your template, and want to make sure there aren't unexpected changes to the pipeline.
239
+
240
+
228
241
  ### `pipeline_erb_filename`: Pipeline filename
229
242
 
230
243
  By default the pipeline file will be named `<myproject>.yml`, but can be set to something else:
@@ -246,6 +259,19 @@ Concourse.new("myproject", secrets_filename: "secrets.yml").create_tasks!
246
259
  ```
247
260
 
248
261
 
262
+ ### `fly_args_<fly_command>`: fly command arguments
263
+
264
+ 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).
265
+
266
+ You can pass in additional keys named `fly_args_<command-name-with-underscores>` like this:
267
+
268
+ ``` ruby
269
+ Concourse.new("myproject", fly_args_validate_pipeline: "--enable-across-step --another-flag")
270
+ ```
271
+
272
+ With the above initializer call, whenever the `concourse` gem invokes `validate-pipeline`, it will inject `--enable-across-step --another-flag`.
273
+
274
+
249
275
  ## Rake Tasks
250
276
 
251
277
 
@@ -15,6 +15,7 @@ class Concourse
15
15
  jruby: %w[9.2], # docker repository: "jruby"
16
16
  rbx: %w[latest], # docker repository: "rubinius/docker"
17
17
  windows: %w[2.3 2.4 2.5 2.6], # windows-ruby-dev-tools-release
18
+ truffle: %w[stable nightly] # docker repository: flavorjones/truffleruby
18
19
  }
19
20
 
20
21
  DEFAULT_DIRECTORY = "concourse"
@@ -25,7 +26,9 @@ class Concourse
25
26
  attr_reader :directory
26
27
  attr_reader :pipelines
27
28
  attr_reader :fly_target
29
+ attr_reader :fly_args
28
30
  attr_reader :secrets_filename
31
+ attr_reader :format
29
32
 
30
33
  CONCOURSE_DOCKER_COMPOSE = "docker-compose.yml"
31
34
 
@@ -56,6 +59,12 @@ class Concourse
56
59
 
57
60
  @directory = options[:directory] || DEFAULT_DIRECTORY
58
61
  @fly_target = options[:fly_target] || DEFAULT_FLY_TARGET
62
+ @format = options.has_key?(:format) ? options[:format] : false
63
+ @fly_args = options.keys.grep(/^fly_args_/).inject({}) do |hash, key|
64
+ fly_command = key.to_s.gsub(/^fly_args_/, "").gsub("_", "-")
65
+ hash[fly_command] = options[key]
66
+ hash
67
+ end
59
68
 
60
69
  base_secrets_filename = options[:secrets_filename] || DEFAULT_SECRETS
61
70
  @secrets_filename = File.join(@directory, base_secrets_filename)
@@ -89,7 +98,8 @@ class Concourse
89
98
  File.open pipeline.filename, "w" do |f|
90
99
  f.write erbify_file(pipeline.erb_filename, working_directory: directory)
91
100
  end
92
- fly "validate-pipeline -c #{pipeline.filename}"
101
+ fly "validate-pipeline", "-c #{pipeline.filename}"
102
+ fly "format-pipeline", "-c #{pipeline.filename} -w" if format
93
103
  end
94
104
 
95
105
  def ensure_docker_compose_file
@@ -104,7 +114,7 @@ class Concourse
104
114
  def rake_concourse_local
105
115
  ensure_docker_compose_file
106
116
  @fly_target = "local"
107
- fly "login -u test -p test -c http://127.0.0.1:8080"
117
+ fly "login", "-u test -p test -c http://127.0.0.1:8080"
108
118
  end
109
119
 
110
120
  def rake_concourse_local_up
@@ -124,8 +134,6 @@ class Concourse
124
134
  end
125
135
 
126
136
  pipelines.each do |pipeline|
127
- CLOBBER.include pipeline.filename if defined?(CLOBBER)
128
-
129
137
  unless File.exist? pipeline.erb_filename
130
138
  warn "WARNING: concourse template #{pipeline.erb_filename.inspect} does not exist, run `rake concourse:init`"
131
139
  end
@@ -167,7 +175,7 @@ class Concourse
167
175
  note "using #{secrets_filename} to resolve template vars in #{pipeline.filename}"
168
176
  options << "-l '#{secrets_filename}'"
169
177
  end
170
- fly "set-pipeline #{options.join(" ")}"
178
+ fly "set-pipeline", options.join(" ")
171
179
  end
172
180
  end
173
181
 
@@ -178,18 +186,11 @@ class Concourse
178
186
  pipelines.each do |pipeline|
179
187
  desc "#{command} the #{pipeline.name} pipeline"
180
188
  task "#{command}:#{pipeline.name}" do
181
- fly "#{command}-pipeline -p #{pipeline.name}"
189
+ fly "#{command}-pipeline", "-p #{pipeline.name}"
182
190
  end
183
191
  end
184
192
  end
185
193
 
186
- desc "remove generated pipeline files"
187
- task "clean" do
188
- pipelines.each do |pipeline|
189
- rm_f pipeline.filename
190
- end
191
- end
192
-
193
194
  #
194
195
  # task commands
195
196
  #
@@ -230,7 +231,7 @@ class Concourse
230
231
  f.write concourse_task["config"].to_yaml
231
232
  f.close
232
233
  Bundler.with_unbundled_env do
233
- fly "execute #{fly_execute_args} -c #{f.path}"
234
+ fly "execute", [fly_execute_args, "-c #{f.path}"].compact.join(" ")
234
235
  end
235
236
  end
236
237
  end
@@ -244,7 +245,7 @@ class Concourse
244
245
  pipeline_job, build_id, status = *line.split(/\s+/)[1, 3]
245
246
  next unless status == "started"
246
247
 
247
- fly "abort-build -j #{pipeline_job} -b #{build_id}"
248
+ fly "abort-build", "-j #{pipeline_job} -b #{build_id}"
248
249
  end
249
250
  end
250
251
 
@@ -255,7 +256,7 @@ class Concourse
255
256
  task "prune-stalled-workers" do
256
257
  `fly -t #{fly_target} workers | fgrep stalled`.each_line do |line|
257
258
  worker_id = line.split.first
258
- fly "prune-worker -w #{worker_id}"
259
+ fly "prune-worker", "-w #{worker_id}"
259
260
  end
260
261
  end
261
262
 
@@ -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, args].flatten.compact.join(" ")
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.32.0"
5
+ VERSION = "0.37.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.32.0
4
+ version: 0.37.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-29 00:00:00.000000000 Z
11
+ date: 2020-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor