logstash/qa/docker/shared_examples/image_metadata.rb
Rob Bavey 1684c8529f
[7x backport]Fix docker image certification (#12248)
Clean backport of #12242

This commit includes the required changes to pass RedHat docker image certification.
This includes:
 Moving license files to /licenses folder
 Adding required base labels for name, description, vendor and summary

Relates: https://github.com/elastic/dev/issues/1287
2020-09-16 09:13:58 -04:00

51 lines
No EOL
1.7 KiB
Ruby

shared_examples_for 'the metadata is set correctly' do |flavor|
before do
@image = find_image(flavor)
@image_config = @image.json['Config']
@labels = @image_config['Labels']
end
it 'should have the correct working directory' do
expect(@image_config['WorkingDir']).to eql '/usr/share/logstash'
end
it 'should have the correct Architecture' do
expect(@image.json['Architecture']).to have_correct_architecture_for_flavor(flavor)
end
%w(license org.label-schema.license org.opencontainers.image.licenses).each do |label|
it "should set the license label #{label} correctly" do
expect(@labels[label]).to have_correct_license_label(flavor)
end
end
%w(name org.label-schema.name org.opencontainers.image.title).each do |label|
it "should set the name label #{label} correctly" do
expect(@labels[label]).to eql "logstash"
end
end
%w(maintainer).each do |label|
it "should set the name label #{label} correctly" do
expect(@labels[label]).to eql "info@elastic.co"
end
end
%w(description summary).each do |label|
it "should set the name label #{label} correctly" do
expect(@labels[label]).to eql "Logstash is a free and open server-side data processing pipeline that ingests data from a multitude of sources, transforms it, and then sends it to your favorite 'stash.'"
end
end
%w(vendor org.opencontainers.image.vendor).each do |label|
it "should set the vendor label #{label} correctly" do
expect(@labels[label]).to eql "Elastic"
end
end
%w(org.label-schema.version org.opencontainers.image.version).each do |label|
it "should set the version label #{label} correctly" do
expect(@labels[label]).to eql qualified_version
end
end
end