From 51ee82b7adad189497ed25db1a79d166407dade8 Mon Sep 17 00:00:00 2001 From: Chris Kuehl Date: Thu, 27 Jul 2023 14:37:18 -0700 Subject: [PATCH] Don't hard-code yelpcorp PyPI registry This is controlled via the /etc/pip.conf file which is managed by Puppet on yelpcorp hosts. --- Makefile | 11 ++++++----- debian/rules | 5 ++--- tox.ini | 5 ++--- yelp_package/bionic/Dockerfile | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index bd4f4918f..8da22c70b 100644 --- a/Makefile +++ b/Makefile @@ -11,11 +11,12 @@ endif NOOP = true ifeq ($(PAASTA_ENV),YELP) - export PIP_INDEX_URL ?= https://pypi.yelpcorp.com/simple + # This index must match the Ubuntu codename in the dockerfile. + DOCKER_PIP_INDEX_URL ?= http://169.254.255.254:20641/bionic/simple/ export NPM_CONFIG_REGISTRY ?= https://npm.yelpcorp.com/ ADD_MISSING_DEPS_MAYBE:=-diff --unchanged-line-format= --old-line-format= --new-line-format='%L' ./requirements.txt ./yelp_package/extra_requirements_yelp.txt >> ./requirements.txt else - export PIP_INDEX_URL ?= https://pypi.python.org/simple + DOCKER_PIP_INDEX_URL ?= https://pypi.python.org/simple export NPM_CONFIG_REGISTRY ?= https://registry.npmjs.org ADD_MISSING_DEPS_MAYBE:=$(NOOP) endif @@ -34,14 +35,14 @@ endif docker_%: @echo "Building docker image for $*" [ -d dist ] || mkdir -p dist - cd ./yelp_package/$* && docker build --build-arg PIP_INDEX_URL=${PIP_INDEX_URL} --build-arg NPM_CONFIG_REGISTRY=${NPM_CONFIG_REGISTRY} -t tron-builder-$* . + cd ./yelp_package/$* && docker build --build-arg PIP_INDEX_URL=${DOCKER_PIP_INDEX_URL} --build-arg NPM_CONFIG_REGISTRY=${NPM_CONFIG_REGISTRY} -t tron-builder-$* . deb_%: clean docker_% coffee_% @echo "Building deb for $*" # backup these files so we can temp modify them cp requirements.txt requirements.txt.old $(ADD_MISSING_DEPS_MAYBE) - $(DOCKER_RUN) -e PIP_INDEX_URL=${PIP_INDEX_URL} tron-builder-$* /bin/bash -c ' \ + $(DOCKER_RUN) -e PIP_INDEX_URL=${DOCKER_PIP_INDEX_URL} tron-builder-$* /bin/bash -c ' \ dpkg-buildpackage -d && \ mv ../*.deb dist/ && \ rm -rf debian/tron && \ @@ -87,7 +88,7 @@ example_cluster: tox -e example-cluster yelpy: - .tox/py36/bin/pip-custom-platform install -i https://pypi.yelpcorp.com/simple -r yelp_package/extra_requirements_yelp.txt + .tox/py36/bin/pip install -r yelp_package/extra_requirements_yelp.txt LAST_COMMIT_MSG = $(shell git log -1 --pretty=%B | sed -e 's/[\x27\x22]/\\\x27/g') release: diff --git a/debian/rules b/debian/rules index bdf2c7321..f9698fd0e 100755 --- a/debian/rules +++ b/debian/rules @@ -18,12 +18,11 @@ override_dh_auto_test: override_dh_virtualenv: echo $(PIP_INDEX_URL) dh_virtualenv --index-url $(PIP_INDEX_URL) \ + --extra-pip-arg --trusted-host=169.254.255.254 \ --python=/usr/bin/python3.6 \ --preinstall cython==0.29.36 \ - --preinstall pip-custom-platform \ --preinstall pip==9.0.1 \ - --preinstall setuptools==46.1.3 \ - --pip-tool pip-custom-platform \ + --preinstall setuptools==46.1.3 override_dh_installinit: dh_installinit --noscripts diff --git a/tox.ini b/tox.ini index e018a5a7f..9906c8f6e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [tox] envlist = py36 -tox_pip_extensions_ext_pip_custom_platform = true tox_pip_extensions_ext_venv_update = true [testenv] @@ -9,7 +8,7 @@ deps = --requirement={toxinidir}/requirements.txt --requirement={toxinidir}/requirements-dev.txt usedevelop = true -passenv = USER PIP_INDEX_URL +passenv = USER setenv = YARN_REGISTRY = {env:NPM_CONFIG_REGISTRY:https://registry.npmjs.org/} whitelist_externals= @@ -27,7 +26,7 @@ commands = check-requirements # optionally install yelpy requirements - this is after check-requirements since # check-requirements doesn't understand these extra requirements - -pip install --index-url https://pypi.yelpcorp.com/simple -r yelp_package/extra_requirements_yelp.txt + -pip install -r yelp_package/extra_requirements_yelp.txt # we then run tests at the very end so that we can run tests with yelpy requirements py.test -s {posargs:tests} diff --git a/yelp_package/bionic/Dockerfile b/yelp_package/bionic/Dockerfile index fa4812503..26ae75c36 100644 --- a/yelp_package/bionic/Dockerfile +++ b/yelp_package/bionic/Dockerfile @@ -36,5 +36,5 @@ RUN echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list RUN echo "deb http://deb.nodesource.com/node_10.x bionic main" > /etc/apt/sources.list.d/nodesource.list RUN apt-get -q update && apt-get -q install -y --no-install-recommends yarn nodejs -RUN pip3 install --index-url ${PIP_INDEX_URL} virtualenv==16.7.5 +RUN pip3 install --trusted-host 169.254.255.254 --index-url ${PIP_INDEX_URL} virtualenv==16.7.5 WORKDIR /work