question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
premuncommented, Mar 11, 2021

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).

1reaction
riarenascommented, Mar 10, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found