[build] Fix the snmp docker build error. (#7452) (#7459)

* [build] Fix the snmp docker build error. (#7452)

Issue is get_pip.py is moved to pip 21.1 (https://github.com/pypa/get-pip/commits/main) which is not compatible with 3.6.
Issue of pip itself is fixed as part of 21.1.1 in pip community (pypa/pip#9835).
However get-pip.py is still not updated to latest pip. Also get.pip.py does not support python 3.6 version explicitly (pypa/get-pip#88)

Step 15/29 : RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
 ---> Running in bece31f49267
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1891k  100 1891k    0     0  9564k      0 --:--:-- --:--:-- --:--:-- 9600k
Traceback (most recent call last):
  File "<stdin>", line 24298, in <module>
  File "<stdin>", line 139, in main
  File "<stdin>", line 115, in bootstrap
  File "<stdin>", line 96, in monkeypatch_for_cert
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/base_command.py", line 12, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/cli/cmdoptions.py", line 30, in <module>
  File "/tmp/tmp5fnxrz0a/pip.zip/pip/_internal/utils/hashes.py", line 2, in <module>
ImportError: cannot import name 'NoReturn'
The command '/bin/sh -c curl https://bootstrap.pypa.io/get-pip.py | python3.6' returned a non-zero code: 1
How I did:

Got the file from https://github.com/pypa/get-pip/tree/21.0 and added to the buildimage
pin pip to the previous release 21.0.1. (Similar is done in other public repos eg: grpc/grpc-java#8115)

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
This commit is contained in:
lguohan 2021-04-28 23:08:26 -07:00 committed by GitHub
parent b8137369c7
commit f4fdf310b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24236 additions and 9 deletions

View File

@ -33,11 +33,11 @@ stages:
git submodule update --init --recursive
displayName: 'reset submodules'
- script: |
set -ex
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/broadcom"
make configure PLATFORM=broadcom
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=broadcom
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-broadcom.bin
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) target/sonic-broadcom.bin
displayName: 'Build sonic image'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.broadcom.201811
@ -57,9 +57,9 @@ stages:
git submodule update --init --recursive
displayName: 'reset submodules'
- script: |
set -ex
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/mellanox"
make configure PLATFORM=mellanox
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=mellanox
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-mellanox.bin
displayName: 'Build sonic image'
@ -81,12 +81,11 @@ stages:
git submodule update --init --recursive
displayName: 'reset submodules'
- script: |
echo $(Build.BuildNumber)
set -ex
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/vs"
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=vs
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS \
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) \
target/docker-sonic-vs.gz target/sonic-vs.img.gz && \
sudo cp target/sonic-vs.img.gz /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz
displayName: 'Build sonic image'

View File

@ -32,7 +32,8 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return
{%- endif %}
# Install up-to-date version of pip
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
COPY ["get-pip.py", "/usr/bin/"]
RUN python3.6 /usr/bin/get-pip.py pip==21.0.1
# pin down setuptools version for issues to install sonic_ax_impl
# see https://github.com/Azure/sonic-buildimage/issues/5279

24226
dockers/docker-snmp-sv2/get-pip.py Executable file

File diff suppressed because it is too large Load Diff

View File

@ -281,6 +281,7 @@ RUN pip install meld3 mock
RUN pip install pexpect==4.6.0
# For sonic-utilities build
RUN pip install nose==1.3.7
RUN pip install mockredispy==2.9.3
RUN pip install pytest-runner==4.4
RUN pip install setuptools==40.8.0