Skip to content

[docker-ptf] create symlinks for py3-only image#19813

Merged
wangxin merged 6 commits intosonic-net:masterfrom
opcoder0:docker-ptf/create-ptf-symlink-in-bin
Aug 23, 2024
Merged

[docker-ptf] create symlinks for py3-only image#19813
wangxin merged 6 commits intosonic-net:masterfrom
opcoder0:docker-ptf/create-ptf-symlink-in-bin

Conversation

@opcoder0
Copy link
Copy Markdown
Contributor

@opcoder0 opcoder0 commented Aug 5, 2024

Why I did it

The mix of docker-ptf with Python 2 + Python 3 (in virtual-env) and Python 3 images only across branches (with possibly some test scripts in sonic-mgmt not migrated to Python 3 in older branches) causes different path references to Python and PTF binaries. This can cause backporting a hassle. To prevent this the PR creates virtual environment (/root/env-python3) path to the real python 3 and PTF binaries. This keeps the paths same across docker-ptf images.

Work item tracking
  • Microsoft ADO (number only):

How I did it

Created symlinks for python and PTF from /root/env-python3/bin to /usr/bin.

How to verify it

Image built successfully and manually verified the existence of the links.

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)

Not applicable

Description for the changelog

[docker-ptf] create virtual-env symlinks for py3-only image

Link to config_db schema for YANG module changes

Not applicable

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

Not applicable

Sflow requires autoconf 2.71 or higher;
Bullseye is at 2.69.
* symlink ptf binary in py3 only config
* Add retry for failed apt downloads
RUN mkdir -p /root/env-python3/bin
RUN ln -s /usr/bin/python /root/env-python3/bin/python3
RUN ln -s /usr/bin/python /root/env-python3/bin/python
RUN ln -s /usr/local/bin/ptf /root/env-python3/bin/ptf
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible to combine these steps into a single RUN to avoid extra docker layers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have updated them to run under single RUN command.

@opcoder0
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 19813 in repo sonic-net/sonic-buildimage

@opcoder0
Copy link
Copy Markdown
Contributor Author

/ms_checker

@wangxin wangxin merged commit a341620 into sonic-net:master Aug 23, 2024
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.

2 participants