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

[files/build]: Support reproduceable build for docker image #5895

Closed
wants to merge 2 commits into from
Closed

[files/build]: Support reproduceable build for docker image #5895

wants to merge 2 commits into from

Conversation

liushilongbuaa
Copy link
Contributor

- Why I did it
Some component's make process uses thirdparty docker image by "FROM" in Dockerfile. They use image and tag to specify a docker image. When the image with the same tag changed, build process may fail.
- How I did it

  1. The SONiC build process uses jinja2 to suit different CPU architecture. Dockerfile need to be preprocessed by j2. I use a fake j2, which is a bash script, to replace a image_tag pair by a image_hash pair.
  2. The image_hash pair records hash value of the image. The hash value is saved in a version file.
  3. When build the project, default action is using docker image with a hash value recorded in the version file.
    But when you want to use latest docker image, set parameter 'SONIC_VERSION_CONTROL_COMPONENTS ' and build. At last replace the hash value in 'files/build/versions/versions-docker' by 'files/build/versions/versions-docker-latest'.
    - How to verify it
    'files/build/versions/versions-docker.log' will record some infomation.
    - Which release branch to backport (provide reason below if selected)
  • 201811
  • 201911
  • 202006

- Description for the changelog

support version control of the docker image

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

@liushilongbuaa
Copy link
Contributor Author

liushilongbuaa commented Nov 12, 2020

retest broadcom please #Closed

@liushilongbuaa
Copy link
Contributor Author

liushilongbuaa commented Nov 12, 2020

retest mellanox please #Closed

@liushilongbuaa
Copy link
Contributor Author

liushilongbuaa commented Nov 12, 2020

retest this please #Closed

files/build/scripts/j2 Outdated Show resolved Hide resolved
files/build/scripts/j2 Outdated Show resolved Hide resolved
slave.mk Outdated Show resolved Hide resolved
slave.mk Outdated Show resolved Hide resolved
Copy link
Collaborator

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comments

@liushilongbuaa
Copy link
Contributor Author

liushilongbuaa commented Dec 30, 2020

retest this please #ByDesign

2 similar comments
@liushilongbuaa
Copy link
Contributor Author

liushilongbuaa commented Dec 31, 2020

retest this please #ByDesign

@liushilongbuaa
Copy link
Contributor Author

liushilongbuaa commented Jan 2, 2021

retest this please #ByDesign

@@ -0,0 +1,63 @@
#!/bin/bash
Copy link
Collaborator

Choose a reason for hiding this comment

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

We may not need to hook the j2 script, we only want to change the Dockerfile file. I suggest change Makefile only, not to hook the j2 script.

scripts/version_control_image.sh Show resolved Hide resolved
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