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

Fix cache related mellanox bullseye build failures #9234

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

alexrallen
Copy link
Contributor

@alexrallen alexrallen commented Nov 11, 2021

Why I did it

Mellanox builds were failing intermittently due to the issue_version file and MFT package not building correctly in the Azure pipeline environment (both of these packages were patched to build correctly with bullseye running on the host and buster running on the dockers)

How I did it

Fixed two problems:

  1. BLDENV is not passed to the Makefiles so the references to this were replaced with correct logic
  2. issue_version was not defined as a target for bullseye and as such was not cached. Altered the build such that it is defined as a target for bullseye (in the case of buster it builds the file, in the case of bullseye it copies from buster)

The previous PR fixing this was reverted as it is no longer necessary for a passing build and was not a long-term fix. #9235

How to verify it

Build on AZP and verify success.

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

@alexrallen alexrallen marked this pull request as ready for review November 15, 2021 18:01
@alexrallen alexrallen changed the title Fix issu build issue on bullseye Fix cache related mellanox bullseye build failures Nov 15, 2021
@alexrallen alexrallen changed the base branch from master to 202106 November 15, 2021 18:08
@alexrallen alexrallen changed the base branch from 202106 to master November 15, 2021 18:08
@@ -18,7 +18,13 @@

ISSU_VERSION_FILE = issu-version
$(ISSU_VERSION_FILE)_SRC_PATH = $(PLATFORM_PATH)/issu-version

ifeq ($(BLDENV), buster)
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 15, 2021

Choose a reason for hiding this comment

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

buster

Wondering what is the DEPENDS for debian version before buster and after buster? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you please elaborate on your question?

This line exists because this only depends on APPLIBS when the build environment is buster (when it is actually generating the issu_version file)

Otherwise it will try to compile the mellanox sdk for bullseye (which it is not ready to do right now)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to double check: you mean issu_version only exists in Buster, Not in Bulleyes and later, not in Stretch and earlier versions?

@@ -35,7 +35,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
wget -O $(MFT_TGZ) http://www.mellanox.com/downloads/MFT/$(MFT_TGZ)
tar xzf $(MFT_TGZ)

ifeq ($(BLDENV), bullseye)
ifneq (,$(findstring bullseye,$(DEST)))
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 15, 2021

Choose a reason for hiding this comment

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

Could you explain this change? #Pending

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this checks if the target is bullseye or buster by looking at the destination path for the target.

Copy link
Collaborator

Choose a reason for hiding this comment

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

your code is only check bullseye? How it is different with original code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BLDENV is not exported to Makefiles, thus this was not functioning.

Copy link
Collaborator

Choose a reason for hiding this comment

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

However I notice is largely used by many other makefile. Is it something missing in build infra?


$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
ifneq (,$(findstring buster,$(DEST)))
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 15, 2021

Choose a reason for hiding this comment

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

Why this rule depends on Debian version? #Pending

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not on the debian version but what is currently being built.

If buster is being built it executes the program which exports the contents of the issue_version file in the buster slave docker.

If bullseye is being built it doesn't have access to this utility so it copies from the buster targets (which has already been built) to itself.

We do this so that we have the file available in both the buster and bullseye slave docker at build time and that both targets are correctly recognized by the build system and cached correctly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the reason of "If bullseye is being built it doesn't have access to this utility"? Any plan to have the utility (what is it?) in future?

I am wondering if you can make this Makefile not depends on any Debian versions, it should work for Buster, and any future Debian versions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You assume build order of Buster/Bullseye. Could you be explicit. I understand this PR is a temporary solution, and after SDK support Bullseye, all the Debian version dependency will be removed.

@qiluo-msft
Copy link
Collaborator

@xumia Please help check .dep file

@alexrallen
Copy link
Contributor Author

@qiluo-msft I think it is best if I respond to your commentary altogether as all of these changes are related to each other.

issu_version is simply a file, it is generated at build time using our SDK userspace tools. These userspace tools are primarily installed on the syncd container.

In buster, we were able to also seamlessly install those userspace tools onto the slave docker and generate the issu_version file for inclusion in the host image.

However, there is not a version of these tools that we officially support right now that is compatible with bullseye, so we can no longer install the tools directly onto the bullseye slave docker which is where the host is built.

In order to workaround this, what I am doing here is splitting the issue_version build into two parts:

One is a part that executes inside the buster build environment. This is the environment where we install these user-space tools and actually generate the issu_version file. This behaves identically to how it did prior to bullseye.

The second is the part that executes inside the bullseye build environment. In this environment we cannot directly call the sdk tools in order to generate the file so we need to make a couple changes. One, in the Makefile for issu_version I detect if we are in the bullseye build environment, if we are, then I skip generating the file and instead copy the file from the buster target to the bullseye target. Two, in the mk file which defines the dependencies we define that if we are in the bullseye build environment it does not depend on the SDK tools (because it does not, you see we are only performing a copy operation).

@alexrallen
Copy link
Contributor Author

Would like to note this is a temporary workaround while Mellanox syncd / sdk / sai packages are upgraded to support bullseye. I have created the following issue to track the removal of these workarounds once this upgrade process is complete.

#9279

@qiluo-msft please let me know if you require anything else.

@qiluo-msft qiluo-msft merged commit 53891c5 into sonic-net:master Nov 16, 2021
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