Skip to content

SONiC Build Improvements#942

Merged
xumia merged 3 commits intosonic-net:masterfrom
Kalimuthu-Velappan:master
Mar 16, 2022
Merged

SONiC Build Improvements#942
xumia merged 3 commits intosonic-net:masterfrom
Kalimuthu-Velappan:master

Conversation

@Kalimuthu-Velappan
Copy link
Copy Markdown
Contributor

@Kalimuthu-Velappan Kalimuthu-Velappan commented Feb 10, 2022


- When multiple builds are triggered on the same build server that creates parallel building issue because all the build jobs are trying to create the same docker with latest tag. This happens only when sonic dockers are built using native host dockerd for sonic docker image creation.

- This feature creates all sonic dockers as user sonic dockers and then, whilesaving and loading the user sonic dockers, it rename the user sonic dockers into correct sonic dockers with tag as latest.
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.

What if single user builds multiple SONiC branches or same branch different hashes?

Copy link
Copy Markdown
Contributor Author

@Kalimuthu-Velappan Kalimuthu-Velappan Mar 7, 2022

Choose a reason for hiding this comment

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

  • We will enhance this to use it as a user tag which includes username with SHA value of docker control files(Dockerfile.j2, etc)
  • Eg: docker-database-<user>-<SHA>:latest
  • Different user tag is generated for a different branch of the same user.

### Version components

- Sonic build downloads lots of component from external web which includes
- Source code files
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.

"Source code files" and "Git source code" - why not make those sources part of the sonic-buildimage repository or submodules?

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.

  • These source codes are maintained by external users.
  • It can undergo a frequent update or release.
  • Maintaining these source codes as part of SONiC repo, might add extra overhead.

- Prebuilt debian packages
- Python PIP packages
- Git source code
- Docker images
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.

Docker image caching. Docker supports build cache which is disabled from day one, do you plan to enable it?

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.

  • Currently, it is not supported.
  • Will try to enable SONIC_USE_DOCKER_BUILDKIT and validate it for docker image layer caching.

Comment on lines +418 to +420
- Bootstrap generation
- ROOTFS installation
- SONiC packages installation
Copy link
Copy Markdown
Contributor

@xumia xumia Mar 7, 2022

Choose a reason for hiding this comment

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

Step 3 can be split into two parts:
Step 3.1 General packages, such as curl, vim, sudo, python3, ...
Step 3.1 Sonic relative packages, some of the targets built or copied from sonic repo.

Step 1 & step 3.1 can be generated a base image, when can be run in parallel with the other targets, before build image step.
Benifits:

  1. High hit rate, for less dependencies.
  2. Reduce the cache size.
  3. Improve the concurrency when cache not hit, the step has small dependencies, can be run with any other steps.

But it needs to do some code change, move some build code, to build a new target.

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.

Thanks for the input, updated the document.

Copy link
Copy Markdown
Contributor Author

@Kalimuthu-Velappan Kalimuthu-Velappan left a comment

Choose a reason for hiding this comment

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

Review comments addressed

Comment on lines +418 to +420
- Bootstrap generation
- ROOTFS installation
- SONiC packages installation
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.

Thanks for the input, updated the document.

Review comments addressed
@xumia xumia merged commit c3f49bb into sonic-net:master Mar 16, 2022
@zhangyanzhao
Copy link
Copy Markdown
Collaborator

@Kalimuthu-Velappan can you please update the Code PR list? Current one I think is out of date and below is the new list. Thanks.

sonic-net/sonic-buildimage#10352 merged
sonic-net/sonic-buildimage#12000 merged
sonic-net/sonic-buildimage#12001
sonic-net/sonic-buildimage#12003
sonic-net/sonic-buildimage#12004
sonic-net/sonic-buildimage#12005

@zhangyanzhao
Copy link
Copy Markdown
Collaborator

@Kalimuthu-Velappan can you please update the Code PR list? Current one I think is out of date and below is the new list. Thanks.

sonic-net/sonic-buildimage#10352 merged sonic-net/sonic-buildimage#12000 merged sonic-net/sonic-buildimage#12001 sonic-net/sonic-buildimage#12003 sonic-net/sonic-buildimage#12004 sonic-net/sonic-buildimage#12005

@Kalimuthu-Velappan kindly ping..

@Kalimuthu-Velappan
Copy link
Copy Markdown
Contributor Author

Kalimuthu-Velappan commented Dec 8, 2022 via email

@zhangyanzhao
Copy link
Copy Markdown
Collaborator

@zhangyanzhao
Copy link
Copy Markdown
Collaborator

The code PRs need be updated to the proper ones. @Kalimuthu-Velappan @adyeung

Kalimuthu-Velappan pushed a commit to Kalimuthu-Velappan/sonic-buildimage that referenced this pull request Apr 3, 2023
Back porting of version caching Code PRs into 202211 branch
sonic-net/SONiC#942

  1. Restructuring of Makefile.work
  2. Build cache framework
  3. Environment settings
  4. Debug framework
  5. Docker cache framework
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