concourse 0.31.0 → 0.36.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f859958c7114b55262482115c7be4c753b377456c908c9a9e5f2d6838cb0acdc
4
- data.tar.gz: 248381a82df8a6aba7143c4c39d07ad94da9cec2ea7168ccee3c02468d915c02
3
+ metadata.gz: 5ee9d14472f71531d1303d73d5d2804ae33f52cf392a7bf5d0eb4e99272f7519
4
+ data.tar.gz: 3863c480c23fe1d1581eecef2e80aa21d94fce9e076f7e3ddcc9a91108eb1363
5
5
  SHA512:
6
- metadata.gz: 27db20bc6c2519868063e238bc6dbb64eb2844f4987cb67d31d818014275ea16e9f6d4a1ecd4edce2e2acb4ce16f19a061ec699436d1ef4faf56dab74828ffe3
7
- data.tar.gz: 5a93ad3d9290ac1d27cbe979554cc401e2994f85d03a5245e57816a426d17d07b91e74d93c0a0931c68067ada568393fab71337b69ab38dae82d11991caaf754
6
+ metadata.gz: 2f0e5f4b885c01031e20c8bcfe370581a576be9a637d5cae3d2eb08766d64fab8dbde4869087b26ab9723615b8ddff452f4cb7baab6ec33e9c1babefd8df5fb1
7
+ data.tar.gz: 9796002bff87ce378dd34af27a4b120f18b4583694d0e977a3390a6acaaed46ccb5897f3848c0a1c7537762a46c33ac3d42f96e2effee73be1fd3e71bb74dece
@@ -1,5 +1,41 @@
1
1
  # concourse-gem changelog
2
2
 
3
+ ## v0.36.0 / 2020-09-07
4
+
5
+ * remove generated pipelines from rake's "CLOBBER" global (generated pipelines have been recommended for checkin to source control since v0.26.0)
6
+
7
+
8
+ ## v0.35.0 / 2020-09-07
9
+
10
+ * remove "clean" rake task (generated pipelines have been recommended for checkin to source control since v0.26.0)
11
+
12
+
13
+ ## v0.34.0 / 2020-08-31
14
+
15
+ * allow injection of fly command arguments via `fly_args_<command_name>`
16
+
17
+
18
+ ## v0.33.0 / 2020-03-31
19
+
20
+ * add `format` option for formatting final pipeline files with `fly format-pipeline`
21
+
22
+
23
+ ## v0.32.0 / 2020-03-29
24
+
25
+ * avoid deprecation warning for `Bundler.with_clean_env`
26
+
27
+
28
+ ## v0.31.0 / 2020-01-11
29
+
30
+ * remove jruby 9.1 (which corresponds to ruby 2.3)
31
+
32
+
33
+ ## v0.30.0 / 2020-01-11
34
+
35
+ * remove ruby 2.3, which has reached EOL
36
+ * change ruby 2.7-rc to 2.7 (final)
37
+
38
+
3
39
  ## v0.29.0 / 2019-10-28
4
40
 
5
41
  * add `2.7-rc` to the set of MRI Rubies
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
 
@@ -25,7 +25,9 @@ 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
30
+ attr_reader :format
29
31
 
30
32
  CONCOURSE_DOCKER_COMPOSE = "docker-compose.yml"
31
33
 
@@ -56,6 +58,12 @@ class Concourse
56
58
 
57
59
  @directory = options[:directory] || DEFAULT_DIRECTORY
58
60
  @fly_target = options[:fly_target] || DEFAULT_FLY_TARGET
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
59
67
 
60
68
  base_secrets_filename = options[:secrets_filename] || DEFAULT_SECRETS
61
69
  @secrets_filename = File.join(@directory, base_secrets_filename)
@@ -89,14 +97,15 @@ class Concourse
89
97
  File.open pipeline.filename, "w" do |f|
90
98
  f.write erbify_file(pipeline.erb_filename, working_directory: directory)
91
99
  end
92
- fly "validate-pipeline -c #{pipeline.filename}"
100
+ fly "validate-pipeline", "-c #{pipeline.filename}"
101
+ fly "format-pipeline", "-c #{pipeline.filename} -w" if format
93
102
  end
94
103
 
95
104
  def ensure_docker_compose_file
96
105
  return if File.exist?(docker_compose_path)
97
106
  note "fetching docker compose file ..."
98
107
  File.open(docker_compose_path, "w") do |f|
99
- f.write open("https://concourse-ci.org/docker-compose.yml").read
108
+ f.write URI.open("https://concourse-ci.org/docker-compose.yml").read
100
109
  sh "docker pull concourse/concourse"
101
110
  end
102
111
  end
@@ -104,7 +113,7 @@ class Concourse
104
113
  def rake_concourse_local
105
114
  ensure_docker_compose_file
106
115
  @fly_target = "local"
107
- 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"
108
117
  end
109
118
 
110
119
  def rake_concourse_local_up
@@ -124,8 +133,6 @@ class Concourse
124
133
  end
125
134
 
126
135
  pipelines.each do |pipeline|
127
- CLOBBER.include pipeline.filename if defined?(CLOBBER)
128
-
129
136
  unless File.exist? pipeline.erb_filename
130
137
  warn "WARNING: concourse template #{pipeline.erb_filename.inspect} does not exist, run `rake concourse:init`"
131
138
  end
@@ -167,7 +174,7 @@ class Concourse
167
174
  note "using #{secrets_filename} to resolve template vars in #{pipeline.filename}"
168
175
  options << "-l '#{secrets_filename}'"
169
176
  end
170
- fly "set-pipeline #{options.join(" ")}"
177
+ fly "set-pipeline", options.join(" ")
171
178
  end
172
179
  end
173
180
 
@@ -178,18 +185,11 @@ class Concourse
178
185
  pipelines.each do |pipeline|
179
186
  desc "#{command} the #{pipeline.name} pipeline"
180
187
  task "#{command}:#{pipeline.name}" do
181
- fly "#{command}-pipeline -p #{pipeline.name}"
188
+ fly "#{command}-pipeline", "-p #{pipeline.name}"
182
189
  end
183
190
  end
184
191
  end
185
192
 
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
193
  #
194
194
  # task commands
195
195
  #
@@ -229,8 +229,8 @@ class Concourse
229
229
  Tempfile.create("concourse-task") do |f|
230
230
  f.write concourse_task["config"].to_yaml
231
231
  f.close
232
- Bundler.with_clean_env do
233
- fly "execute #{fly_execute_args} -c #{f.path}"
232
+ Bundler.with_unbundled_env do
233
+ fly "execute", [fly_execute_args, "-c #{f.path}"].compact.join(" ")
234
234
  end
235
235
  end
236
236
  end
@@ -244,7 +244,7 @@ class Concourse
244
244
  pipeline_job, build_id, status = *line.split(/\s+/)[1, 3]
245
245
  next unless status == "started"
246
246
 
247
- fly "abort-build -j #{pipeline_job} -b #{build_id}"
247
+ fly "abort-build", "-j #{pipeline_job} -b #{build_id}"
248
248
  end
249
249
  end
250
250
 
@@ -255,7 +255,7 @@ class Concourse
255
255
  task "prune-stalled-workers" do
256
256
  `fly -t #{fly_target} workers | fgrep stalled`.each_line do |line|
257
257
  worker_id = line.split.first
258
- fly "prune-worker -w #{worker_id}"
258
+ fly "prune-worker", "-w #{worker_id}"
259
259
  end
260
260
  end
261
261
 
@@ -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.31.0"
5
+ VERSION = "0.36.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.31.0
4
+ version: 0.36.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-01-11 00:00:00.000000000 Z
11
+ date: 2020-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor