Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add protobuf and dashapi to sonic-mgmt #15743

Merged
merged 5 commits into from
Jul 14, 2023

Conversation

Pterosaur
Copy link
Contributor

Why I did it

The testcases in sonic-mgmt need the packages of protobuf and dashapi

Work item tracking
  • Microsoft ADO (number only):

How I did it

Because the docker of sonic-mgmt is based on ubuntu20.04, it cannot directly install the packages compiled by slave due to dependency issues. Download related packaged directly from Azp.

How to verify it

Check azp stats.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Ze Gan <ganze718@gmail.com>
@Pterosaur Pterosaur marked this pull request as ready for review July 8, 2023 01:42
@lguohan
Copy link
Collaborator

lguohan commented Jul 8, 2023

i think the software should be installed in docker-ptf not docker-mgmt

@lguohan
Copy link
Collaborator

lguohan commented Jul 8, 2023

where do we plan to run the sonic-mgmt pytest? is it running from sonic-mgmt or is it from docker-ptf?

@lguohan
Copy link
Collaborator

lguohan commented Jul 8, 2023

can you use docker_sonic_mgmt_debs, so that people if they want to build locally, they can still build it without depending on azp?

@Pterosaur
Copy link
Contributor Author

Pterosaur commented Jul 9, 2023

where do we plan to run the sonic-mgmt pytest? is it running from sonic-mgmt or is it from docker-ptf?

All protobuf and dash payloads are for control plane which is loaded in sonic-mgmt, docker-ptf is only used for packet-gen of dataplane. So, To insteall protobuf and dash in sonic-mgmt is reasonable.

@Pterosaur
Copy link
Contributor Author

can you use docker_sonic_mgmt_debs, so that people if they want to build locally, they can still build it without depending on azp?

I tried it before. But the docker of sonic-mgmt is based on ubuntu20.04 instead of debian bullseye, There are some differences on dependencies.
For example, the python3.9 is for bullseye but python3.8 is for ubuntu20.04. All docker_sonic_mgmt_debs are compiled under bullseye, so when I want to install the necessary package, python3-protobbuf.deb, it will be broken due to 3.8 < 3.9.
If I forcefully upgrade the python3.8 to python3.9, there are many existing dependencies are broken again,
Python version is one but not ONLY one dependency issue. So, the easiest way is to download them from Azp.

But in the future, when the sonic-mgmt is upgraded to ubuntu22.04, I believe we can directly install them from docker_sonic_mgmt_debs.

@lguohan
Copy link
Collaborator

lguohan commented Jul 9, 2023

Let's just build and install in sonic-mgmt container?

1 similar comment
@lguohan
Copy link
Collaborator

lguohan commented Jul 9, 2023

Let's just build and install in sonic-mgmt container?

@Pterosaur Pterosaur force-pushed the dash_for_mgmt branch 6 times, most recently from 78eeecc to 18770b1 Compare July 11, 2023 09:56
@Pterosaur
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

No commit pushedDate could be found for PR 15743 in repo sonic-net/sonic-buildimage

Signed-off-by: Ze Gan <ganze718@gmail.com>
This reverts commit 0d415b6.
Signed-off-by: Ze Gan <ganze718@gmail.com>
lguohan
lguohan previously approved these changes Jul 13, 2023
# Install protobuf 3.21.12
RUN mkdir -p /tmp/protobuf \
cd /tmp/protobuf \
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-dev_3.21.12-3_amd64.deb \
Copy link
Collaborator

@qiluo-msft qiluo-msft Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

20.04

It is also used in FROM in the beginning of the file. Will dpkg fail if we upgrade the FROM line to new version? #Pending

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These packets are compiled in ubuntu20.04. Actually, a better method is to install these packets from bullseye slave by sonic_mgmt_debs variable, but due to bullseye and ubuntu dependencies issues, like python 3.8 and python 3.9, we have to install a pre-compiled version.
If we upgrade this docker to a new version, like ubuntu22.04, we can follow the typical method to build this docker.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider 20.04 as a named constant.

# Install dash-api
RUN cd /tmp \
&& mkdir -p /usr/lib/python3/dist-packages/dash_api \
&& wget https://raw.githubusercontent.com/sonic-net/sonic-buildimage/master/src/sonic-dash-api/pypkg/__init__.py -O /usr/lib/python3/dist-packages/dash_api/__init__.py \
Copy link
Collaborator

@qiluo-msft qiluo-msft Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init.py

This file is inside the same repo, why wget? #Pending

RUN cd /tmp \
&& mkdir -p /usr/lib/python3/dist-packages/dash_api \
&& wget https://raw.githubusercontent.com/sonic-net/sonic-buildimage/master/src/sonic-dash-api/pypkg/__init__.py -O /usr/lib/python3/dist-packages/dash_api/__init__.py \
&& git clone https://github.com/sonic-net/sonic-dash-api.git \
Copy link
Collaborator

@qiluo-msft qiluo-msft Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sonic-dash-api.git

This repo is a submodule, it should be available in the working directory. #Pending

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is within the docker, not available.

Copy link
Collaborator

@qiluo-msft qiluo-msft Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to worry if this code on a release branch, but it actually wget/git clone some master files? For example, when branch out 202311, this dockerfile will pull master code.

Copy link
Contributor Author

@Pterosaur Pterosaur Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. If we want to access the files in src, we have to mount the src folder to Docker build workspace. But the files in src may be too many(More than 30GB) for Docker daemon which will dramatically downgrade the performance of Docker daemon.
  2. After the sonic-mgmt upgrade to 20.04, I believe we can follow the typical method, docker_mgmt_debs, to install them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explore # 1: you do not need to mount src folder, just copy what you need to Docker build workspace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under the current framework, I didn't find a script to do that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a issue #15848. And ask for solving in future PR.

Signed-off-by: Ze Gan <ganze718@gmail.com>
@qiluo-msft qiluo-msft merged commit a248459 into sonic-net:master Jul 14, 2023
sonic-otn pushed a commit to sonic-otn/sonic-buildimage that referenced this pull request Sep 20, 2023
#### Why I did it
The testcases in sonic-mgmt need the packages of protobuf and dashapi

##### Work item tracking
- Microsoft ADO **(number only)**:

#### How I did it
Because the docker of sonic-mgmt is based on ubuntu20.04, it cannot directly install the packages compiled by slave due to dependency issues. Download related packaged directly from Azp.

#### How to verify it
Check azp stats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants