Add OCI annotations and adjust existing annotations (#45167)

The org.label-schema labels on Docker images have been superseded by
pre-defined OCI annotations. However, there is still a lot of tooling in
use that relies on the org.label-schema, so we do not want to drop
them. This commit adds values for the org.opencontainers.image
pre-defined annotation keys. Additionally, we correct an issue with the
label used to represent the license, to use the org.label-schema.license
label. While this label was never accepted into the org.label-schema
specfication (because this specification was superseded, it's not that
it was explicitly rejected) there are containers out there using this
label. In particular, our base image is and so we need to override
otherwise we inherit, and end up mis-reporting the license.
This commit is contained in:
Jason Tedor 2019-08-04 13:50:26 -04:00
parent e708710f38
commit 872ae4d6c2
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
2 changed files with 20 additions and 6 deletions

View File

@ -24,8 +24,10 @@ ext.expansions = { oss, local ->
final String classifier = 'linux-x86_64'
final String elasticsearch = oss ? "elasticsearch-oss-${VersionProperties.elasticsearch}-${classifier}.tar.gz" : "elasticsearch-${VersionProperties.elasticsearch}-${classifier}.tar.gz"
return [
'build_date' : project.ext.buildDate,
'elasticsearch' : elasticsearch,
'license' : oss ? 'Apache-2.0' : 'Elastic License',
'git_revision' : project.ext.gitRevision,
'license' : oss ? 'Apache-2.0' : 'Elastic-License',
'source_elasticsearch': local ? "COPY $elasticsearch /opt/" : "RUN cd /opt && curl --retry 8 -s -L -O https://artifacts.elastic.co/downloads/elasticsearch/${elasticsearch} && cd -",
'version' : VersionProperties.elasticsearch
]

View File

@ -69,13 +69,25 @@ RUN chgrp 0 /usr/local/bin/docker-entrypoint.sh && \
EXPOSE 9200 9300
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.vendor="Elastic" \
org.label-schema.name="elasticsearch" \
org.label-schema.version="${version}" \
LABEL org.label-schema.build-date="${build_date}" \
org.label-schema.license="${license}" \
org.label-schema.name="Elasticsearch" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://www.elastic.co/products/elasticsearch" \
org.label-schema.usage="https://www.elastic.co/guide/en/elasticsearch/reference/index.html" \
org.label-schema.vcs-ref="${git_revision}" \
org.label-schema.vcs-url="https://github.com/elastic/elasticsearch" \
license="${license}"
org.label-schema.vendor="Elastic" \
org.label-schema.version="${version}" \
org.opencontainers.image.created="${build_date}" \
org.opencontainers.image.documentation="https://www.elastic.co/guide/en/elasticsearch/reference/index.html" \
org.opencontainers.image.licenses="${license}" \
org.opencontainers.image.revision="${git_revision}" \
org.opencontainers.image.source="https://github.com/elastic/elasticsearch" \
org.opencontainers.image.title="Elasticsearch" \
org.opencontainers.image.url="https://www.elastic.co/products/elasticsearch" \
org.opencontainers.image.vendor="Elastic" \
org.opencontainers.image.version="${version}"
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
# Dummy overridable parameter parsed by entrypoint