Skip to content

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

Closed
liushilongbuaa wants to merge 2 commits intosonic-net:masterfrom
liushilongbuaa:version-control-docker
Closed

[files/build]: Support reproduceable build for docker image#5895
liushilongbuaa wants to merge 2 commits intosonic-net:masterfrom
liushilongbuaa:version-control-docker

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

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

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.

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