Skip to content

Commit

Permalink
SZ: Fixing proxy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SalvatoreZagaria committed Mar 29, 2024
1 parent 9405cde commit d76e090
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
51 changes: 24 additions & 27 deletions docker/Dockerfile_vcast_base
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM centos:7.5.1804

ARG PROXY_URL=http://gateway.zscloud.net:10402
ARG PROXY_URL=http://gateway.zscloud.net:9480
ARG NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0,::1,.vector.int,10.0.0.0/8,http://vapvdatg01.vi.vector.int/,https://vistrrdeart1.vi.vector.int/artifactory/"

ENV http_proxy=${PROXY_URL} \
Expand All @@ -17,12 +17,12 @@ RUN chmod 644 /etc/pki/ca-trust/source/anchors/* && \
update-ca-trust force-enable; update-ca-trust extract

ARG USERNAME=vcast_user
RUN groupadd --gid 1006 ${USERNAME}
RUN adduser --uid 1006 --gid 1006 --shell /bin/bash ${USERNAME}
RUN yum install -y sudo
RUN touch /etc/sudoers.d/$USERNAME && \
RUN groupadd --gid 1006 ${USERNAME} && adduser --uid 1006 --gid 1006 --shell /bin/bash ${USERNAME} && \
yum install -y sudo squid && touch /etc/sudoers.d/$USERNAME && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME
chmod 0440 /etc/sudoers.d/$USERNAME && \
echo "cache_peer gateway.zscloud.net parent 9480 0 no-query default" >> /etc/squid/squid.conf && \
echo "never_direct allow all" >> /etc/squid/squid.conf

USER $USERNAME
RUN mkdir -p /home/${USERNAME}/.config && \
Expand All @@ -48,7 +48,8 @@ SHELL ["/bin/bash", "--login", "-c"]
RUN curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash - && \
sudo yum install -y nodejs && \
mkdir /home/${USERNAME}/.npm-global && \
npm config set prefix "/home/${USERNAME}/.npm-global"
npm config set prefix "/home/${USERNAME}/.npm-global" && \
sudo yum clean all && sudo rm -rf /var/cache/yum

ENV PATH=/home/${USERNAME}/.npm-global/bin:$PATH

Expand All @@ -58,10 +59,11 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sudo yum -y install epel-release && \
sudo yum -y groupinstall "Development Tools" && \
sudo yum -y install openssl11 openssl11-devel bzip2-devel libffi-devel xz-devel libsecret-devel make && \
sudo yum clean all && sudo rm -rf /var/cache/yum && \
npm set cafile /etc/ssl/certs/ca-certificates.crt && \
npm set noproxy localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0,::1,.vector.int,10.0.0.0/8,http://vapvdatg01.vi.vector.int/,https://vistrrdeart1.vi.vector.int/artifactory/ && \
npm set proxy http://gateway.zscloud.net:10402 && \
npm set https-proxy http://gateway.zscloud.net:10402 && \
npm set proxy http://gateway.zscloud.net:9480 && \
npm set https-proxy http://gateway.zscloud.net:9480 && \
npm set registry https://registry.npmjs.org/ && \
npm i -g yo && \
npm install -g @vscode/vsce@^2.15.04 && \
Expand All @@ -74,17 +76,13 @@ WORKDIR /home/${USERNAME}
ARG PY_VERSION=3.8.18
RUN wget https://www.python.org/ftp/python/${PY_VERSION}/Python-${PY_VERSION}.tgz && \
tar xvf Python-${PY_VERSION}.tgz && cd Python-${PY_VERSION} && sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure && \
./configure --enable-optimizations && sudo make altinstall && cd .. && sudo rm -rf Python-${PY_VERSION}*
RUN sudo alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 1
RUN mkdir ".pip"
RUN echo -e '[global]\ntrusted-host = pypi.org\n pypi.python.org\n files.pythonhosted.org' >> .pip/pip.conf
ENV PIP_CONFIG_FILE=/home/${USERNAME}/.pip/pip.conf
./configure --enable-optimizations && sudo make altinstall && cd .. && sudo rm -rf Python-${PY_VERSION}* && \
sudo alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 1 && mkdir ".pip" && \
echo -e '[global]\ntrusted-host = pypi.org\n pypi.python.org\n files.pythonhosted.org' >> .pip/pip.conf


RUN sudo chmod 644 /etc/pki/ca-trust/source/anchors/* && \
sudo update-ca-trust force-enable; sudo update-ca-trust extract && \
sudo yum install -y xorg-x11-server-Xvfb && \
RUN sudo yum install -y xorg-x11-server-Xvfb && \
sudo yum install -y chromium && \
sudo yum clean all && sudo rm -rf /var/cache/yum && \
mkdir -p /home/${USERNAME}/software/vcast/

ADD https://rds-vtc-docker-dev-local.vegistry.vg.vector.int:443/artifactory/rds-build-packages-generic-dev/vcast_test_explorer/releaseVectorCAST23.tar.gz /home/${USERNAME}/software/vcast/releaseVectorCAST23.tar.gz
Expand Down Expand Up @@ -112,18 +110,17 @@ ENV VECTORCAST_DIR=/home/${USERNAME}/software/vcast/release23 \
SSL_CERT_DIR=/etc/ssl/certs \
CA_BUNDLE_PATH=/etc/ssl/certs/ca-certificates.crt \
CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt \
GLOBAL_AGENT_HTTP_PROXY=http://gateway.zscloud.net:10402 \
http_proxy=http://gateway.zscloud.net:10402 \
GLOBAL_AGENT_HTTPS_PROXY=http://gateway.zscloud.net:10402 \
GLOBAL_AGENT_HTTP_PROXY=http://gateway.zscloud.net:9480 \
http_proxy=http://gateway.zscloud.net:9480 \
GLOBAL_AGENT_HTTPS_PROXY=http://gateway.zscloud.net:9480 \
GLOBAL_AGENT_NO_PROXY=localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0,::1,.vector.int,10.0.0.0/8,http://vapvdatg01.vi.vector.int/,https://vistrrdeart1.vi.vector.int/artifactory/ \
HTTPS_PROXY=http://gateway.zscloud.net:10402 \
https_proxy=http://gateway.zscloud.net:10402 \
HTTPS_PROXY=http://gateway.zscloud.net:9480 \
https_proxy=http://gateway.zscloud.net:9480 \
no_proxy=localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0,::1,.vector.int,10.0.0.0/8,http://vapvdatg01.vi.vector.int/,https://vistrrdeart1.vi.vector.int/artifactory/ \
HTTP_PROXY=http://gateway.zscloud.net:10402 \
HTTP_PROXY=http://gateway.zscloud.net:9480 \
RUNNING_ON_SERVER=False \
CPATH=/opt/rh/devtoolset-10/root/usr/include/c++/10:/opt/rh/devtoolset-10/root/usr/include/c++/10/x86_64-redhat-linux:/opt/rh/devtoolset-10/root/usr/include/c++/10/backward:/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/include:/opt/rh/devtoolset-10/root/usr/include:$CPATH
CPATH=/opt/rh/devtoolset-10/root/usr/include/c++/10:/opt/rh/devtoolset-10/root/usr/include/c++/10/x86_64-redhat-linux:/opt/rh/devtoolset-10/root/usr/include/c++/10/backward:/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/include:/opt/rh/devtoolset-10/root/usr/include:$CPATH \
PIP_CONFIG_FILE=/home/${USERNAME}/.pip/pip.conf
RUN sudo mkdir -m 1777 /__w && sudo chown -R $(id -u $USERNAME):$(id -g $USERNAME) /__w

RUN sudo yum clean all && sudo rm -rf /var/cache/yum

SHELL ["/bin/bash", "--login", "-c"]
10 changes: 10 additions & 0 deletions tests/internal/e2e/run_e2e_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ activate_24_release () {
echo "Vcast 24 is activated"
}

set_forward_proxy () {
echo "Setting forward proxy..."

sudo /usr/sbin/squid

NEW_PROXY="http://$(hostname --ip-address):3128"
export HTTP_PROXY=$NEW_PROXY HTTPS_PROXY=$NEW_PROXY http_proxy=$NEW_PROXY https_proxy=$NEW_PROXY GLOBAL_AGENT_HTTP_PROXY=$NEW_PROXY GLOBAL_AGENT_HTTP_PROXY=$NEW_PROXY
}

cd $ROOT
if [ ! -d "node_modules" ]; then
npm install
Expand All @@ -21,6 +30,7 @@ if [ "$GITHUB_ACTIONS" = "true" ] || [ "$TESTING_IN_CONTAINER" = "True" ] ; then
if [ "$GITHUB_ACTIONS" = "true" ] ; then
source /home/vcast_user/.bashrc
fi
set_forward_proxy
if [ "$(pidof /usr/bin/Xvfb)" == "" ]; then
echo "Starting xvfb..."
Xvfb :99 -screen 0 1920x1080x24 &
Expand Down

0 comments on commit d76e090

Please sign in to comment.