[7x_backport] Add UBI8 image specific labels back to the docker image (#12502)

Clean backport of #12498

these labels are required for redhat openshift certification.

These commit reintroduces the labels for the ubi8 image only, and adds
acceptance tests to ensure these labels are correct and not inherited
This commit is contained in:
Rob Bavey 2020-12-04 16:12:39 -05:00 committed by GitHub
parent 7457bc9038
commit 0588d51056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View file

@ -96,6 +96,14 @@ LABEL org.label-schema.schema-version="1.0" \
org.opencontainers.image.licenses="{{ license }}" \
org.opencontainers.image.description="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.'" \
org.label-schema.build-date={{ created_date }} \
{% if image_flavor == 'ubi8' -%}
license="{{ license }}" \
description="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.'" \
name="logstash" \
maintainer="info@elastic.co" \
summary="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.'" \
vendor="Elastic" \
{% endif -%}
org.opencontainers.image.created={{ created_date }}

View file

@ -3,4 +3,36 @@ require_relative '../../shared_examples/image_metadata'
describe 'An image with the full distribution' do
it_behaves_like 'the metadata is set correctly', 'ubi8'
context 'the ubi8 image should set its specific labels correctly' do
before do
@image = find_image('ubi8')
@image_config = @image.json['Config']
@labels = @image_config['Labels']
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('ubi8')
end
end
it 'should set the name label correctly' do
expect(@labels['name']).to eql "logstash"
end
it 'should set the maintainer label correctly' do
expect(@labels["maintainer"]).to eql "info@elastic.co"
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
it 'should set the vendor label correctly' do
expect(@labels["vendor"]).to eql "Elastic"
end
end
end