Module: Dapp::Kube::Dapp::Command::Lint
- Included in:
- Dapp
- Defined in:
- lib/dapp/kube/dapp/command/lint.rb
Instance Method Summary collapse
- #kube_chart_name ⇒ Object
- #kube_chart_yaml_path ⇒ Object
- #kube_check_helm_chart_yaml! ⇒ Object
- #kube_lint ⇒ Object
- #with_kube_tmp_lint_chart_dir(&blk) ⇒ Object
Instance Method Details
#kube_chart_name ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/dapp/kube/dapp/command/lint.rb', line 6 def kube_chart_name chart_spec = yaml_load_file(kube_chart_yaml_path) if chart_spec["name"].nil? || chart_spec["name"].empty? raise ::Dapp::Error::Command, code: :no_helm_chart_spec_name, data: { name: chart_spec["name"], path: kube_chart_yaml_path, raw_spec: kube_chart_yaml_path.read.strip } end chart_spec["name"] end |
#kube_chart_yaml_path ⇒ Object
40 41 42 |
# File 'lib/dapp/kube/dapp/command/lint.rb', line 40 def kube_chart_yaml_path kube_chart_path.join("Chart.yaml") end |
#kube_check_helm_chart_yaml! ⇒ Object
36 37 38 |
# File 'lib/dapp/kube/dapp/command/lint.rb', line 36 def kube_check_helm_chart_yaml! raise ::Dapp::Error::Command, code: :chart_yaml_not_found, data: { path: kube_chart_yaml_path } unless kube_chart_yaml_path.exist? end |
#kube_lint ⇒ Object
29 30 31 32 33 34 |
# File 'lib/dapp/kube/dapp/command/lint.rb', line 29 def kube_lint kube_check_helm_chart_yaml! with_kube_tmp_lint_chart_dir do helm_release(&:lint!) end end |
#with_kube_tmp_lint_chart_dir(&blk) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dapp/kube/dapp/command/lint.rb', line 16 def with_kube_tmp_lint_chart_dir(&blk) old_kube_tmp_helm_chart_dir = @kube_tmp_helm_chart_dir unless ENV['DAPP_HELM_CHART_DIR'] @kube_tmp_helm_chart_dir = File.join(Dir.mktmpdir('dapp-helm-lint-', tmp_base_dir), kube_chart_name) end begin with_kube_tmp_chart_dir(&blk) ensure @kube_tmp_helm_chart_dir = old_kube_tmp_helm_chart_dir end end |