Commit 611d4258 authored by Jerome Flesch's avatar Jerome Flesch
Browse files

gitlab-ci: use apt cacher NG proxy if available

parent cf39dbc3
......@@ -10,7 +10,7 @@ check:
- linux
- volatile
script:
- apt-get update
- sh ./set_apt_proxy.sh
- apt-get install -y -q make
- apt-get install -y -q pycodestyle flake8 python3-flake8 tox
- make check
......@@ -38,7 +38,7 @@ deploy_static:
- linux
- volatile
script:
- apt-get update
- sh ./set_apt_proxy.sh
- apt-get install -y -q wget rclone
- apt-get install -y -q python3 python3-virtualenv virtualenv python3-dev
- apt-get install -y -q gettext
......
#!/bin/sh
# Try to use an AptCacherNg proxy installed close to the gitlab-runner to
# speed up builds
IP_MASK=192.168.2.
APT_PROXY_CACHE_HOST=192.168.2.120
APT_PROXY_CACHE_PORT=3142
apt-get update
apt-get install -y -qq netcat-openbsd iproute2
echo "IP mask: ${IP_MASK}"
if ! /sbin/ip addr | grep ${IP_MASK} > /dev/null ; then
echo "Not on the required subnet"
exit 0
fi
echo "Proxy ${APT_PROXY_CACHE_HOST}:${APT_PROXY_CACHE_PORT}"
if ! nc -w 5 -z ${APT_PROXY_CACHE_HOST} ${APT_PROXY_CACHE_PORT} ; then
echo "Proxy appears to be unreachable"
exit 0
fi
echo "Acquire::http { Proxy \"http://${APT_PROXY_CACHE}:${APT_PROXY_PORT}\"; }" >> /etc/apt/apt.conf.d/proxy
echo "APT has been configured to use this proxy"
apt-get update
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment