Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit c086d96

Browse files
committed
Fix --flux flag
1 parent 7c3495b commit c086d96

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

manifest.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
require 'octokit'
44
require 'fileutils'
5-
require 'byebug'
65

76
require_relative 'templates/kustomization'
87
require_relative 'templates/flux'
@@ -210,12 +209,14 @@ def print_manifests # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
210209
File.write "/tmp/#{t.path}", t.manifest.to_yaml
211210
end
212211

212+
puts @templates.find(&:flux?)&.manifest&.to_yaml
213213
@templates.map(&:directory).uniq.each do |dir|
214214
next if dir.empty?
215215

216216
puts '---'
217217
puts `kustomize build /tmp/#{dir.join('/')}`
218218
end
219+
219220
puts "\n"
220221
end
221222
end

templates/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def path
3131
def method_missing(method_name, *args, &block)
3232
super unless method_name.to_s.end_with?('?')
3333

34-
method_name.to_s.delete('?') == file_name
34+
method_name.to_s.delete('?') == file_name.delete('.')
3535
end
3636

3737
def respond_to_missing?(method_name, include_private = false)

templates/flux.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
# https://docs.fluxcd.io/en/latest/references/fluxyaml-config-files.html
4+
35
require_relative 'base'
46

57
module Templates
@@ -10,13 +12,17 @@ def manifest
1012
{
1113
'version' => 1,
1214
'commandUpdated' => {
13-
'generators' => options[:generators] || []
15+
'generators' => generators
1416
}
1517
}
1618
end
1719

1820
def directory
1921
[]
2022
end
23+
24+
def generators
25+
options[:generators] || []
26+
end
2127
end
2228
end

templates/kustomization.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def images
4747
end
4848
end
4949

50+
# https://github.com/kubernetes-sigs/kustomize/blob/master/examples/jsonpatch.md
5051
def ingress_patch
5152
{
5253
'target' => {
@@ -59,6 +60,7 @@ def ingress_patch
5960
}
6061
end
6162

63+
# https://github.com/kubernetes-sigs/kustomize/blob/master/examples/image.md
6264
def images_patch
6365
img_tuple = options[:image].split(':')
6466
{

0 commit comments

Comments
 (0)