Commit 121c98d5 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'fix-empty-cluster-artifact' into 'master'

Fix cluster apps artifact parsing for empty blobs

See merge request gitlab-org/gitlab!38367
parents 16cf8e47 d8161fd4
...@@ -46,6 +46,8 @@ module Clusters ...@@ -46,6 +46,8 @@ module Clusters
releases = [] releases = []
artifact.each_blob do |blob| artifact.each_blob do |blob|
next if blob.empty?
releases.concat(Gitlab::Kubernetes::Helm::Parsers::ListV2.new(blob).releases) releases.concat(Gitlab::Kubernetes::Helm::Parsers::ListV2.new(blob).releases)
end end
......
...@@ -108,6 +108,17 @@ RSpec.describe Clusters::ParseClusterApplicationsArtifactService do ...@@ -108,6 +108,17 @@ RSpec.describe Clusters::ParseClusterApplicationsArtifactService do
end end
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 'job has deployment cluster' do
context 'current user does not have access to deployment cluster' do context 'current user does not have access to deployment cluster' do
let(:other_user) { create(:user) } 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