Gusto/buildkite-builder

Handling Ruby keywords?

evandam opened this issue · 2 comments

Hi folks,

retry is a keyword, so there's a conflict with trying to pass the retry attribute of a step.

/usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/definition.rb:8:in `eval': /work/.buildkite/pipelines/test/templates/deploy.rb:5: syntax error, unexpected '(', expecting `end' (SyntaxError)
  retry(
       ^
/work/.buildkite/pipelines/test/templates/deploy.rb:9: syntax error, unexpected ')', expecting end-of-input
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/definition.rb:8:in `load_definition'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/loaders/templates.rb:15:in `block in load'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/loaders/templates.rb:14:in `each'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/loaders/templates.rb:14:in `load'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/loaders/abstract.rb:17:in `initialize'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/loaders/abstract.rb:11:in `new'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/loaders/abstract.rb:11:in `load'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/runner.rb:95:in `load_templates'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/runner.rb:40:in `block in run'
	from /usr/local/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/logging_utils.rb:9:in `benchmark'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/runner.rb:38:in `run'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/commands/preview.rb:16:in `run'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/commands/abstract.rb:40:in `execute'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/commands/abstract.rb:13:in `execute'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/lib/buildkite/builder/commands.rb:28:in `run'
	from /usr/local/bundle/gems/buildkite-builder-1.0.0/exe/buildkite-builder:6:in `<top (required)>'
	from /usr/local/bundle/bin/buildkite-builder:23:in `load'
	from /usr/local/bundle/bin/buildkite-builder:23:in `<main>'

Thanks!

ngan commented

Yikes! Thanks for bringing this up @evandam -- a workaround for now is self.retry(...). For if, we use condition. Any suggestions for a replacement for retry?

ngan commented

We been only using the automatically_retry helper which is why we haven't noticed this.

After looking at the docks, you actually can only declare:

retry:
  automatic: ...

OR

retry:
  manual: ...

Maybe we're better off getting rid of retry and only allowing automatically_retry and manually_retry. Wdyt?