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

Propagate build info from BAR to VMR outputs #4192

Merged
merged 15 commits into from
Nov 29, 2024

Conversation

dkurepa
Copy link
Member

@dkurepa dkurepa commented Nov 28, 2024

@dkurepa dkurepa changed the title [Not ready yet] Propagate build info from BAR to VMR outputs Propagate build info from BAR to VMR outputs Nov 28, 2024
Copy link
Member

@premun premun left a comment

Choose a reason for hiding this comment

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

I think this is much better and less invasive!

Just left some minor comments

@@ -76,8 +76,7 @@ public async Task<ILocalGitRepo> PrepareVmrAsync(
cancellationToken);

_vmrInfo.VmrPath = vmr.Path;
await _dependencyTracker.InitializeSourceMappings();
_sourceManifest.Refresh(_vmrInfo.SourceManifestPath);
await _dependencyTracker.RefreshMetadata();
Copy link
Member

Choose a reason for hiding this comment

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

Did you look in other usages of InitializeSourceMappings whether they can also change to this?

Copy link
Member Author

Choose a reason for hiding this comment

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

From what I saw we could use it almost everywhere, but it'd do some extra work that's not needed

Copy link
Member

Choose a reason for hiding this comment

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

I think it might be for the better if we just remove InitializeSourceMappings and just have RefreshMetadata (or maybe name it LoadMetadata so that we can be always sure we load everything always (and in future, if we add more metadata for instance)

Copy link
Member

Choose a reason for hiding this comment

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

I think we will need to be able to override the sourceMappingPath too

Comment on lines 281 to 282
var build = (await barClient.GetBuildsAsync(dependency.RepoUri, dependency.RepoUri))
.SingleOrDefault();
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if FirstOrDefault will be better than nothing. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

FirstOrDefault could be incorrect tho, in cases where we have multiple builds from the same commit. I'm not sure if we should try to get the newest build or do something like that tho. Currently, if this does happen, we'll still do the code flow, but won't have the OfficialBuildId, or the BarId. This could be a topic for the meeting on tuesday

Copy link
Member

Choose a reason for hiding this comment

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

I somehow still think it's better to have an approximately good information than nothing since the OfficialBuildId is required there for SB purposes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since we don't get the TargetVersion from BAR, I'll add back the method that we used to calculate the OfficialBuildId in cases where we don't have it from BAR. Think that will be more accurate than a 50/50 if we get a correct Bar build or not. Also think some logging might be good here

Copy link
Member

Choose a reason for hiding this comment

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

+1 for logging

Copy link
Member

@premun premun left a comment

Choose a reason for hiding this comment

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

When reviewing this, I realized a problem I should have probably thought about earlier.

When we will start synchronizing the VMR, the VMR sync pipeline will trigger at the same time as the official SDK pipeline. Which means the VMR sync will happen before a BAR ID for the official build is created. That means that no official build ID will be found for the uri/sha combination.

Let's talk about it tomorrow.

@@ -76,8 +76,7 @@ public async Task<ILocalGitRepo> PrepareVmrAsync(
cancellationToken);

_vmrInfo.VmrPath = vmr.Path;
await _dependencyTracker.InitializeSourceMappings();
_sourceManifest.Refresh(_vmrInfo.SourceManifestPath);
await _dependencyTracker.RefreshMetadata();
Copy link
Member

Choose a reason for hiding this comment

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

I think it might be for the better if we just remove InitializeSourceMappings and just have RefreshMetadata (or maybe name it LoadMetadata so that we can be always sure we load everything always (and in future, if we add more metadata for instance)

@@ -76,8 +76,7 @@ public async Task<ILocalGitRepo> PrepareVmrAsync(
cancellationToken);

_vmrInfo.VmrPath = vmr.Path;
await _dependencyTracker.InitializeSourceMappings();
_sourceManifest.Refresh(_vmrInfo.SourceManifestPath);
await _dependencyTracker.RefreshMetadata();
Copy link
Member

Choose a reason for hiding this comment

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

I think we will need to be able to override the sourceMappingPath too

Comment on lines 281 to 282
var build = (await barClient.GetBuildsAsync(dependency.RepoUri, dependency.RepoUri))
.SingleOrDefault();
Copy link
Member

Choose a reason for hiding this comment

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

I somehow still think it's better to have an approximately good information than nothing since the OfficialBuildId is required there for SB purposes.

@dkurepa
Copy link
Member Author

dkurepa commented Nov 29, 2024

When reviewing this, I realized a problem I should have probably thought about earlier.

When we will start synchronizing the VMR, the VMR sync pipeline will trigger at the same time as the official SDK pipeline. Which means the VMR sync will happen before a BAR ID for the official build is created. That means that no official build ID will be found for the uri/sha combination.

Let's talk about it tomorrow.

I think if I add the fallback mechanism for the OfficialBuildId, it will be good enough for now. The sdk repo won't have a build, so it won't have a BarId, but with the fallback I'll put back, it will have the official BuildId. And then other repos should be fine, because we'll find them recursively and find their bar builds. In case we don't it will still be at least as good as before

Copy link
Member

@premun premun left a comment

Choose a reason for hiding this comment

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

Looks nice!

@dkurepa dkurepa merged commit 2bd1d95 into dotnet:main Nov 29, 2024
9 checks passed
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