Commit d8161fd4 authored by ap4y's avatar ap4y

Fix cluster apps artifact parsing for empty blob

This MR fixes cluster application artifact parsing for situations when
returned blob is empty. Empty blob was registered in production for
clusters without apps during uninstall. 'helm ls' also returns empty
string in this case even if output is set to json.
parent 7c6d22f4
......@@ -46,6 +46,8 @@ module Clusters
releases = []
artifact.each_blob do |blob|
next if blob.empty?
releases.concat(Gitlab::Kubernetes::Helm::Parsers::ListV2.new(blob).releases)
end
......
......@@ -108,6 +108,17 @@ RSpec.describe Clusters::ParseClusterApplicationsArtifactService do
end
end
context 'blob is empty' do
let(:file) { fixture_file_upload(Rails.root.join("spec/fixtures/helm/helm_list_v2_empty_blob.json.gz")) }
let(:artifact) { create(:ci_job_artifact, :cluster_applications, job: job, file: file) }
it 'returns success' do
result = described_class.new(job, user).execute(artifact)
expect(result[:status]).to eq(:success)
end
end
context 'job has deployment cluster' do
context 'current user does not have access to deployment cluster' do
let(:other_user) { create(:user) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment