Skip to content

Commit

Permalink
Don't hard-code yelpcorp PyPI registry
Browse files Browse the repository at this point in the history
This is controlled via the /etc/pip.conf file which is managed by Puppet
on yelpcorp hosts.
  • Loading branch information
chriskuehl committed Jul 27, 2023
1 parent b17c5c2 commit 51ee82b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 && \
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[tox]
envlist = py36
tox_pip_extensions_ext_pip_custom_platform = true
tox_pip_extensions_ext_venv_update = true

[testenv]
Expand All @@ -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=
Expand All @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion yelp_package/bionic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 51ee82b

Please sign in to comment.