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

[Build]: Fix docker images built multiple times issue #9253

Merged
merged 3 commits into from
Dec 9, 2021

Conversation

xumia
Copy link
Collaborator

@xumia xumia commented Nov 14, 2021

Why I did it

The same docker image is built multiple times after upgrading to bullseye, the build time is increased to about 15 hours from 6 hours.
See log: https://dev.azure.com/mssonic/be1b070f-be15-4154-aade-b1d3bfb17054/_apis/build/builds/50390/logs/9
Line 1437: 2021-11-11T11:15:02.7094923Z [ building ] [ target/docker-sonic-telemetry.gz ]
Line 1446: 2021-11-11T11:37:41.1073304Z [ finished ] [ target/docker-sonic-telemetry.gz ]
Line 1459: 2021-11-11T11:38:20.6293007Z [ building ] [ target/docker-sonic-telemetry.gz-load ]
Line 1462: 2021-11-11T11:38:28.1250201Z [ finished ] [ target/docker-sonic-telemetry.gz-load ]
Line 2906: 2021-11-11T18:57:42.8207365Z [ building ] [ target/docker-sonic-telemetry.gz ]
Line 2917: 2021-11-11T19:43:47.1860961Z [ finished ] [ target/docker-sonic-telemetry.gz ]
Line 3997: 2021-11-11T22:49:35.0196252Z [ building ] [ target/docker-sonic-telemetry.gz ]
Line 4002: 2021-11-11T23:14:00.4127728Z [ finished ] [ target/docker-sonic-telemetry.gz ]

How I did it

Place the python wheels in another folder relative to the build distribution.

How to verify it

make sonic-broadcom.bin
make sonic-broadcom.raw

Make sure the docker build images, such as target/docker-sonic-telemetry.gz, not built multiple times.
https://dev.azure.com/mssonic/build/_build/results?buildId=51084&view=results

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

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106

Description for the changelog

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

@xumia xumia added the Build label Nov 14, 2021
@xumia xumia marked this pull request as ready for review November 14, 2021 23:14
@xumia
Copy link
Collaborator Author

xumia commented Nov 15, 2021

/azp run

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@xumia
Copy link
Collaborator Author

xumia commented Nov 15, 2021

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

lguohan
lguohan previously approved these changes Nov 15, 2021
@saiarcot895
Copy link
Contributor

For the Mellanox build failure, I think you'll need to remove the Python 2 dependencies from the base image build in slave.mk (lines 951-960). The reason it's not failing for the vs platform is because those Python 2 rules are not read for Bullseye (see rules/sonic-config.mk).

@saiarcot895
Copy link
Contributor

saiarcot895 commented Nov 15, 2021

For the broadcom build failure, the python wheels caching isn't taking into account whether it's being build for Buster or Bullseye. Because of this, for sonic-yang-models, it's using a cached python wheel built for Bullseye (not sure how it got cached in the first place) for the Buster build.

To fix this, in Makefile.cache, $(eval $(call FLAGS_DEP_RULES, $(SONIC_PYTHON_WHEELS), $(PYTHON_WHEELS_PATH),flags)) on line 486 needs to be changed to $(eval $(call FLAGS_DEP_RULES, $(SONIC_PYTHON_WHEELS), $(PYTHON_WHEELS_PATH),flags,$(BLDENV))).

Copy link
Contributor

@saiarcot895 saiarcot895 left a comment

Choose a reason for hiding this comment

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

Changes noted in earlier comments

@xumia
Copy link
Collaborator Author

xumia commented Nov 16, 2021

@saiarcot895 , thanks for your comments. We can set the BLDENV as a common flag, applying it for all targets, right?

@saiarcot895
Copy link
Contributor

@saiarcot895 , thanks for your comments. We can set the BLDENV as a common flag, applying it for all targets, right?

Possibly, I'm not entirely sure on that. The docker container image files are currently in the target/ directory, and not in a BLDENV-specific directory, so I'm wondering if there are cases where more rebuilds are done than necessary. It would still result in a proper image, but there could maybe be some extra docker image builds.

@xumia
Copy link
Collaborator Author

xumia commented Nov 17, 2021

@saiarcot895 , For some docker images should be relative to a BLDENV, such as docker-base-buster, docker-config-engine-buster. For the other dockers, such as docker-orchagent, it is buster currently, but it has no chance of buster or bullseye in undetermined status.
In short, for a docker image, the distribution should be fixed for the same commit. It should has not such issue.
Let's take a look for the build. Currently, it blocks by one of a test case failed in /sonic/src/sonic-config-engine/tests/test_cfggen.py, the nightly ci build also had such issue.
Triggered a new build in my fork merging branch: https://dev.azure.com/mssonic/build/_build/results?buildId=51787&view=results

@xumia
Copy link
Collaborator Author

xumia commented Nov 17, 2021

/azp run

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@xumia
Copy link
Collaborator Author

xumia commented Nov 17, 2021

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lguohan
Copy link
Collaborator

lguohan commented Nov 17, 2021

from the log, sonic-config-engine py2 build succeeded, but not sonic-config-engine py3 version.
https://dev.azure.com/mssonic/be1b070f-be15-4154-aade-b1d3bfb17054/_apis/build/builds/51787/logs/9

@lguohan
Copy link
Collaborator

lguohan commented Nov 18, 2021

/azp run

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@lguohan
Copy link
Collaborator

lguohan commented Nov 19, 2021

/azp run

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@lguohan
Copy link
Collaborator

lguohan commented Nov 19, 2021

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@xumia
Copy link
Collaborator Author

xumia commented Nov 19, 2021

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@xumia
Copy link
Collaborator Author

xumia commented Nov 23, 2021

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@xumia
Copy link
Collaborator Author

xumia commented Nov 23, 2021

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lguohan lguohan merged commit 49dd5db into sonic-net:master Dec 9, 2021
@xumia xumia added the Request for 202111 Branch For PRs being requested for 202111 branch label Dec 10, 2021
PYTHON_DEBS_PATH = $(TARGET_PATH)/python-debs
PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels
PYTHON_DEBS_PATH = $(TARGET_PATH)/python-debs/$(BLDENV)
PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels/$(BLDENV)
Copy link
Collaborator

Choose a reason for hiding this comment

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

PYTHON_WHEELS_PATH

The path changes, and it will break other pipelines if copying artifacts from here. For example: https://github.com/Azure/sonic-platform-daemons/blob/2b0acfbdc48089acf9224113bbf9a61030314e87/azure-pipelines.yml#L117

Do you expect each repo owner to fix the paths?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sujinmkang for awareness.

judyjoseph pushed a commit that referenced this pull request Dec 27, 2021
The same docker image is built multiple times after upgrading to bullseye, the build time is increased to about 15 hours from 6 hours.
See log: https://dev.azure.com/mssonic/be1b070f-be15-4154-aade-b1d3bfb17054/_apis/build/builds/50390/logs/9
Line 1437: 2021-11-11T11:15:02.7094923Z [ building ] [ target/docker-sonic-telemetry.gz ]
Line 1446: 2021-11-11T11:37:41.1073304Z [ finished ] [ target/docker-sonic-telemetry.gz ]
Line 1459: 2021-11-11T11:38:20.6293007Z [ building ] [ target/docker-sonic-telemetry.gz-load ]
Line 1462: 2021-11-11T11:38:28.1250201Z [ finished ] [ target/docker-sonic-telemetry.gz-load ]
Line 2906: 2021-11-11T18:57:42.8207365Z [ building ] [ target/docker-sonic-telemetry.gz ]
Line 2917: 2021-11-11T19:43:47.1860961Z [ finished ] [ target/docker-sonic-telemetry.gz ]
Line 3997: 2021-11-11T22:49:35.0196252Z [ building ] [ target/docker-sonic-telemetry.gz ]
Line 4002: 2021-11-11T23:14:00.4127728Z [ finished ] [ target/docker-sonic-telemetry.gz ]

How I did it
Place the python wheels in another folder relative to the build distribution.

Co-authored-by: Ubuntu <xumia@xumia-vm1.jqzc3g5pdlluxln0vevsg3s20h.xx.internal.cloudapp.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants