AddBuildToChannel not handling builds that are already on a channel correctly
See original GitHub issue- This issue is blocking
- This issue is causing unreasonable pain
When we call AddBuildToChannel, if a build is already on a channel, we are supposed to return successfully. Today, the code looks like this
Build build = await _context.Builds.FindAsync(buildId);
if (build == null)
{
return NotFound(new ApiError($"The build with id '{buildId}' was not found."));
}
// If build is already in channel, nothing to do
if (build.BuildChannels != null &&
build.BuildChannels.Any(existingBuildChannels => existingBuildChannels.ChannelId == channelId))
{
return StatusCode((int)HttpStatusCode.Created);
}
However, build.BuildChannels is always null, because we don’t include BuildChannels when getting the build that should exist. We need to add .Include(b => b.BuildChannels)
to the build query.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
[Release Features] Inform missing channels during publish ...
We rely on builds being assigned to a channel for: Dependency update Asynchronous Publishing via release pipelines The new YAML stages based ...
Read more >I got the Dev channel build while being on the Beta ...
Am I just permanently switched to the dev channel. The dropdown list still is checked for beta, Im confused what to do. Image....
Read more >Build Errors and Solutions
When sharing a build error: Add as much information as possible, such as build stage, data source, error message, etc. Add "Build error:"...
Read more >arcade/Documentation/Darc.md at main · dotnet ...
Disabling or deleting a default channel association - By disabling a default channel association for a repo, no new builds of that repo...
Read more >conda-build Documentation
The conda-build options -c CHANNEL or --channel CHANNEL configure additional channels to search for packages.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There are actually unit tests for the controller, however the local SQL server doesn’t throw. I opened a PR but I will do additional validation tomorrow to make sure I actually fixed the bug (debugging of the code shows the correct code path).
I don’t think we have unit testing in place for individual darc commands yet, but this seems like a great candidate for that? I think it’d be overkill to make it part of the scenario tests when it’s just verifying that one command doesn’t throw.