third_party/metadata_envoy: Modify license file (#2224)

Change to update the approach to add license files to the
third_party/metadata_envoy docker image. This update moves from the
model of downloading the license files in each build to downloading it
locally to a license.txt file, checking the file in and using it to
store in the docker image.
This commit is contained in:
dushyanthsc 2019-09-26 17:21:36 -07:00 committed by Kubernetes Prow Robot
parent 389b585de1
commit fbb008f593
5 changed files with 3946 additions and 31 deletions

View File

@ -15,18 +15,13 @@
FROM envoyproxy/envoy:latest
RUN apt-get update -y && \
apt-get install --no-install-recommends -y -q python python-pip python-setuptools gettext
RUN pip install wget
apt-get install --no-install-recommends -y -q gettext
COPY third_party/metadata_envoy/envoy.yaml /etc/envoy.yaml
# Copy license files.
ADD third_party/metadata_envoy /scratch
RUN python /scratch/dependency_helper.py /scratch/dependencies.json
RUN rm -rf /scratch
RUN pip uninstall --yes wget
RUN apt-get remove --yes --purge python-setuptools python-pip python
#RUN mkdir -p /third_party
COPY third_party/metadata_envoy/license.txt /third_party/license.txt
ENTRYPOINT ["/usr/local/bin/envoy", "-c"]
CMD ["/etc/envoy.yaml"]

View File

@ -7,7 +7,12 @@ that contains license files for all the third party libraries used in envoy.
# Adding new library dependency
To add license file for a new library introduce in OSS envoy just update [dependencies.json](./dependencies.json)
file with the entry for the library and its corresponding license url path.
file with the entry for the library and its corresponding license url path and
the run the python script:
```bash
python dependency_helper.py dependencies.json
```
# Building image

View File

@ -1,6 +1,9 @@
{
"target_path": "/third_party",
"libraries": [
{
"library": "envoy-proxy",
"license_url": "https://raw.githubusercontent.com/envoyproxy/envoy/master/LICENSE"
},
{
"library": "protoc-gen-validate",
"license_url": "https://raw.githubusercontent.com/envoyproxy/protoc-gen-validate/master/LICENSE"
@ -139,4 +142,4 @@
"license_url": "https://raw.githubusercontent.com/prometheus/client_model/master/LICENSE"
}
]
}
}

View File

@ -22,16 +22,7 @@ file.
import json
import os
import sys
from urlparse import urlparse
import wget
def _create_local_directory(path):
try:
os.mkdir(path)
except OSError as err:
print("OS error: {}".format(err))
sys.exit(1)
import requests
def copy_third_party_licenses(dependency_spec):
if not os.path.isfile(dependency_spec):
@ -40,16 +31,12 @@ def copy_third_party_licenses(dependency_spec):
with open(dependency_spec, 'r') as f:
dependencies = json.load(f)
if not dependencies['target_path']:
print("Invalid dependency spec. 'target_path' expected")
_create_local_directory(dependencies['target_path'])
for dependency in dependencies['libraries']:
license_dest = '{}/{}'.format(dependencies['target_path'], dependency['library'])
license_url = dependency['license_url']
_create_local_directory(license_dest)
wget.download(license_url, '{}/{}'.format(license_dest, os.path.split(urlparse(license_url).path)[-1]))
with open('license.txt', 'w') as l:
for dependency in dependencies['libraries']:
print('Downloading License for library : {}'.format(dependency['library']))
l.write('Library: {}\n\n'.format(dependency['library']))
l.write(requests.get(dependency['license_url']).text.encode("utf-8"))
l.write('\n\n')
if __name__ == '__main__':
if len(sys.argv) < 2:

3925
third_party/metadata_envoy/license.txt vendored Normal file

File diff suppressed because it is too large Load Diff